mirror of https://github.com/apache/cloudstack.git
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.
This commit is contained in:
parent
3e4430d811
commit
c502b46703
|
|
@ -135,14 +135,14 @@ public class VmwareServerDiscoverer extends DiscovererBase implements
|
|||
return null;
|
||||
}
|
||||
|
||||
List<HostVO> hosts = _resourceMgr.listAllHostsInCluster(clusterId);
|
||||
List<HostVO> hosts = _resourceMgr.listAllHostsInCluster(clusterId);
|
||||
if (hosts != null && hosts.size() > 0) {
|
||||
int maxHostsPerCluster = _hvCapabilitiesDao.getMaxHostsPerCluster(hosts.get(0).getHypervisorType(), hosts.get(0).getHypervisorVersion());
|
||||
if (hosts.size() > maxHostsPerCluster) {
|
||||
String msg = "VMware cluster " + cluster.getName() + " is too big to add new host now. (current configured cluster size: " + maxHostsPerCluster + ")";
|
||||
s_logger.error(msg);
|
||||
throw new DiscoveredWithErrorException(msg);
|
||||
}
|
||||
if (hosts.size() >= maxHostsPerCluster) {
|
||||
String msg = "VMware cluster " + cluster.getName() + " is too big to add new host, current size: " + hosts.size() + ", max. size: " + maxHostsPerCluster;
|
||||
s_logger.error(msg);
|
||||
throw new DiscoveredWithErrorException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
String privateTrafficLabel = null;
|
||||
|
|
|
|||
|
|
@ -355,10 +355,10 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
|||
String version = about.getApiVersion();
|
||||
int maxHostsPerCluster = _hvCapabilitiesDao.getMaxHostsPerCluster(HypervisorType.VMware, version);
|
||||
if (hosts.size() > maxHostsPerCluster) {
|
||||
String msg = "vCenter cluster size is too big (current configured cluster size: " + maxHostsPerCluster + ")";
|
||||
s_logger.error(msg);
|
||||
throw new DiscoveredWithErrorException(msg);
|
||||
}
|
||||
String msg = "Failed to add VMware cluster as size is too big, current size: " + hosts.size() + ", max. size: " + maxHostsPerCluster;
|
||||
s_logger.error(msg);
|
||||
throw new DiscoveredWithErrorException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
for(ManagedObjectReference morHost: hosts) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue