CLOUDSTACK-3778: serialize configuration of port group at per-host level to 
prevent run-time race condition


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

Branch: refs/heads/master
Commit: dbe4e13e8e0606b00abf81379c19c8de4b649364
Parents: 75bb383
Author: Kelven Yang <[email protected]>
Authored: Thu Aug 8 17:41:24 2013 -0700
Committer: Kelven Yang <[email protected]>
Committed: Wed Sep 4 14:49:45 2013 -0700

----------------------------------------------------------------------
 .../hypervisor/vmware/resource/VmwareResource.java    | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dbe4e13e/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
 
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 448e918..af6026b 100755
--- 
a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ 
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -1911,8 +1911,10 @@ public class VmwareResource implements 
StoragePoolResource, ServerResource, Vmwa
          *  so we assume that it's VLAN for now
          */
         if (VirtualSwitchType.StandardVirtualSwitch == vSwitchType) {
-            networkInfo = 
HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(), 
"cloud.public",
-                    vmMo.getRunningHost(), vlanId, null, null, _ops_timeout, 
true, BroadcastDomainType.Vlan, null);
+               
synchronized(vmMo.getRunningHost().getMor().getValue().intern()) {
+                   networkInfo = 
HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(), 
"cloud.public",
+                           vmMo.getRunningHost(), vlanId, null, null, 
_ops_timeout, true, BroadcastDomainType.Vlan, null);
+               }
         } else {
             networkInfo = 
HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(), 
"cloud.public",
                     vmMo.getRunningHost(), vlanId, null, null, null, 
_ops_timeout, vSwitchType, _portsPerDvPortGroup, null, false, 
BroadcastDomainType.Vlan);
@@ -3246,9 +3248,11 @@ public class VmwareResource implements 
StoragePoolResource, ServerResource, Vmwa
         s_logger.info("Prepare network on " + switchType + " " + switchName + 
" with name prefix: " + namePrefix);
 
         if (VirtualSwitchType.StandardVirtualSwitch == switchType) {
-            networkInfo = 
HypervisorHostHelper.prepareNetwork(switchName.first(), namePrefix,
-                    hostMo, getVlanInfo(nicTo, switchName.second()), 
nicTo.getNetworkRateMbps(), nicTo.getNetworkRateMulticastMbps(), _ops_timeout,
-                    !namePrefix.startsWith("cloud.private"), 
nicTo.getBroadcastType(), nicTo.getUuid());
+               synchronized(hostMo.getMor().getValue().intern()) {
+                   networkInfo = 
HypervisorHostHelper.prepareNetwork(switchName.first(), namePrefix,
+                           hostMo, getVlanInfo(nicTo, switchName.second()), 
nicTo.getNetworkRateMbps(), nicTo.getNetworkRateMulticastMbps(), _ops_timeout,
+                           !namePrefix.startsWith("cloud.private"), 
nicTo.getBroadcastType(), nicTo.getUuid());
+               }
         }
         else {
             String vlanId = getVlanInfo(nicTo, switchName.second());

Reply via email to