Remove deployasis parameter from register template API

This commit is contained in:
nvazquez 2020-09-30 23:34:41 -03:00 committed by Harikrishna Patnala
parent 46d412d998
commit 08c0b07b59
3 changed files with 3 additions and 21 deletions

View File

@ -162,13 +162,6 @@ public class RegisterTemplateCmd extends BaseCmd implements UserCmd {
description = "true if template should bypass Secondary Storage and be downloaded to Primary Storage on deployment")
private Boolean directDownload;
@Parameter(name= ApiConstants.DEPLOY_AS_IS,
type = CommandType.BOOLEAN,
description = "VMware only: true if template should not strip and define disks and networks but leave those to the template definition",
since = "4.15"
)
private Boolean deployAsIs;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -282,7 +275,7 @@ public class RegisterTemplateCmd extends BaseCmd implements UserCmd {
}
public Boolean isDeployAsIs() {
return deployAsIs == null ? false : deployAsIs;
return hypervisor != null && hypervisor.equalsIgnoreCase(Hypervisor.HypervisorType.VMware.toString());
}
/////////////////////////////////////////////////////
@ -347,9 +340,5 @@ public class RegisterTemplateCmd extends BaseCmd implements UserCmd {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR,
"Parameter directdownload is only allowed for KVM templates");
}
if (isDeployAsIs() && !getHypervisor().equalsIgnoreCase(Hypervisor.HypervisorType.VMware.toString())) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Parameter deployasis is only allowed for VMware templates");
}
}
}

View File

@ -253,7 +253,7 @@ public class TemplateJoinDaoImpl extends GenericDaoBaseWithTagInformation<Templa
}
templateResponse.setDirectDownload(template.isDirectDownload());
templateResponse.setDeployAsIs(template.isDeployAsIs());
templateResponse.setDeployAsIs(template.getHypervisorType() == HypervisorType.VMware);
templateResponse.setRequiresHvm(template.isRequiresHvm());
//set template children disks
@ -277,7 +277,7 @@ public class TemplateJoinDaoImpl extends GenericDaoBaseWithTagInformation<Templa
}
private void setDeployAsIsDetails(TemplateJoinVO template, TemplateResponse templateResponse) {
if (template.isDeployAsIs()) {
if (template.getHypervisorType() == HypervisorType.VMware) {
List<TemplateDeployAsIsDetailVO> deployAsIsDetails = templateDeployAsIsDetailsDao.listDetails(template.getId());
for (TemplateDeployAsIsDetailVO deployAsIsDetailVO : deployAsIsDetails) {
if (deployAsIsDetailVO.getName().startsWith(DeployAsIsConstants.HARDWARE_ITEM_PREFIX)) {

View File

@ -231,9 +231,6 @@ public class TemplateJoinVO extends BaseViewWithTagInformationVO implements Cont
@Column(name = "direct_download")
private boolean directDownload;
@Column(name = "deploy_as_is")
private boolean deployAsIs;
public TemplateJoinVO() {
}
@ -493,10 +490,6 @@ public class TemplateJoinVO extends BaseViewWithTagInformationVO implements Cont
return directDownload;
}
public boolean isDeployAsIs() {
return deployAsIs;
}
public Object getParentTemplateId() {
return parentTemplateId;
}