diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java index 94ba97d96a1..2b3eba690e3 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java @@ -135,14 +135,14 @@ public class VmwareServerDiscoverer extends DiscovererBase implements return null; } - List hosts = _resourceMgr.listAllHostsInCluster(clusterId); + List 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; diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java index 9d29abf8d35..b2e37685d17 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java @@ -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) {