Skip to content

Commit dbe4e13

Browse files
committed
CLOUDSTACK-3778: serialize configuration of port group at per-host level to prevent run-time race condition
1 parent 75bb383 commit dbe4e13

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

‎plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,8 +1911,10 @@ private void plugPublicNic(VirtualMachineMO vmMo, final String vlanId, final Str
19111911
* so we assume that it's VLAN for now
19121912
*/
19131913
if (VirtualSwitchType.StandardVirtualSwitch == vSwitchType) {
1914-
networkInfo = HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(), "cloud.public",
1915-
vmMo.getRunningHost(), vlanId, null, null, _ops_timeout, true, BroadcastDomainType.Vlan, null);
1914+
synchronized(vmMo.getRunningHost().getMor().getValue().intern()) {
1915+
networkInfo = HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(), "cloud.public",
1916+
vmMo.getRunningHost(), vlanId, null, null, _ops_timeout, true, BroadcastDomainType.Vlan, null);
1917+
}
19161918
} else {
19171919
networkInfo = HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(), "cloud.public",
19181920
vmMo.getRunningHost(), vlanId, null, null, null, _ops_timeout, vSwitchType, _portsPerDvPortGroup, null, false, BroadcastDomainType.Vlan);
@@ -3246,9 +3248,11 @@ private Pair<ManagedObjectReference, String> prepareNetworkFromNicInfo(HostMO ho
32463248
s_logger.info("Prepare network on " + switchType + " " + switchName + " with name prefix: " + namePrefix);
32473249

32483250
if (VirtualSwitchType.StandardVirtualSwitch == switchType) {
3249-
networkInfo = HypervisorHostHelper.prepareNetwork(switchName.first(), namePrefix,
3250-
hostMo, getVlanInfo(nicTo, switchName.second()), nicTo.getNetworkRateMbps(), nicTo.getNetworkRateMulticastMbps(), _ops_timeout,
3251-
!namePrefix.startsWith("cloud.private"), nicTo.getBroadcastType(), nicTo.getUuid());
3251+
synchronized(hostMo.getMor().getValue().intern()) {
3252+
networkInfo = HypervisorHostHelper.prepareNetwork(switchName.first(), namePrefix,
3253+
hostMo, getVlanInfo(nicTo, switchName.second()), nicTo.getNetworkRateMbps(), nicTo.getNetworkRateMulticastMbps(), _ops_timeout,
3254+
!namePrefix.startsWith("cloud.private"), nicTo.getBroadcastType(), nicTo.getUuid());
3255+
}
32523256
}
32533257
else {
32543258
String vlanId = getVlanInfo(nicTo, switchName.second());

0 commit comments

Comments
 (0)