Skip to content

Commit a1d0925

Browse files
author
Sateesh Chodapuneedi
committed
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>
1 parent f099732 commit a1d0925

3 files changed

Lines changed: 30 additions & 9 deletions

File tree

plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,15 +299,19 @@ public VmwareServerDiscoverer() {
299299
if (guestTrafficLabel != null) {
300300
s_logger.info("Detected guest network label : " + guestTrafficLabel);
301301
}
302-
vsmIp = _urlParams.get("vsmipaddress");
303-
String vsmUser = _urlParams.get("vsmusername");
304-
String vsmPassword = _urlParams.get("vsmpassword");
305-
String clusterName = cluster.getName();
306-
try {
307-
vsmInfo = _nexusElement.validateAndAddVsm(vsmIp, vsmUser, vsmPassword, clusterId, clusterName);
308-
} catch (ResourceInUseException ex) {
309-
DiscoveryException discEx = new DiscoveryException(ex.getLocalizedMessage() + ". The resource is " + ex.getResourceName());
310-
throw discEx;
302+
// Before proceeding with validation of Nexus 1000v VSM check if an instance of Nexus 1000v VSM is already associated with this cluster.
303+
boolean clusterHasVsm = _vmwareMgr.hasNexusVSM(clusterId);
304+
if (!clusterHasVsm) {
305+
vsmIp = _urlParams.get("vsmipaddress");
306+
String vsmUser = _urlParams.get("vsmusername");
307+
String vsmPassword = _urlParams.get("vsmpassword");
308+
String clusterName = cluster.getName();
309+
try {
310+
vsmInfo = _nexusElement.validateAndAddVsm(vsmIp, vsmUser, vsmPassword, clusterId, clusterName);
311+
} catch (ResourceInUseException ex) {
312+
DiscoveryException discEx = new DiscoveryException(ex.getLocalizedMessage() + ". The resource is " + ex.getResourceName());
313+
throw discEx;
314+
}
311315
}
312316
vsmCredentials = _vmwareMgr.getNexusVSMCredentialsByClusterId(clusterId);
313317
}

plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,6 @@ public interface VmwareManager {
7777
public int getVcenterSessionTimeout();
7878

7979
boolean isLegacyZone(long dcId);
80+
81+
boolean hasNexusVSM(Long clusterId);
8082
}

plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,4 +1218,19 @@ public List<? extends VmwareDatacenter> listVmwareDatacenters(ListVmwareDcsCmd c
12181218
// Returning list of VmwareDatacenterVO objects, in-line with future requirements, if any, like participation of multiple VMware DCs in a zone.
12191219
return vmwareDcList;
12201220
}
1221+
1222+
@Override
1223+
public boolean hasNexusVSM(Long clusterId) {
1224+
ClusterVSMMapVO vsmMapVo = null;
1225+
1226+
vsmMapVo = _vsmMapDao.findByClusterId(clusterId);
1227+
if (vsmMapVo == null) {
1228+
s_logger.info("There is no instance of Nexus 1000v VSM associated with this cluster [Id:" + clusterId + "] yet.");
1229+
return false;
1230+
}
1231+
else {
1232+
s_logger.info("An instance of Nexus 1000v VSM [Id:" + vsmMapVo.getVsmId() + "] associated with this cluster [Id:" + clusterId + "]");
1233+
return true;
1234+
}
1235+
}
12211236
}

0 commit comments

Comments
 (0)