Skip to content

Commit c502b46

Browse files
author
Koushik Das
committed
CLOUDSTACK-1381
Fixed inconsistency in cluster limit check for Vmware clusters. While adding a new Vmware cluster limit check done correctly but while adding a host to an existing cluster there was an issue with limit check.
1 parent 3e4430d commit c502b46

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,14 @@ public Map<? extends ServerResource, Map<String, String>> find(long dcId, Long p
135135
return null;
136136
}
137137

138-
List<HostVO> hosts = _resourceMgr.listAllHostsInCluster(clusterId);
138+
List<HostVO> hosts = _resourceMgr.listAllHostsInCluster(clusterId);
139139
if (hosts != null && hosts.size() > 0) {
140140
int maxHostsPerCluster = _hvCapabilitiesDao.getMaxHostsPerCluster(hosts.get(0).getHypervisorType(), hosts.get(0).getHypervisorVersion());
141-
if (hosts.size() > maxHostsPerCluster) {
142-
String msg = "VMware cluster " + cluster.getName() + " is too big to add new host now. (current configured cluster size: " + maxHostsPerCluster + ")";
143-
s_logger.error(msg);
144-
throw new DiscoveredWithErrorException(msg);
145-
}
141+
if (hosts.size() >= maxHostsPerCluster) {
142+
String msg = "VMware cluster " + cluster.getName() + " is too big to add new host, current size: " + hosts.size() + ", max. size: " + maxHostsPerCluster;
143+
s_logger.error(msg);
144+
throw new DiscoveredWithErrorException(msg);
145+
}
146146
}
147147

148148
String privateTrafficLabel = null;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,10 @@ public List<ManagedObjectReference> addHostToPodCluster(VmwareContext serviceCon
355355
String version = about.getApiVersion();
356356
int maxHostsPerCluster = _hvCapabilitiesDao.getMaxHostsPerCluster(HypervisorType.VMware, version);
357357
if (hosts.size() > maxHostsPerCluster) {
358-
String msg = "vCenter cluster size is too big (current configured cluster size: " + maxHostsPerCluster + ")";
359-
s_logger.error(msg);
360-
throw new DiscoveredWithErrorException(msg);
361-
}
358+
String msg = "Failed to add VMware cluster as size is too big, current size: " + hosts.size() + ", max. size: " + maxHostsPerCluster;
359+
s_logger.error(msg);
360+
throw new DiscoveredWithErrorException(msg);
361+
}
362362
}
363363

364364
for(ManagedObjectReference morHost: hosts) {

0 commit comments

Comments
 (0)