mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Set deploy-as-is to default on VMware
This commit is contained in:
parent
2f03877723
commit
9b51a706db
@ -138,6 +138,4 @@ public interface VirtualMachineTemplate extends ControlledEntity, Identity, Inte
|
||||
void incrUpdatedCount();
|
||||
|
||||
Date getUpdated();
|
||||
|
||||
boolean isDeployAsIs();
|
||||
}
|
||||
|
||||
@ -597,12 +597,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
||||
//remove the overcommit details from the uservm details
|
||||
userVmDetailsDao.removeDetails(vm.getId());
|
||||
|
||||
// Remove details if VM deploy as-is
|
||||
long templateId = vm.getTemplateId();
|
||||
VMTemplateVO template = _templateDao.findById(templateId);
|
||||
if (template != null && template.isDeployAsIs()) {
|
||||
userVmDeployAsIsDetailsDao.removeDetails(vm.getId());
|
||||
}
|
||||
// Remove deploy as-is (if any)
|
||||
userVmDeployAsIsDetailsDao.removeDetails(vm.getId());
|
||||
|
||||
// send hypervisor-dependent commands before removing
|
||||
final List<Command> finalizeExpungeCommands = hvGuru.finalizeExpunge(vm);
|
||||
@ -1116,7 +1112,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
||||
|
||||
if (dest != null) {
|
||||
avoids.addHost(dest.getHost().getId());
|
||||
if (!template.isDeployAsIs()) {
|
||||
if (template.getHypervisorType() == HypervisorType.VMware && vm.getType() == VirtualMachine.Type.User) {
|
||||
journal.record("Deployment found ", vmProfile, dest);
|
||||
}
|
||||
}
|
||||
|
||||
@ -759,7 +759,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
|
||||
|
||||
Long size = _tmpltMgr.getTemplateSize(template.getId(), vm.getDataCenterId());
|
||||
if (rootDisksize != null) {
|
||||
if (template.isDeployAsIs()) {
|
||||
if (vm.getHypervisorType() == HypervisorType.VMware && vm.getType() == VirtualMachine.Type.User) {
|
||||
// Volume size specified from template deploy-as-is
|
||||
size = rootDisksize;
|
||||
} else {
|
||||
@ -824,7 +824,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
|
||||
int volumesNumber = 1;
|
||||
List<DatadiskTO> templateAsIsDisks = null;
|
||||
String configurationId = null;
|
||||
if (template.isDeployAsIs()) {
|
||||
if (vm.getHypervisorType() == HypervisorType.VMware && vm.getType() == VirtualMachine.Type.User) {
|
||||
UserVmDetailVO configurationDetail = userVmDetailsDao.findDetail(vm.getId(), VmDetailConstants.DEPLOY_AS_IS_CONFIGURATION);
|
||||
if (configurationDetail != null) {
|
||||
configurationId = configurationDetail.getValue();
|
||||
@ -849,7 +849,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
|
||||
String volumeName = name;
|
||||
Long volumeSize = rootDisksize;
|
||||
long deviceId = type.equals(Type.ROOT) ? 0L : 1L;
|
||||
if (template.isDeployAsIs()) {
|
||||
if (vm.getHypervisorType() == HypervisorType.VMware && vm.getType() == VirtualMachine.Type.User) {
|
||||
int volumeNameSuffix = templateAsIsDisks.get(number).getDiskNumber();
|
||||
volumeName = String.format("%s-%d", volumeName, volumeNameSuffix);
|
||||
volumeSize = templateAsIsDisks.get(number).getVirtualSize();
|
||||
|
||||
@ -152,9 +152,6 @@ public class VMTemplateVO implements VirtualMachineTemplate {
|
||||
@Column(name = "parent_template_id")
|
||||
private Long parentTemplateId;
|
||||
|
||||
@Column(name = "deploy_as_is")
|
||||
private boolean deployAsIs;
|
||||
|
||||
@Override
|
||||
public String getUniqueName() {
|
||||
return uniqueName;
|
||||
@ -196,8 +193,7 @@ public class VMTemplateVO implements VirtualMachineTemplate {
|
||||
}
|
||||
|
||||
public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable,
|
||||
HypervisorType hyperType, String templateTag, Map<String, String> details, boolean sshKeyEnabled, boolean isDynamicallyScalable, boolean directDownload,
|
||||
boolean deployAsIs) {
|
||||
HypervisorType hyperType, String templateTag, Map<String, String> details, boolean sshKeyEnabled, boolean isDynamicallyScalable, boolean directDownload) {
|
||||
this(id,
|
||||
name,
|
||||
format,
|
||||
@ -222,7 +218,6 @@ public class VMTemplateVO implements VirtualMachineTemplate {
|
||||
dynamicallyScalable = isDynamicallyScalable;
|
||||
state = State.Active;
|
||||
this.directDownload = directDownload;
|
||||
this.deployAsIs = deployAsIs;
|
||||
}
|
||||
|
||||
public static VMTemplateVO createPreHostIso(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, TemplateType type,
|
||||
@ -640,12 +635,4 @@ public class VMTemplateVO implements VirtualMachineTemplate {
|
||||
public void setParentTemplateId(Long parentTemplateId) {
|
||||
this.parentTemplateId = parentTemplateId;
|
||||
}
|
||||
|
||||
@Override public boolean isDeployAsIs() {
|
||||
return deployAsIs;
|
||||
}
|
||||
|
||||
public void setDeployAsIs(boolean deployAsIs) {
|
||||
this.deployAsIs = deployAsIs;
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,118 +260,6 @@ CREATE VIEW `cloud`.`storage_pool_view` AS
|
||||
LEFT JOIN `async_job` ON (((`async_job`.`instance_id` = `storage_pool`.`id`)
|
||||
AND (`async_job`.`instance_type` = 'StoragePool')
|
||||
AND (`async_job`.`job_status` = 0))));
|
||||
-- Add passthrough instruction for appliance deployments
|
||||
ALTER TABLE `cloud`.`vm_template` ADD COLUMN `deploy_as_is` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the template should be deployed with disks and networks as defined by OVF';
|
||||
|
||||
-- Extend the template details value field
|
||||
ALTER TABLE `cloud`.`vm_template_details` MODIFY COLUMN `value` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
|
||||
|
||||
-- Changes to template_view for both deploying multidisk OVA/vApp as is
|
||||
DROP VIEW IF EXISTS `cloud`.`template_view`;
|
||||
CREATE VIEW `cloud`.`template_view` AS
|
||||
SELECT
|
||||
`vm_template`.`id` AS `id`,
|
||||
`vm_template`.`uuid` AS `uuid`,
|
||||
`vm_template`.`unique_name` AS `unique_name`,
|
||||
`vm_template`.`name` AS `name`,
|
||||
`vm_template`.`public` AS `public`,
|
||||
`vm_template`.`featured` AS `featured`,
|
||||
`vm_template`.`type` AS `type`,
|
||||
`vm_template`.`hvm` AS `hvm`,
|
||||
`vm_template`.`bits` AS `bits`,
|
||||
`vm_template`.`url` AS `url`,
|
||||
`vm_template`.`format` AS `format`,
|
||||
`vm_template`.`created` AS `created`,
|
||||
`vm_template`.`checksum` AS `checksum`,
|
||||
`vm_template`.`display_text` AS `display_text`,
|
||||
`vm_template`.`enable_password` AS `enable_password`,
|
||||
`vm_template`.`dynamically_scalable` AS `dynamically_scalable`,
|
||||
`vm_template`.`state` AS `template_state`,
|
||||
`vm_template`.`guest_os_id` AS `guest_os_id`,
|
||||
`guest_os`.`uuid` AS `guest_os_uuid`,
|
||||
`guest_os`.`display_name` AS `guest_os_name`,
|
||||
`vm_template`.`bootable` AS `bootable`,
|
||||
`vm_template`.`prepopulate` AS `prepopulate`,
|
||||
`vm_template`.`cross_zones` AS `cross_zones`,
|
||||
`vm_template`.`hypervisor_type` AS `hypervisor_type`,
|
||||
`vm_template`.`extractable` AS `extractable`,
|
||||
`vm_template`.`template_tag` AS `template_tag`,
|
||||
`vm_template`.`sort_key` AS `sort_key`,
|
||||
`vm_template`.`removed` AS `removed`,
|
||||
`vm_template`.`enable_sshkey` AS `enable_sshkey`,
|
||||
`parent_template`.`id` AS `parent_template_id`,
|
||||
`parent_template`.`uuid` AS `parent_template_uuid`,
|
||||
`source_template`.`id` AS `source_template_id`,
|
||||
`source_template`.`uuid` AS `source_template_uuid`,
|
||||
`account`.`id` AS `account_id`,
|
||||
`account`.`uuid` AS `account_uuid`,
|
||||
`account`.`account_name` AS `account_name`,
|
||||
`account`.`type` AS `account_type`,
|
||||
`domain`.`id` AS `domain_id`,
|
||||
`domain`.`uuid` AS `domain_uuid`,
|
||||
`domain`.`name` AS `domain_name`,
|
||||
`domain`.`path` AS `domain_path`,
|
||||
`projects`.`id` AS `project_id`,
|
||||
`projects`.`uuid` AS `project_uuid`,
|
||||
`projects`.`name` AS `project_name`,
|
||||
`data_center`.`id` AS `data_center_id`,
|
||||
`data_center`.`uuid` AS `data_center_uuid`,
|
||||
`data_center`.`name` AS `data_center_name`,
|
||||
`launch_permission`.`account_id` AS `lp_account_id`,
|
||||
`template_store_ref`.`store_id` AS `store_id`,
|
||||
`image_store`.`scope` AS `store_scope`,
|
||||
`template_store_ref`.`state` AS `state`,
|
||||
`template_store_ref`.`download_state` AS `download_state`,
|
||||
`template_store_ref`.`download_pct` AS `download_pct`,
|
||||
`template_store_ref`.`error_str` AS `error_str`,
|
||||
`template_store_ref`.`size` AS `size`,
|
||||
`template_store_ref`.physical_size AS `physical_size`,
|
||||
`template_store_ref`.`destroyed` AS `destroyed`,
|
||||
`template_store_ref`.`created` AS `created_on_store`,
|
||||
`vm_template_details`.`name` AS `detail_name`,
|
||||
`vm_template_details`.`value` AS `detail_value`,
|
||||
`resource_tags`.`id` AS `tag_id`,
|
||||
`resource_tags`.`uuid` AS `tag_uuid`,
|
||||
`resource_tags`.`key` AS `tag_key`,
|
||||
`resource_tags`.`value` AS `tag_value`,
|
||||
`resource_tags`.`domain_id` AS `tag_domain_id`,
|
||||
`domain`.`uuid` AS `tag_domain_uuid`,
|
||||
`domain`.`name` AS `tag_domain_name`,
|
||||
`resource_tags`.`account_id` AS `tag_account_id`,
|
||||
`account`.`account_name` AS `tag_account_name`,
|
||||
`resource_tags`.`resource_id` AS `tag_resource_id`,
|
||||
`resource_tags`.`resource_uuid` AS `tag_resource_uuid`,
|
||||
`resource_tags`.`resource_type` AS `tag_resource_type`,
|
||||
`resource_tags`.`customer` AS `tag_customer`,
|
||||
CONCAT(`vm_template`.`id`,
|
||||
'_',
|
||||
IFNULL(`data_center`.`id`, 0)) AS `temp_zone_pair`,
|
||||
`vm_template`.`direct_download` AS `direct_download`,
|
||||
`vm_template`.`deploy_as_is` AS `deploy_as_is`
|
||||
FROM
|
||||
(((((((((((((`vm_template`
|
||||
JOIN `guest_os` ON ((`guest_os`.`id` = `vm_template`.`guest_os_id`)))
|
||||
JOIN `account` ON ((`account`.`id` = `vm_template`.`account_id`)))
|
||||
JOIN `domain` ON ((`domain`.`id` = `account`.`domain_id`)))
|
||||
LEFT JOIN `projects` ON ((`projects`.`project_account_id` = `account`.`id`)))
|
||||
LEFT JOIN `vm_template_details` ON ((`vm_template_details`.`template_id` = `vm_template`.`id`)))
|
||||
LEFT JOIN `vm_template` `source_template` ON ((`source_template`.`id` = `vm_template`.`source_template_id`)))
|
||||
LEFT JOIN `template_store_ref` ON (((`template_store_ref`.`template_id` = `vm_template`.`id`)
|
||||
AND (`template_store_ref`.`store_role` = 'Image')
|
||||
AND (`template_store_ref`.`destroyed` = 0))))
|
||||
LEFT JOIN `vm_template` `parent_template` ON ((`parent_template`.`id` = `vm_template`.`parent_template_id`)))
|
||||
LEFT JOIN `image_store` ON ((ISNULL(`image_store`.`removed`)
|
||||
AND (`template_store_ref`.`store_id` IS NOT NULL)
|
||||
AND (`image_store`.`id` = `template_store_ref`.`store_id`))))
|
||||
LEFT JOIN `template_zone_ref` ON (((`template_zone_ref`.`template_id` = `vm_template`.`id`)
|
||||
AND ISNULL(`template_store_ref`.`store_id`)
|
||||
AND ISNULL(`template_zone_ref`.`removed`))))
|
||||
LEFT JOIN `data_center` ON (((`image_store`.`data_center_id` = `data_center`.`id`)
|
||||
OR (`template_zone_ref`.`zone_id` = `data_center`.`id`))))
|
||||
LEFT JOIN `launch_permission` ON ((`launch_permission`.`template_id` = `vm_template`.`id`)))
|
||||
LEFT JOIN `resource_tags` ON (((`resource_tags`.`resource_id` = `vm_template`.`id`)
|
||||
AND ((`resource_tags`.`resource_type` = 'Template')
|
||||
OR (`resource_tags`.`resource_type` = 'ISO')))));
|
||||
|
||||
-- Add mincpu, maxcpu, minmemory and maxmemory to the view supporting constrained offerings
|
||||
DROP VIEW IF EXISTS `cloud`.`service_offering_view`;
|
||||
|
||||
@ -412,7 +412,7 @@ public class TemplateServiceImpl implements TemplateService {
|
||||
VirtualMachineTemplate.Event event = VirtualMachineTemplate.Event.OperationSucceeded;
|
||||
// For multi-disk OVA, check and create data disk templates
|
||||
if (tmplt.getFormat().equals(ImageFormat.OVA)) {
|
||||
if (!createOvaDataDiskTemplates(_templateFactory.getTemplate(tmlpt.getId(), store), tmplt.isDeployAsIs())) {
|
||||
if (!createOvaDataDiskTemplates(_templateFactory.getTemplate(tmlpt.getId(), store), true)) {
|
||||
event = VirtualMachineTemplate.Event.OperationFailed;
|
||||
}
|
||||
}
|
||||
@ -710,7 +710,7 @@ public class TemplateServiceImpl implements TemplateService {
|
||||
|
||||
// For multi-disk OVA, check and create data disk templates
|
||||
if (template.getFormat().equals(ImageFormat.OVA)) {
|
||||
if (!createOvaDataDiskTemplates(template, template.isDeployAsIs())) {
|
||||
if (!createOvaDataDiskTemplates(template, true)) {
|
||||
template.processEvent(ObjectInDataStoreStateMachine.Event.OperationFailed);
|
||||
result.setResult(callbackResult.getResult());
|
||||
if (parentCallback != null) {
|
||||
@ -799,7 +799,7 @@ public class TemplateServiceImpl implements TemplateService {
|
||||
String templateName = dataDiskTemplate.isIso() ? dataDiskTemplate.getPath().substring(dataDiskTemplate.getPath().lastIndexOf(File.separator) + 1) : template.getName() + suffix + diskCount;
|
||||
VMTemplateVO templateVO = new VMTemplateVO(templateId, templateName, format, false, false, false, ttype, template.getUrl(),
|
||||
template.requiresHvm(), template.getBits(), template.getAccountId(), null, templateName, false, guestOsId, false, template.getHypervisorType(), null,
|
||||
null, false, false, false, false);
|
||||
null, false, false, false);
|
||||
if (dataDiskTemplate.isIso()){
|
||||
templateVO.setUniqueName(templateName);
|
||||
}
|
||||
|
||||
@ -376,10 +376,10 @@ public class TemplateObject implements TemplateInfo {
|
||||
|
||||
@Override
|
||||
public boolean isDeployAsIs() {
|
||||
if (this.imageVO == null) {
|
||||
return false;
|
||||
if (getHypervisorType() == HypervisorType.VMware) {
|
||||
return true;
|
||||
}
|
||||
return this.imageVO.isDeployAsIs();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setInstallPath(String installPath) {
|
||||
|
||||
@ -32,6 +32,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import com.cloud.storage.Upload;
|
||||
import org.apache.cloudstack.storage.image.deployasis.DeployAsIsHelper;
|
||||
import org.apache.log4j.Logger;
|
||||
@ -203,7 +204,7 @@ public abstract class BaseImageStoreDriverImpl implements ImageStoreDriver {
|
||||
TemplateDataStoreVO tmpltStoreVO = _templateStoreDao.findByStoreTemplate(store.getId(), obj.getId());
|
||||
if (tmpltStoreVO != null) {
|
||||
if (tmpltStoreVO.getDownloadState() == VMTemplateStorageResourceAssoc.Status.DOWNLOADED) {
|
||||
if (template.isDeployAsIs()) {
|
||||
if (template.getHypervisorType() == Hypervisor.HypervisorType.VMware) {
|
||||
boolean persistDeployAsIs = deployAsIsHelper.persistTemplateDeployAsIsDetails(template.getId(), answer, tmpltStoreVO);
|
||||
if (!persistDeployAsIs) {
|
||||
LOGGER.info("Failed persisting deploy-as-is template details for template " + template.getName());
|
||||
|
||||
@ -21,7 +21,6 @@ import java.util.Date;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.storage.MigrationOptions;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.VolumeDetailVO;
|
||||
import com.cloud.storage.dao.VMTemplateDao;
|
||||
import com.cloud.storage.dao.VolumeDetailsDao;
|
||||
@ -446,8 +445,7 @@ public class VolumeObject implements VolumeInfo {
|
||||
|
||||
@Override
|
||||
public boolean isDeployAsIs() {
|
||||
VMTemplateVO template = templateDao.findById(getTemplateId());
|
||||
return template != null && template.isDeployAsIs();
|
||||
return getHypervisorType() == HypervisorType.VMware;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -575,7 +575,7 @@ public class VolumeServiceImpl implements VolumeService {
|
||||
s_logger.info("Unable to acquire lock on VMTemplateStoragePool " + templatePoolRefId);
|
||||
}
|
||||
templatePoolRef = _tmpltPoolDao.findByPoolTemplate(dataStore.getId(), template.getId(), deployAsIsConfiguration);
|
||||
if (templatePoolRef != null && templatePoolRef.getState() == ObjectInDataStoreStateMachine.State.Ready && !template.isDeployAsIs()) {
|
||||
if (templatePoolRef != null && templatePoolRef.getState() == ObjectInDataStoreStateMachine.State.Ready) {
|
||||
s_logger.info(
|
||||
"Unable to acquire lock on VMTemplateStoragePool " + templatePoolRefId + ", But Template " + template.getUniqueName() + " is already copied to primary storage, skip copying");
|
||||
createVolumeFromBaseImageAsync(volume, templateOnPrimaryStoreObj, dataStore, future);
|
||||
@ -588,7 +588,7 @@ public class VolumeServiceImpl implements VolumeService {
|
||||
s_logger.info("lock is acquired for VMTemplateStoragePool " + templatePoolRefId);
|
||||
}
|
||||
try {
|
||||
if (templatePoolRef.getState() == ObjectInDataStoreStateMachine.State.Ready && !template.isDeployAsIs()) {
|
||||
if (templatePoolRef.getState() == ObjectInDataStoreStateMachine.State.Ready) {
|
||||
s_logger.info("Template " + template.getUniqueName() + " is already copied to primary storage, skip copying");
|
||||
createVolumeFromBaseImageAsync(volume, templateOnPrimaryStoreObj, dataStore, future);
|
||||
return;
|
||||
|
||||
@ -598,7 +598,7 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru, Co
|
||||
private VMTemplateVO createVMTemplateRecord(String vmInternalName, long guestOsId, long accountId) {
|
||||
Long nextTemplateId = vmTemplateDao.getNextInSequence(Long.class, "id");
|
||||
VMTemplateVO templateVO = new VMTemplateVO(nextTemplateId, "Imported-from-" + vmInternalName, Storage.ImageFormat.OVA, false, false, false, Storage.TemplateType.USER, null,
|
||||
false, 64, accountId, null, "Template imported from VM " + vmInternalName, false, guestOsId, false, HypervisorType.VMware, null, null, false, false, false, false);
|
||||
false, 64, accountId, null, "Template imported from VM " + vmInternalName, false, guestOsId, false, HypervisorType.VMware, null, null, false, false, false);
|
||||
return vmTemplateDao.persist(templateVO);
|
||||
}
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ class VmwareVmImplementer {
|
||||
|
||||
VirtualMachineTO implement(VirtualMachineProfile vm, VirtualMachineTO to, long clusterId) {
|
||||
to.setBootloader(VirtualMachineTemplate.BootloaderType.HVM);
|
||||
boolean deployAsIs = vm.getTemplate().isDeployAsIs();
|
||||
boolean deployAsIs = vm.getType() == VirtualMachine.Type.User;
|
||||
HostVO host = hostDao.findById(vm.getVirtualMachine().getHostId());
|
||||
Map<String, String> details = to.getDetails();
|
||||
if (details == null)
|
||||
|
||||
@ -561,7 +561,7 @@ StateListener<State, VirtualMachine.Event, VirtualMachine> {
|
||||
* Display storage in the logs by default if the template is not deploy-as-is.
|
||||
*/
|
||||
private boolean getDisplayStorageFromVmProfile(VirtualMachineProfile vmProfile) {
|
||||
return vmProfile == null || vmProfile.getTemplate() == null || !vmProfile.getTemplate().isDeployAsIs();
|
||||
return vmProfile.getHypervisorType() != HypervisorType.VMware || vmProfile.getType() != VirtualMachine.Type.User;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -412,7 +412,7 @@ public class ImageStoreUploadMonitorImpl extends ManagerBase implements ImageSto
|
||||
if (tmpTemplate.getFormat().equals(Storage.ImageFormat.OVA)) {
|
||||
final DataStore store = dataStoreManager.getDataStore(templateDataStore.getDataStoreId(), templateDataStore.getDataStoreRole());
|
||||
final TemplateInfo templateInfo = templateFactory.getTemplate(tmpTemplate.getId(), store);
|
||||
if (!templateService.createOvaDataDiskTemplates(templateInfo, template.isDeployAsIs())) {
|
||||
if (!templateService.createOvaDataDiskTemplates(templateInfo, true)) {
|
||||
tmpTemplateDataStore.setDownloadState(VMTemplateStorageResourceAssoc.Status.ABANDONED);
|
||||
tmpTemplateDataStore.setState(State.Failed);
|
||||
stateMachine.transitTo(tmpTemplate, VirtualMachineTemplate.Event.OperationFailed, null, _templateDao);
|
||||
|
||||
@ -52,7 +52,6 @@ public class TemplateProfile {
|
||||
Boolean isDynamicallyScalable;
|
||||
TemplateType templateType;
|
||||
Boolean directDownload;
|
||||
Boolean deployAsIs;
|
||||
Long size;
|
||||
|
||||
public TemplateProfile(Long templateId, Long userId, String name, String displayText, Integer bits, Boolean passwordEnabled, Boolean requiresHvm, String url,
|
||||
@ -96,7 +95,7 @@ public class TemplateProfile {
|
||||
Boolean isPublic, Boolean featured, Boolean isExtractable, ImageFormat format, Long guestOsId, List<Long> zoneId,
|
||||
|
||||
HypervisorType hypervisorType, String accountName, Long domainId, Long accountId, String chksum, Boolean bootable, String templateTag, Map details,
|
||||
Boolean sshKeyEnabled, Long imageStoreId, Boolean isDynamicallyScalable, TemplateType templateType, Boolean directDownload, Boolean deployAsIs) {
|
||||
Boolean sshKeyEnabled, Long imageStoreId, Boolean isDynamicallyScalable, TemplateType templateType, Boolean directDownload) {
|
||||
this(templateId,
|
||||
userId,
|
||||
name,
|
||||
@ -123,7 +122,6 @@ public class TemplateProfile {
|
||||
this.isDynamicallyScalable = isDynamicallyScalable;
|
||||
this.templateType = templateType;
|
||||
this.directDownload = directDownload;
|
||||
this.deployAsIs = deployAsIs;
|
||||
}
|
||||
|
||||
public Long getTemplateId() {
|
||||
@ -333,8 +331,4 @@ public class TemplateProfile {
|
||||
public void setSize(Long size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public boolean isDeployAsIs() {
|
||||
return this.deployAsIs;
|
||||
}
|
||||
}
|
||||
|
||||
@ -601,10 +601,8 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase {
|
||||
// Remove template details
|
||||
templateDetailsDao.removeDetails(template.getId());
|
||||
|
||||
// Remove deploy-as-is details
|
||||
if (template.isDeployAsIs()) {
|
||||
templateDeployAsIsDetailsDao.removeDetails(template.getId());
|
||||
}
|
||||
// Remove deploy-as-is details (if any)
|
||||
templateDeployAsIsDetailsDao.removeDetails(template.getId());
|
||||
|
||||
}
|
||||
return success;
|
||||
|
||||
@ -265,7 +265,7 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat
|
||||
CallContext.current().setEventDetails("Id: " + id + " name: " + name);
|
||||
return new TemplateProfile(id, userId, name, displayText, bits, passwordEnabled, requiresHVM, url, isPublic, featured, isExtractable, imgfmt, guestOSId, zoneIdList,
|
||||
hypervisorType, templateOwner.getAccountName(), templateOwner.getDomainId(), templateOwner.getAccountId(), chksum, bootable, templateTag, details,
|
||||
sshkeyEnabled, null, isDynamicallyScalable, templateType, directDownload, deployAsIs);
|
||||
sshkeyEnabled, null, isDynamicallyScalable, templateType, directDownload);
|
||||
|
||||
}
|
||||
|
||||
@ -376,7 +376,7 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat
|
||||
new VMTemplateVO(profile.getTemplateId(), profile.getName(), profile.getFormat(), profile.isPublic(), profile.isFeatured(), profile.isExtractable(),
|
||||
profile.getTemplateType(), profile.getUrl(), profile.isRequiresHVM(), profile.getBits(), profile.getAccountId(), profile.getCheckSum(),
|
||||
profile.getDisplayText(), profile.isPasswordEnabled(), profile.getGuestOsId(), profile.isBootable(), profile.getHypervisorType(),
|
||||
profile.getTemplateTag(), profile.getDetails(), profile.isSshKeyEnabled(), profile.IsDynamicallyScalable(), profile.isDirectDownload(), profile.isDeployAsIs());
|
||||
profile.getTemplateTag(), profile.getDetails(), profile.isSshKeyEnabled(), profile.IsDynamicallyScalable(), profile.isDirectDownload());
|
||||
template.setState(initialState);
|
||||
|
||||
if (profile.isDirectDownload()) {
|
||||
|
||||
@ -1898,7 +1898,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
||||
}
|
||||
privateTemplate = new VMTemplateVO(nextTemplateId, name, ImageFormat.RAW, isPublic, featured, isExtractable,
|
||||
TemplateType.USER, null, requiresHvmValue, bitsValue, templateOwner.getId(), null, description,
|
||||
passwordEnabledValue, guestOS.getId(), true, hyperType, templateTag, cmd.getDetails(), sshKeyEnabledValue, isDynamicScalingEnabled, false, false);
|
||||
passwordEnabledValue, guestOS.getId(), true, hyperType, templateTag, cmd.getDetails(), sshKeyEnabledValue, isDynamicScalingEnabled, false);
|
||||
|
||||
if (sourceTemplateId != null) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
|
||||
@ -29,7 +29,6 @@ import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.dao.VMTemplateDao;
|
||||
import org.apache.cloudstack.affinity.dao.AffinityGroupDomainMapDao;
|
||||
import org.junit.Before;
|
||||
@ -167,10 +166,6 @@ public class DeploymentPlanningManagerImplTest {
|
||||
Mockito.when(_plannerHostReserveDao.findById(Matchers.anyLong())).thenReturn(reservationVO);
|
||||
Mockito.when(_affinityGroupVMMapDao.countAffinityGroupsForVm(Matchers.anyLong())).thenReturn(0L);
|
||||
|
||||
VMTemplateVO template = Mockito.mock(VMTemplateVO.class);
|
||||
Mockito.when(template.isDeployAsIs()).thenReturn(false);
|
||||
Mockito.when(templateDao.findById(Mockito.anyLong())).thenReturn(template);
|
||||
|
||||
VMInstanceVO vm = new VMInstanceVO();
|
||||
Mockito.when(vmProfile.getVirtualMachine()).thenReturn(vm);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user