bug : CS-15080 - check traffic label at host discovery stage also

Reviewed-by: anthony
This commit is contained in:
Kelven Yang 2012-05-25 10:55:21 -07:00
parent 5d888a44ba
commit 95766bef1d
2 changed files with 16 additions and 22 deletions

View File

@ -403,11 +403,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) {
@ -428,12 +426,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) {

View File

@ -113,15 +113,13 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
String publicTrafficLabel = null;
String guestTrafficLabel = null;
Map<String, String> vsmCredentials = null;
privateTrafficLabel = _netmgr.getDefaultManagementTrafficLabel(dcId, HypervisorType.VMware);
if (privateTrafficLabel != null) {
s_logger.info("Detected private network label : " + privateTrafficLabel);
}
if (_vmwareMgr.getNexusVSwitchGlobalParameter()) {
if (_vmwareMgr.getPrivateVSwitchTypeGlobalParameter() != null && _vmwareMgr.getPrivateVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus")) {
// Get physical network label
privateTrafficLabel = _netmgr.getDefaultManagementTrafficLabel(dcId, HypervisorType.VMware);
if (privateTrafficLabel != null) {
s_logger.info("Detected private network label : " + privateTrafficLabel);
}
}
DataCenterVO zone = _dcDao.findById(dcId);
NetworkType zoneType = zone.getNetworkType();
@ -151,11 +149,10 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
VmwareContext context = null;
try {
context = VmwareContextFactory.create(url.getHost(), username, password);
if (privateTrafficLabel != null)
context.registerStockObject("privateTrafficLabel", privateTrafficLabel);
if (_vmwareMgr.getNexusVSwitchGlobalParameter()) {
if (_vmwareMgr.getPrivateVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus")) {
if (privateTrafficLabel != null)
context.registerStockObject("privateTrafficLabel", privateTrafficLabel);
}
if (vsmCredentials != null) {
s_logger.info("Stocking credentials of Nexus VSM");
context.registerStockObject("vsmcredentials", vsmCredentials);