mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-672: Set VMware cluster max. limit based on HV version
Max. number of hosts in a Vmware clueter is specific to the version of the HV. This limit is read from the hypervisor_capabilities table
This commit is contained in:
parent
bd4661e467
commit
bc493bd39b
@ -46,4 +46,10 @@ public interface HypervisorCapabilities extends Identity, InternalIdentity{
|
|||||||
* @return the max. data volumes per VM supported by hypervisor
|
* @return the max. data volumes per VM supported by hypervisor
|
||||||
*/
|
*/
|
||||||
Integer getMaxDataVolumesLimit();
|
Integer getMaxDataVolumesLimit();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the max. hosts per cluster supported by hypervisor
|
||||||
|
*/
|
||||||
|
Integer getMaxHostsPerCluster();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,6 +59,9 @@ public class HypervisorCapabilitiesVO implements HypervisorCapabilities {
|
|||||||
@Column(name="max_data_volumes_limit")
|
@Column(name="max_data_volumes_limit")
|
||||||
private Integer maxDataVolumesLimit;
|
private Integer maxDataVolumesLimit;
|
||||||
|
|
||||||
|
@Column(name="max_hosts_per_cluster")
|
||||||
|
private Integer maxHostsPerCluster;
|
||||||
|
|
||||||
protected HypervisorCapabilitiesVO() {
|
protected HypervisorCapabilitiesVO() {
|
||||||
this.uuid = UUID.randomUUID().toString();
|
this.uuid = UUID.randomUUID().toString();
|
||||||
}
|
}
|
||||||
@ -157,6 +160,15 @@ public class HypervisorCapabilitiesVO implements HypervisorCapabilities {
|
|||||||
this.maxDataVolumesLimit = maxDataVolumesLimit;
|
this.maxDataVolumesLimit = maxDataVolumesLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getMaxHostsPerCluster() {
|
||||||
|
return maxHostsPerCluster;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxHostsPerCluster(Integer maxHostsPerCluster) {
|
||||||
|
this.maxHostsPerCluster = maxHostsPerCluster;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof HypervisorCapabilitiesVO) {
|
if (obj instanceof HypervisorCapabilitiesVO) {
|
||||||
|
|||||||
@ -45,6 +45,7 @@ import com.cloud.host.HostVO;
|
|||||||
import com.cloud.host.dao.HostDao;
|
import com.cloud.host.dao.HostDao;
|
||||||
import com.cloud.hypervisor.Hypervisor;
|
import com.cloud.hypervisor.Hypervisor;
|
||||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
|
import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao;
|
||||||
import com.cloud.hypervisor.vmware.manager.VmwareManager;
|
import com.cloud.hypervisor.vmware.manager.VmwareManager;
|
||||||
import com.cloud.hypervisor.vmware.mo.ClusterMO;
|
import com.cloud.hypervisor.vmware.mo.ClusterMO;
|
||||||
import com.cloud.hypervisor.vmware.mo.HostMO;
|
import com.cloud.hypervisor.vmware.mo.HostMO;
|
||||||
@ -95,78 +96,69 @@ public class VmwareServerDiscoverer extends DiscovererBase implements
|
|||||||
CiscoNexusVSMDeviceDao _nexusDao;
|
CiscoNexusVSMDeviceDao _nexusDao;
|
||||||
@Inject
|
@Inject
|
||||||
NetworkModel _netmgr;
|
NetworkModel _netmgr;
|
||||||
|
@Inject
|
||||||
|
HypervisorCapabilitiesDao _hvCapabilitiesDao;
|
||||||
|
|
||||||
public VmwareServerDiscoverer() {
|
public VmwareServerDiscoverer() {
|
||||||
s_logger.info("VmwareServerDiscoverer is constructed");
|
s_logger.info("VmwareServerDiscoverer is constructed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<? extends ServerResource, Map<String, String>> find(long dcId,
|
public Map<? extends ServerResource, Map<String, String>> find(long dcId, Long podId, Long clusterId, URI url,
|
||||||
Long podId, Long clusterId, URI url, String username,
|
String username, String password, List<String> hostTags) throws DiscoveryException {
|
||||||
String password, List<String> hostTags) throws DiscoveryException {
|
|
||||||
|
|
||||||
if (s_logger.isInfoEnabled())
|
if(s_logger.isInfoEnabled())
|
||||||
s_logger.info("Discover host. dc: " + dcId + ", pod: " + podId
|
s_logger.info("Discover host. dc: " + dcId + ", pod: " + podId + ", cluster: " + clusterId + ", uri host: " + url.getHost());
|
||||||
+ ", cluster: " + clusterId + ", uri host: "
|
|
||||||
+ url.getHost());
|
|
||||||
|
|
||||||
if (podId == null) {
|
if(podId == null) {
|
||||||
if (s_logger.isInfoEnabled())
|
if(s_logger.isInfoEnabled())
|
||||||
s_logger.info("No pod is assigned, assuming that it is not for vmware and skip it to next discoverer");
|
s_logger.info("No pod is assigned, assuming that it is not for vmware and skip it to next discoverer");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClusterVO cluster = _clusterDao.findById(clusterId);
|
ClusterVO cluster = _clusterDao.findById(clusterId);
|
||||||
if (cluster == null
|
if(cluster == null || cluster.getHypervisorType() != HypervisorType.VMware) {
|
||||||
|| cluster.getHypervisorType() != HypervisorType.VMware) {
|
if(s_logger.isInfoEnabled())
|
||||||
if (s_logger.isInfoEnabled())
|
s_logger.info("invalid cluster id or cluster is not for VMware hypervisors");
|
||||||
s_logger.info("invalid cluster id or cluster is not for VMware hypervisors");
|
return null;
|
||||||
return null;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
List<HostVO> hosts = _resourceMgr.listAllHostsInCluster(clusterId);
|
List<HostVO> hosts = _resourceMgr.listAllHostsInCluster(clusterId);
|
||||||
if (hosts.size() >= _vmwareMgr.getMaxHostsPerCluster()) {
|
if (hosts != null && hosts.size() > 0) {
|
||||||
String msg = "VMware cluster "
|
int maxHostsPerCluster = _hvCapabilitiesDao.getMaxHostsPerCluster(hosts.get(0).getHypervisorType(), hosts.get(0).getHypervisorVersion());
|
||||||
+ cluster.getName()
|
if (hosts.size() > maxHostsPerCluster) {
|
||||||
+ " is too big to add new host now. (current configured cluster size: "
|
String msg = "VMware cluster " + cluster.getName() + " is too big to add new host now. (current configured cluster size: " + maxHostsPerCluster + ")";
|
||||||
+ _vmwareMgr.getMaxHostsPerCluster() + ")";
|
s_logger.error(msg);
|
||||||
s_logger.error(msg);
|
throw new DiscoveredWithErrorException(msg);
|
||||||
throw new DiscoveredWithErrorException(msg);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String privateTrafficLabel = null;
|
String privateTrafficLabel = null;
|
||||||
String publicTrafficLabel = null;
|
String publicTrafficLabel = null;
|
||||||
String guestTrafficLabel = null;
|
String guestTrafficLabel = null;
|
||||||
Map<String, String> vsmCredentials = null;
|
Map<String, String> vsmCredentials = null;
|
||||||
|
|
||||||
privateTrafficLabel = _netmgr.getDefaultManagementTrafficLabel(dcId,
|
privateTrafficLabel = _netmgr.getDefaultManagementTrafficLabel(dcId, HypervisorType.VMware);
|
||||||
HypervisorType.VMware);
|
if (privateTrafficLabel != null) {
|
||||||
if (privateTrafficLabel != null) {
|
s_logger.info("Detected private network label : " + privateTrafficLabel);
|
||||||
s_logger.info("Detected private network label : "
|
}
|
||||||
+ privateTrafficLabel);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_vmwareMgr.getNexusVSwitchGlobalParameter()) {
|
if (_vmwareMgr.getNexusVSwitchGlobalParameter()) {
|
||||||
DataCenterVO zone = _dcDao.findById(dcId);
|
DataCenterVO zone = _dcDao.findById(dcId);
|
||||||
NetworkType zoneType = zone.getNetworkType();
|
NetworkType zoneType = zone.getNetworkType();
|
||||||
if (zoneType != NetworkType.Basic) {
|
if (zoneType != NetworkType.Basic) {
|
||||||
publicTrafficLabel = _netmgr.getDefaultPublicTrafficLabel(dcId,
|
publicTrafficLabel = _netmgr.getDefaultPublicTrafficLabel(dcId, HypervisorType.VMware);
|
||||||
HypervisorType.VMware);
|
if (publicTrafficLabel != null) {
|
||||||
if (publicTrafficLabel != null) {
|
s_logger.info("Detected public network label : " + publicTrafficLabel);
|
||||||
s_logger.info("Detected public network label : "
|
}
|
||||||
+ publicTrafficLabel);
|
}
|
||||||
}
|
// Get physical network label
|
||||||
}
|
guestTrafficLabel = _netmgr.getDefaultGuestTrafficLabel(dcId, HypervisorType.VMware);
|
||||||
// Get physical network label
|
if (guestTrafficLabel != null) {
|
||||||
guestTrafficLabel = _netmgr.getDefaultGuestTrafficLabel(dcId,
|
s_logger.info("Detected guest network label : " + guestTrafficLabel);
|
||||||
HypervisorType.VMware);
|
}
|
||||||
if (guestTrafficLabel != null) {
|
vsmCredentials = _vmwareMgr.getNexusVSMCredentialsByClusterId(clusterId);
|
||||||
s_logger.info("Detected guest network label : "
|
}
|
||||||
+ guestTrafficLabel);
|
|
||||||
}
|
|
||||||
vsmCredentials = _vmwareMgr
|
|
||||||
.getNexusVSMCredentialsByClusterId(clusterId);
|
|
||||||
}
|
|
||||||
|
|
||||||
VmwareContext context = null;
|
VmwareContext context = null;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -29,10 +29,6 @@ import com.vmware.vim25.ManagedObjectReference;
|
|||||||
public interface VmwareManager {
|
public interface VmwareManager {
|
||||||
public final String CONTEXT_STOCK_NAME = "vmwareMgr";
|
public final String CONTEXT_STOCK_NAME = "vmwareMgr";
|
||||||
|
|
||||||
// this limitation comes from the fact that we are using linked clone on shared VMFS storage,
|
|
||||||
// we need to limit the size of vCenter cluster, http://en.wikipedia.org/wiki/VMware_VMFS
|
|
||||||
public final int MAX_HOSTS_PER_CLUSTER = 8;
|
|
||||||
|
|
||||||
String composeWorkerName();
|
String composeWorkerName();
|
||||||
|
|
||||||
String getSystemVMIsoFileNameOnDatastore();
|
String getSystemVMIsoFileNameOnDatastore();
|
||||||
@ -57,7 +53,6 @@ public interface VmwareManager {
|
|||||||
|
|
||||||
Pair<Integer, Integer> getAddiionalVncPortRange();
|
Pair<Integer, Integer> getAddiionalVncPortRange();
|
||||||
|
|
||||||
int getMaxHostsPerCluster();
|
|
||||||
int getRouterExtraPublicNics();
|
int getRouterExtraPublicNics();
|
||||||
|
|
||||||
boolean beginExclusiveOperation(int timeOutSeconds);
|
boolean beginExclusiveOperation(int timeOutSeconds);
|
||||||
|
|||||||
@ -58,6 +58,7 @@ import com.cloud.host.HostVO;
|
|||||||
import com.cloud.host.Status;
|
import com.cloud.host.Status;
|
||||||
import com.cloud.host.dao.HostDao;
|
import com.cloud.host.dao.HostDao;
|
||||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
|
import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao;
|
||||||
import com.cloud.hypervisor.vmware.VmwareCleanupMaid;
|
import com.cloud.hypervisor.vmware.VmwareCleanupMaid;
|
||||||
import com.cloud.hypervisor.vmware.mo.DiskControllerType;
|
import com.cloud.hypervisor.vmware.mo.DiskControllerType;
|
||||||
import com.cloud.hypervisor.vmware.mo.HostFirewallSystemMO;
|
import com.cloud.hypervisor.vmware.mo.HostFirewallSystemMO;
|
||||||
@ -91,6 +92,7 @@ import com.cloud.utils.ssh.SshHelper;
|
|||||||
import com.cloud.vm.DomainRouterVO;
|
import com.cloud.vm.DomainRouterVO;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.vmware.apputils.vim25.ServiceUtil;
|
import com.vmware.apputils.vim25.ServiceUtil;
|
||||||
|
import com.vmware.vim25.AboutInfo;
|
||||||
import com.vmware.vim25.HostConnectSpec;
|
import com.vmware.vim25.HostConnectSpec;
|
||||||
import com.vmware.vim25.ManagedObjectReference;
|
import com.vmware.vim25.ManagedObjectReference;
|
||||||
|
|
||||||
@ -119,6 +121,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
|||||||
@Inject ClusterVSMMapDao _vsmMapDao;
|
@Inject ClusterVSMMapDao _vsmMapDao;
|
||||||
@Inject ConfigurationDao _configDao;
|
@Inject ConfigurationDao _configDao;
|
||||||
@Inject ConfigurationServer _configServer;
|
@Inject ConfigurationServer _configServer;
|
||||||
|
@Inject HypervisorCapabilitiesDao _hvCapabilitiesDao;
|
||||||
|
|
||||||
String _mountParent;
|
String _mountParent;
|
||||||
StorageLayer _storage;
|
StorageLayer _storage;
|
||||||
@ -133,7 +136,6 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
|||||||
String _recycleHungWorker = "false";
|
String _recycleHungWorker = "false";
|
||||||
int _additionalPortRangeStart;
|
int _additionalPortRangeStart;
|
||||||
int _additionalPortRangeSize;
|
int _additionalPortRangeSize;
|
||||||
int _maxHostsPerCluster;
|
|
||||||
int _routerExtraPublicNics = 2;
|
int _routerExtraPublicNics = 2;
|
||||||
|
|
||||||
String _cpuOverprovisioningFactor = "1";
|
String _cpuOverprovisioningFactor = "1";
|
||||||
@ -260,7 +262,6 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
|||||||
|
|
||||||
_routerExtraPublicNics = NumbersUtil.parseInt(_configDao.getValue(Config.RouterExtraPublicNics.key()), 2);
|
_routerExtraPublicNics = NumbersUtil.parseInt(_configDao.getValue(Config.RouterExtraPublicNics.key()), 2);
|
||||||
|
|
||||||
_maxHostsPerCluster = NumbersUtil.parseInt(_configDao.getValue(Config.VmwarePerClusterHostMax.key()), VmwareManager.MAX_HOSTS_PER_CLUSTER);
|
|
||||||
_cpuOverprovisioningFactor = _configDao.getValue(Config.CPUOverprovisioningFactor.key());
|
_cpuOverprovisioningFactor = _configDao.getValue(Config.CPUOverprovisioningFactor.key());
|
||||||
if(_cpuOverprovisioningFactor == null || _cpuOverprovisioningFactor.isEmpty())
|
if(_cpuOverprovisioningFactor == null || _cpuOverprovisioningFactor.isEmpty())
|
||||||
_cpuOverprovisioningFactor = "1";
|
_cpuOverprovisioningFactor = "1";
|
||||||
@ -400,10 +401,15 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
|||||||
ManagedObjectReference[] hosts = (ManagedObjectReference[])serviceContext.getServiceUtil().getDynamicProperty(mor, "host");
|
ManagedObjectReference[] hosts = (ManagedObjectReference[])serviceContext.getServiceUtil().getDynamicProperty(mor, "host");
|
||||||
assert(hosts != null);
|
assert(hosts != null);
|
||||||
|
|
||||||
if(hosts.length > _maxHostsPerCluster) {
|
if (hosts.length > 0) {
|
||||||
String msg = "vCenter cluster size is too big (current configured cluster size: " + _maxHostsPerCluster + ")";
|
AboutInfo about = (AboutInfo)(serviceContext.getServiceUtil().getDynamicProperty(hosts[0], "config.product"));
|
||||||
s_logger.error(msg);
|
String version = about.getApiVersion();
|
||||||
throw new DiscoveredWithErrorException(msg);
|
int maxHostsPerCluster = _hvCapabilitiesDao.getMaxHostsPerCluster(HypervisorType.VMware, version);
|
||||||
|
if (hosts.length > maxHostsPerCluster) {
|
||||||
|
String msg = "vCenter cluster size is too big (current configured cluster size: " + maxHostsPerCluster + ")";
|
||||||
|
s_logger.error(msg);
|
||||||
|
throw new DiscoveredWithErrorException(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(ManagedObjectReference morHost: hosts) {
|
for(ManagedObjectReference morHost: hosts) {
|
||||||
@ -868,11 +874,6 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
|||||||
return new Pair<Integer, Integer>(_additionalPortRangeStart, _additionalPortRangeSize);
|
return new Pair<Integer, Integer>(_additionalPortRangeStart, _additionalPortRangeSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxHostsPerCluster() {
|
|
||||||
return this._maxHostsPerCluster;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRouterExtraPublicNics() {
|
public int getRouterExtraPublicNics() {
|
||||||
return this._routerExtraPublicNics;
|
return this._routerExtraPublicNics;
|
||||||
|
|||||||
@ -258,7 +258,6 @@ public enum Config {
|
|||||||
VmwareAdditionalVncPortRangeStart("Advanced", ManagementServer.class, Integer.class, "vmware.additional.vnc.portrange.start", "50000", "Start port number of additional VNC port range", null),
|
VmwareAdditionalVncPortRangeStart("Advanced", ManagementServer.class, Integer.class, "vmware.additional.vnc.portrange.start", "50000", "Start port number of additional VNC port range", null),
|
||||||
VmwareAdditionalVncPortRangeSize("Advanced", ManagementServer.class, Integer.class, "vmware.additional.vnc.portrange.size", "1000", "Start port number of additional VNC port range", null),
|
VmwareAdditionalVncPortRangeSize("Advanced", ManagementServer.class, Integer.class, "vmware.additional.vnc.portrange.size", "1000", "Start port number of additional VNC port range", null),
|
||||||
//VmwareGuestNicDeviceType("Advanced", ManagementServer.class, String.class, "vmware.guest.nic.device.type", "E1000", "Ethernet card type used in guest VM, valid values are E1000, PCNet32, Vmxnet2, Vmxnet3", null),
|
//VmwareGuestNicDeviceType("Advanced", ManagementServer.class, String.class, "vmware.guest.nic.device.type", "E1000", "Ethernet card type used in guest VM, valid values are E1000, PCNet32, Vmxnet2, Vmxnet3", null),
|
||||||
VmwarePerClusterHostMax("Advanced", ManagementServer.class, Integer.class, "vmware.percluster.host.max", "8", "maxmium hosts per vCenter cluster(do not let it grow over 8)", "1-8"),
|
|
||||||
VmwareReserveCpu("Advanced", ManagementServer.class, Boolean.class, "vmware.reserve.cpu", "false", "Specify whether or not to reserve CPU based on CPU overprovisioning factor", null),
|
VmwareReserveCpu("Advanced", ManagementServer.class, Boolean.class, "vmware.reserve.cpu", "false", "Specify whether or not to reserve CPU based on CPU overprovisioning factor", null),
|
||||||
VmwareReserveMem("Advanced", ManagementServer.class, Boolean.class, "vmware.reserve.mem", "false", "Specify whether or not to reserve memory based on memory overprovisioning factor", null),
|
VmwareReserveMem("Advanced", ManagementServer.class, Boolean.class, "vmware.reserve.mem", "false", "Specify whether or not to reserve memory based on memory overprovisioning factor", null),
|
||||||
VmwareRootDiskControllerType("Advanced", ManagementServer.class, String.class, "vmware.root.disk.controller", "ide", "Specify the default disk controller for root volumes, valid values are scsi, ide", null),
|
VmwareRootDiskControllerType("Advanced", ManagementServer.class, String.class, "vmware.root.disk.controller", "ide", "Specify the default disk controller for root volumes, valid values are scsi, ide", null),
|
||||||
|
|||||||
@ -31,4 +31,6 @@ public interface HypervisorCapabilitiesDao extends GenericDao<HypervisorCapabili
|
|||||||
Long getMaxGuestsLimit(HypervisorType hypervisorType, String hypervisorVersion);
|
Long getMaxGuestsLimit(HypervisorType hypervisorType, String hypervisorVersion);
|
||||||
|
|
||||||
Integer getMaxDataVolumesLimit(HypervisorType hypervisorType, String hypervisorVersion);
|
Integer getMaxDataVolumesLimit(HypervisorType hypervisorType, String hypervisorVersion);
|
||||||
|
|
||||||
|
Integer getMaxHostsPerCluster(HypervisorType hypervisorType, String hypervisorVersion);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,8 +38,6 @@ public class HypervisorCapabilitiesDaoImpl extends GenericDaoBase<HypervisorCapa
|
|||||||
|
|
||||||
protected final SearchBuilder<HypervisorCapabilitiesVO> HypervisorTypeSearch;
|
protected final SearchBuilder<HypervisorCapabilitiesVO> HypervisorTypeSearch;
|
||||||
protected final SearchBuilder<HypervisorCapabilitiesVO> HypervisorTypeAndVersionSearch;
|
protected final SearchBuilder<HypervisorCapabilitiesVO> HypervisorTypeAndVersionSearch;
|
||||||
protected final GenericSearchBuilder<HypervisorCapabilitiesVO, Long> MaxGuestLimitByHypervisorSearch;
|
|
||||||
protected final GenericSearchBuilder<HypervisorCapabilitiesVO, Integer> MaxDataVolumesLimitByHypervisorSearch;
|
|
||||||
|
|
||||||
private static final String DEFAULT_VERSION = "default";
|
private static final String DEFAULT_VERSION = "default";
|
||||||
|
|
||||||
@ -52,18 +50,14 @@ public class HypervisorCapabilitiesDaoImpl extends GenericDaoBase<HypervisorCapa
|
|||||||
HypervisorTypeAndVersionSearch.and("hypervisorType", HypervisorTypeAndVersionSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ);
|
HypervisorTypeAndVersionSearch.and("hypervisorType", HypervisorTypeAndVersionSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ);
|
||||||
HypervisorTypeAndVersionSearch.and("hypervisorVersion", HypervisorTypeAndVersionSearch.entity().getHypervisorVersion(), SearchCriteria.Op.EQ);
|
HypervisorTypeAndVersionSearch.and("hypervisorVersion", HypervisorTypeAndVersionSearch.entity().getHypervisorVersion(), SearchCriteria.Op.EQ);
|
||||||
HypervisorTypeAndVersionSearch.done();
|
HypervisorTypeAndVersionSearch.done();
|
||||||
|
}
|
||||||
|
|
||||||
MaxGuestLimitByHypervisorSearch = createSearchBuilder(Long.class);
|
HypervisorCapabilitiesVO getCapabilities(HypervisorType hypervisorType, String hypervisorVersion) {
|
||||||
MaxGuestLimitByHypervisorSearch.selectField(MaxGuestLimitByHypervisorSearch.entity().getMaxGuestsLimit());
|
HypervisorCapabilitiesVO result = findByHypervisorTypeAndVersion(hypervisorType, hypervisorVersion);
|
||||||
MaxGuestLimitByHypervisorSearch.and("hypervisorType", MaxGuestLimitByHypervisorSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ);
|
if (result == null) { // if data is not available for a specific version then use 'default' as version
|
||||||
MaxGuestLimitByHypervisorSearch.and("hypervisorVersion", MaxGuestLimitByHypervisorSearch.entity().getHypervisorVersion(), SearchCriteria.Op.EQ);
|
result = findByHypervisorTypeAndVersion(hypervisorType, DEFAULT_VERSION);
|
||||||
MaxGuestLimitByHypervisorSearch.done();
|
}
|
||||||
|
return result;
|
||||||
MaxDataVolumesLimitByHypervisorSearch = createSearchBuilder(Integer.class);
|
|
||||||
MaxDataVolumesLimitByHypervisorSearch.selectField(MaxDataVolumesLimitByHypervisorSearch.entity().getMaxDataVolumesLimit());
|
|
||||||
MaxDataVolumesLimitByHypervisorSearch.and("hypervisorType", MaxDataVolumesLimitByHypervisorSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ);
|
|
||||||
MaxDataVolumesLimitByHypervisorSearch.and("hypervisorVersion", MaxDataVolumesLimitByHypervisorSearch.entity().getHypervisorVersion(), SearchCriteria.Op.EQ);
|
|
||||||
MaxDataVolumesLimitByHypervisorSearch.done();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -84,63 +78,22 @@ public class HypervisorCapabilitiesDaoImpl extends GenericDaoBase<HypervisorCapa
|
|||||||
@Override
|
@Override
|
||||||
public Long getMaxGuestsLimit(HypervisorType hypervisorType, String hypervisorVersion){
|
public Long getMaxGuestsLimit(HypervisorType hypervisorType, String hypervisorVersion){
|
||||||
Long defaultLimit = new Long(50);
|
Long defaultLimit = new Long(50);
|
||||||
Long result = null;
|
HypervisorCapabilitiesVO result = getCapabilities(hypervisorType, hypervisorVersion);
|
||||||
boolean useDefault = false;
|
Long limit = result.getMaxGuestsLimit();
|
||||||
if(hypervisorVersion != null){
|
if (limit == null)
|
||||||
SearchCriteria<Long> sc = MaxGuestLimitByHypervisorSearch.create();
|
|
||||||
sc.setParameters("hypervisorType", hypervisorType);
|
|
||||||
sc.setParameters("hypervisorVersion", hypervisorVersion);
|
|
||||||
List<Long> limitList = customSearch(sc, null);
|
|
||||||
if(!limitList.isEmpty()){
|
|
||||||
result = limitList.get(0);
|
|
||||||
}else{
|
|
||||||
useDefault = true;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
useDefault = true;
|
|
||||||
}
|
|
||||||
if(useDefault){
|
|
||||||
SearchCriteria<Long> sc = MaxGuestLimitByHypervisorSearch.create();
|
|
||||||
sc.setParameters("hypervisorType", hypervisorType);
|
|
||||||
sc.setParameters("hypervisorVersion", DEFAULT_VERSION);
|
|
||||||
List<Long> limitList = customSearch(sc, null);
|
|
||||||
if(!limitList.isEmpty()){
|
|
||||||
result = limitList.get(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(result == null){
|
|
||||||
return defaultLimit;
|
return defaultLimit;
|
||||||
}
|
return limit;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getMaxDataVolumesLimit(HypervisorType hypervisorType, String hypervisorVersion) {
|
public Integer getMaxDataVolumesLimit(HypervisorType hypervisorType, String hypervisorVersion) {
|
||||||
Integer result = null;
|
HypervisorCapabilitiesVO result = getCapabilities(hypervisorType, hypervisorVersion);
|
||||||
boolean useDefault = false;
|
return result.getMaxDataVolumesLimit();
|
||||||
if (hypervisorVersion != null) {
|
}
|
||||||
SearchCriteria<Integer> sc = MaxDataVolumesLimitByHypervisorSearch.create();
|
|
||||||
sc.setParameters("hypervisorType", hypervisorType);
|
@Override
|
||||||
sc.setParameters("hypervisorVersion", hypervisorVersion);
|
public Integer getMaxHostsPerCluster(HypervisorType hypervisorType, String hypervisorVersion) {
|
||||||
List<Integer> limitList = customSearch(sc, null);
|
HypervisorCapabilitiesVO result = getCapabilities(hypervisorType, hypervisorVersion);
|
||||||
if (!limitList.isEmpty()) {
|
return result.getMaxHostsPerCluster();
|
||||||
result = limitList.get(0);
|
|
||||||
} else {
|
|
||||||
useDefault = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
useDefault = true;
|
|
||||||
}
|
|
||||||
// If data is not available for a specific hypervisor version then use 'default' as the version
|
|
||||||
if (useDefault) {
|
|
||||||
SearchCriteria<Integer> sc = MaxDataVolumesLimitByHypervisorSearch.create();
|
|
||||||
sc.setParameters("hypervisorType", hypervisorType);
|
|
||||||
sc.setParameters("hypervisorVersion", DEFAULT_VERSION);
|
|
||||||
List<Integer> limitList = customSearch(sc, null);
|
|
||||||
if (!limitList.isEmpty()) {
|
|
||||||
result = limitList.get(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1650,6 +1650,7 @@ CREATE TABLE `cloud`.`hypervisor_capabilities` (
|
|||||||
`max_guests_limit` bigint unsigned DEFAULT 50,
|
`max_guests_limit` bigint unsigned DEFAULT 50,
|
||||||
`security_group_enabled` int(1) unsigned DEFAULT 1 COMMENT 'Is security group supported',
|
`security_group_enabled` int(1) unsigned DEFAULT 1 COMMENT 'Is security group supported',
|
||||||
`max_data_volumes_limit` int unsigned DEFAULT 6 COMMENT 'Max. data volumes per VM supported by hypervisor',
|
`max_data_volumes_limit` int unsigned DEFAULT 6 COMMENT 'Max. data volumes per VM supported by hypervisor',
|
||||||
|
`max_hosts_per_cluster` int unsigned DEFAULT NULL COMMENT 'Max. hosts in cluster supported by hypervisor',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
CONSTRAINT `uc_hypervisor_capabilities__uuid` UNIQUE (`uuid`)
|
CONSTRAINT `uc_hypervisor_capabilities__uuid` UNIQUE (`uuid`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||||
@ -1661,10 +1662,11 @@ INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor
|
|||||||
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('XenServer', '5.6 SP2', 50, 1);
|
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('XenServer', '5.6 SP2', 50, 1);
|
||||||
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_data_volumes_limit) VALUES ('XenServer', '6.0', 50, 1, 13);
|
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_data_volumes_limit) VALUES ('XenServer', '6.0', 50, 1, 13);
|
||||||
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_data_volumes_limit) VALUES ('XenServer', '6.0.2', 50, 1, 13);
|
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_data_volumes_limit) VALUES ('XenServer', '6.0.2', 50, 1, 13);
|
||||||
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('VMware', 'default', 128, 0);
|
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_hosts_per_cluster) VALUES ('VMware', 'default', 128, 0, 32);
|
||||||
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('VMware', '4.0', 128, 0);
|
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_hosts_per_cluster) VALUES ('VMware', '4.0', 128, 0, 32);
|
||||||
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('VMware', '4.1', 128, 0);
|
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_hosts_per_cluster) VALUES ('VMware', '4.1', 128, 0, 32);
|
||||||
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('VMware', '5.0', 128, 0);
|
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_hosts_per_cluster) VALUES ('VMware', '5.0', 128, 0, 32);
|
||||||
|
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_hosts_per_cluster) VALUES ('VMware', '5.1', 128, 0, 32);
|
||||||
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('KVM', 'default', 50, 1);
|
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('KVM', 'default', 50, 1);
|
||||||
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('Ovm', 'default', 25, 1);
|
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('Ovm', 'default', 25, 1);
|
||||||
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('Ovm', '2.3', 25, 1);
|
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('Ovm', '2.3', 25, 1);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user