From d8d4232a7b83c6d50aed34d44541a3bdadb599c2 Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Fri, 25 May 2012 10:18:26 -0700 Subject: [PATCH] bug : CS-15080 - check traffic label at host discovery stage also --- .../hypervisor/vmware/VmwareManagerImpl.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/server/src/com/cloud/hypervisor/vmware/VmwareManagerImpl.java b/server/src/com/cloud/hypervisor/vmware/VmwareManagerImpl.java index 705b46fcec1..746b582dc6d 100755 --- a/server/src/com/cloud/hypervisor/vmware/VmwareManagerImpl.java +++ b/server/src/com/cloud/hypervisor/vmware/VmwareManagerImpl.java @@ -376,11 +376,9 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis mor = serviceContext.getHostMorByPath(hostInventoryPath); String privateTrafficLabel = null; - if (_nexusVSwitchActive) { - privateTrafficLabel = serviceContext.getStockObject("privateTrafficLabel"); - if (privateTrafficLabel == null) { - privateTrafficLabel = _privateNetworkVSwitchName; - } + privateTrafficLabel = serviceContext.getStockObject("privateTrafficLabel"); + if (privateTrafficLabel == null) { + privateTrafficLabel = _privateNetworkVSwitchName; } if(mor != null) { @@ -401,12 +399,11 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis } // prepare at least one network on the vswitch to enable OVF importing - String managementPortGroupName = getManagementPortGroupByHost(hostMo); - assert(managementPortGroupName != null); - HostPortGroupSpec spec = hostMo.getPortGroupSpec(managementPortGroupName); String vlanId = null; - if(spec.getVlanId() != 0) { - vlanId = String.valueOf(spec.getVlanId()); + if(privateTrafficLabel != null) { + String[] tokens = privateTrafficLabel.split(","); + if(tokens.length == 2) + vlanId = tokens[1]; } if(!_nexusVSwitchActive) {