CLOUDSTACK-7360 [vmware] Add host to existing cluster fails if the cluster is using Nexus 1000v as backend for atleast one traffic type.

While adding host to existing cluster which is using Nexus 1000v as a network backend, skip validation of Nexus VSM as it was already done while adding that cluster.

Signed-off-by: Sateesh Chodapuneedi <sateesh@apache.org>
This commit is contained in:
Sateesh Chodapuneedi 2014-08-18 07:18:13 +05:30
parent f099732be7
commit a1d0925f90
3 changed files with 30 additions and 9 deletions

View File

@ -299,15 +299,19 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
if (guestTrafficLabel != null) { if (guestTrafficLabel != null) {
s_logger.info("Detected guest network label : " + guestTrafficLabel); s_logger.info("Detected guest network label : " + guestTrafficLabel);
} }
vsmIp = _urlParams.get("vsmipaddress"); // Before proceeding with validation of Nexus 1000v VSM check if an instance of Nexus 1000v VSM is already associated with this cluster.
String vsmUser = _urlParams.get("vsmusername"); boolean clusterHasVsm = _vmwareMgr.hasNexusVSM(clusterId);
String vsmPassword = _urlParams.get("vsmpassword"); if (!clusterHasVsm) {
String clusterName = cluster.getName(); vsmIp = _urlParams.get("vsmipaddress");
try { String vsmUser = _urlParams.get("vsmusername");
vsmInfo = _nexusElement.validateAndAddVsm(vsmIp, vsmUser, vsmPassword, clusterId, clusterName); String vsmPassword = _urlParams.get("vsmpassword");
} catch (ResourceInUseException ex) { String clusterName = cluster.getName();
DiscoveryException discEx = new DiscoveryException(ex.getLocalizedMessage() + ". The resource is " + ex.getResourceName()); try {
throw discEx; vsmInfo = _nexusElement.validateAndAddVsm(vsmIp, vsmUser, vsmPassword, clusterId, clusterName);
} catch (ResourceInUseException ex) {
DiscoveryException discEx = new DiscoveryException(ex.getLocalizedMessage() + ". The resource is " + ex.getResourceName());
throw discEx;
}
} }
vsmCredentials = _vmwareMgr.getNexusVSMCredentialsByClusterId(clusterId); vsmCredentials = _vmwareMgr.getNexusVSMCredentialsByClusterId(clusterId);
} }

View File

@ -77,4 +77,6 @@ public interface VmwareManager {
public int getVcenterSessionTimeout(); public int getVcenterSessionTimeout();
boolean isLegacyZone(long dcId); boolean isLegacyZone(long dcId);
boolean hasNexusVSM(Long clusterId);
} }

View File

@ -1218,4 +1218,19 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
// Returning list of VmwareDatacenterVO objects, in-line with future requirements, if any, like participation of multiple VMware DCs in a zone. // Returning list of VmwareDatacenterVO objects, in-line with future requirements, if any, like participation of multiple VMware DCs in a zone.
return vmwareDcList; return vmwareDcList;
} }
@Override
public boolean hasNexusVSM(Long clusterId) {
ClusterVSMMapVO vsmMapVo = null;
vsmMapVo = _vsmMapDao.findByClusterId(clusterId);
if (vsmMapVo == null) {
s_logger.info("There is no instance of Nexus 1000v VSM associated with this cluster [Id:" + clusterId + "] yet.");
return false;
}
else {
s_logger.info("An instance of Nexus 1000v VSM [Id:" + vsmMapVo.getVsmId() + "] associated with this cluster [Id:" + clusterId + "]");
return true;
}
}
} }