cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From weiz...@apache.org
Subject git commit: updated refs/heads/4.2 to 86976fb
Date Fri, 08 Nov 2013 13:36:59 GMT
Updated Branches:
  refs/heads/4.2 9e6a1eaff -> 86976fb29


CLOUDSTACK-5076: fix wrong bridge name in vm domain xml desc after upgrade from 4.0 or before
to 4.2


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/86976fb2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/86976fb2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/86976fb2

Branch: refs/heads/4.2
Commit: 86976fb298bb05b7a5380573e292ec9687169228
Parents: 9e6a1ea
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Fri Nov 8 14:36:48 2013 +0100
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Fri Nov 8 14:36:48 2013 +0100

----------------------------------------------------------------------
 .../kvm/resource/LibvirtComputingResource.java      | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/86976fb2/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index b1de827..182cb22 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -205,6 +205,7 @@ import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.GuestDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.GuestResourceDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InputDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef.guestNetType;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef.hostNicType;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.SerialDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.TermPolicy;
@@ -4385,6 +4386,21 @@ ServerResource {
         try {
             dm = conn.domainLookupByName(vmName);
             String vmDef = dm.getXMLDesc(0);
+            LibvirtDomainXMLParser parser = new LibvirtDomainXMLParser();
+            parser.parseDomainXML(vmDef);
+            for (InterfaceDef nic :parser.getInterfaces()) {
+                if ((nic.getNetType() == guestNetType.BRIDGE) && (nic.getBrName().startsWith("cloudVirBr")))
{
+                    try {
+                        int vnetId = Integer.parseInt(nic.getBrName().replaceFirst("cloudVirBr",
""));
+                        String pifName = getPif(_guestBridgeName);
+                        String newBrName = "br" + pifName + "-"+ vnetId;
+                        vmDef = vmDef.replaceAll("'" + nic.getBrName() + "'", "'" + newBrName
+ "'");
+                        s_logger.debug("VM bridge name is changed from " + nic.getBrName()
+ " to " + newBrName);
+                    } catch (NumberFormatException e) {
+                        continue;
+                    }
+                }
+            }
             s_logger.debug(vmDef);
             msg = stopVM(conn, vmName);
             msg = startVM(conn, vmName, vmDef);


Mime
View raw message