mirror of https://github.com/apache/cloudstack.git
CS-15631 : Support for up to 16 VDIs per VM on XS 6.0 and above
Support for up to 16 VDIs per VM on XS 6.0 and above (16 VDIs => root + cd + 14 data volumes). Currently in CS number of data disk that can be attached to VM is hard-coded to 6. Made this setting configurable by moving it to hypervisor capabilities. Although XS 6.0 and above supports upto 16 VDIs but while testing on XS 6.0.2 found that only 13 data volumes can be attached to a VM. So for XS 6.0 and 6.0.2 max_data_volumes_limit is set to 13 currently. Signed-off-by: Koushik Das <Koushik.Das@citrix.com>
This commit is contained in:
parent
3cbc0e324f
commit
3f571684aa
|
|
@ -43,5 +43,8 @@ public interface HypervisorCapabilities {
|
|||
*/
|
||||
Long getMaxGuestsLimit();
|
||||
|
||||
|
||||
/**
|
||||
* @return the max. data volumes per VM supported by hypervisor
|
||||
*/
|
||||
Integer getMaxDataVolumesLimit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@ public class HypervisorCapabilitiesVO implements HypervisorCapabilities, Identit
|
|||
@Column(name="uuid")
|
||||
private String uuid;
|
||||
|
||||
@Column(name="max_data_volumes_limit")
|
||||
private Integer maxDataVolumesLimit;
|
||||
|
||||
protected HypervisorCapabilitiesVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
|
@ -144,6 +147,15 @@ public class HypervisorCapabilitiesVO implements HypervisorCapabilities, Identit
|
|||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getMaxDataVolumesLimit() {
|
||||
return maxDataVolumesLimit;
|
||||
}
|
||||
|
||||
public void setMaxDataVolumesLimit(Integer maxDataVolumesLimit) {
|
||||
this.maxDataVolumesLimit = maxDataVolumesLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof HypervisorCapabilitiesVO) {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public interface HypervisorCapabilitiesDao extends GenericDao<HypervisorCapabili
|
|||
|
||||
HypervisorCapabilitiesVO findByHypervisorTypeAndVersion(HypervisorType hypervisorType, String hypervisorVersion);
|
||||
|
||||
Long getMaxGuestsLimit(HypervisorType hypervisorType, String hypervisorVersion);
|
||||
|
||||
Long getMaxGuestsLimit(HypervisorType hypervisorType, String hypervisorVersion);
|
||||
|
||||
Integer getMaxDataVolumesLimit(HypervisorType hypervisorType, String hypervisorVersion);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ public class HypervisorCapabilitiesDaoImpl extends GenericDaoBase<HypervisorCapa
|
|||
protected final SearchBuilder<HypervisorCapabilitiesVO> HypervisorTypeSearch;
|
||||
protected final SearchBuilder<HypervisorCapabilitiesVO> HypervisorTypeAndVersionSearch;
|
||||
protected final GenericSearchBuilder<HypervisorCapabilitiesVO, Long> MaxGuestLimitByHypervisorSearch;
|
||||
|
||||
protected final GenericSearchBuilder<HypervisorCapabilitiesVO, Integer> MaxDataVolumesLimitByHypervisorSearch;
|
||||
|
||||
private static final String DEFAULT_VERSION = "default";
|
||||
|
||||
protected HypervisorCapabilitiesDaoImpl() {
|
||||
|
|
@ -54,7 +55,13 @@ public class HypervisorCapabilitiesDaoImpl extends GenericDaoBase<HypervisorCapa
|
|||
MaxGuestLimitByHypervisorSearch.selectField(MaxGuestLimitByHypervisorSearch.entity().getMaxGuestsLimit());
|
||||
MaxGuestLimitByHypervisorSearch.and("hypervisorType", MaxGuestLimitByHypervisorSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ);
|
||||
MaxGuestLimitByHypervisorSearch.and("hypervisorVersion", MaxGuestLimitByHypervisorSearch.entity().getHypervisorVersion(), SearchCriteria.Op.EQ);
|
||||
MaxGuestLimitByHypervisorSearch.done();
|
||||
MaxGuestLimitByHypervisorSearch.done();
|
||||
|
||||
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
|
||||
|
|
@ -104,4 +111,34 @@ public class HypervisorCapabilitiesDaoImpl extends GenericDaoBase<HypervisorCapa
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getMaxDataVolumesLimit(HypervisorType hypervisorType, String hypervisorVersion) {
|
||||
Integer result = null;
|
||||
boolean useDefault = false;
|
||||
if (hypervisorVersion != null) {
|
||||
SearchCriteria<Integer> sc = MaxDataVolumesLimitByHypervisorSearch.create();
|
||||
sc.setParameters("hypervisorType", hypervisorType);
|
||||
sc.setParameters("hypervisorVersion", hypervisorVersion);
|
||||
List<Integer> limitList = customSearch(sc, null);
|
||||
if (!limitList.isEmpty()) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -505,6 +505,24 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
}
|
||||
}
|
||||
|
||||
private int getMaxDataVolumesSupported(UserVmVO vm) {
|
||||
Long hostId = vm.getHostId();
|
||||
if (hostId == null) {
|
||||
hostId = vm.getLastHostId();
|
||||
}
|
||||
HostVO host = _hostDao.findById(hostId);
|
||||
Integer maxDataVolumesSupported = null;
|
||||
if (host != null) {
|
||||
_hostDao.loadDetails(host);
|
||||
maxDataVolumesSupported = _hypervisorCapabilitiesDao.getMaxDataVolumesLimit(host.getHypervisorType(), host.getDetail("product_version"));
|
||||
}
|
||||
if (maxDataVolumesSupported == null) {
|
||||
maxDataVolumesSupported = 6; // 6 data disks by default if nothing is specified in 'hypervisor_capabilities' table
|
||||
}
|
||||
|
||||
return maxDataVolumesSupported.intValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_VOLUME_ATTACH, eventDescription = "attaching volume", async = true)
|
||||
public Volume attachVolumeToVM(AttachVolumeCmd command) {
|
||||
|
|
@ -548,10 +566,11 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
}
|
||||
}
|
||||
|
||||
// Check that the VM has less than 6 data volumes attached
|
||||
// Check that the number of data volumes attached to VM is less than that supported by hypervisor
|
||||
List<VolumeVO> existingDataVolumes = _volsDao.findByInstanceAndType(vmId, Volume.Type.DATADISK);
|
||||
if (existingDataVolumes.size() >= 6) {
|
||||
throw new InvalidParameterValueException("The specified VM already has the maximum number of data disks (6). Please specify another VM.");
|
||||
int maxDataVolumesSupported = getMaxDataVolumesSupported(vm);
|
||||
if (existingDataVolumes.size() >= maxDataVolumesSupported) {
|
||||
throw new InvalidParameterValueException("The specified VM already has the maximum number of data disks (" + maxDataVolumesSupported + "). Please specify another VM.");
|
||||
}
|
||||
|
||||
// Check that the VM and the volume are in the same zone
|
||||
|
|
|
|||
|
|
@ -1565,6 +1565,7 @@ CREATE TABLE `cloud`.`hypervisor_capabilities` (
|
|||
`hypervisor_version` varchar(32),
|
||||
`max_guests_limit` bigint unsigned DEFAULT 50,
|
||||
`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',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `uc_hypervisor_capabilities__uuid` UNIQUE (`uuid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||
|
|
@ -1574,8 +1575,8 @@ 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', 50, 1);
|
||||
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('XenServer', '5.6 FP1', 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) VALUES ('XenServer', '6.0', 50, 1);
|
||||
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('XenServer', '6.0.2', 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.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) VALUES ('VMware', '4.0', 128, 0);
|
||||
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('VMware', '4.1', 128, 0);
|
||||
|
|
|
|||
|
|
@ -80,5 +80,10 @@ DEALLOCATE PREPARE stmt1;
|
|||
AlTER TABLE physical_network_service_providers ADD CONSTRAINT `fk_pnetwork_service_providers__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE;
|
||||
UPDATE `cloud`.`configuration` SET description='In second, timeout for creating volume from snapshot' WHERE name='create.volume.from.snapshot.wait';
|
||||
|
||||
ALTER TABLE `cloud`.`hypervisor_capabilities` ADD COLUMN `max_data_volumes_limit` int unsigned DEFAULT 6 COMMENT 'Max. data volumes per VM supported by hypervisor';
|
||||
SET SQL_SAFE_UPDATES=0;
|
||||
UPDATE `cloud`.`hypervisor_capabilities` SET `max_data_volumes_limit`=13 WHERE `hypervisor_type`='XenServer' AND (`hypervisor_version`='6.0' OR `hypervisor_version`='6.0.2');
|
||||
SET SQL_SAFE_UPDATES=1;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue