fix issues

This commit is contained in:
Pearl Dsilva 2024-02-08 06:42:08 -05:00
parent 66e874b4c7
commit 8ac71ba183
6 changed files with 28 additions and 12 deletions

View File

@ -95,6 +95,11 @@ public class GetUploadParamsForTemplateCmd extends AbstractGetUploadParamsCmd {
description = "(VMware only) true if VM deployments should preserve all the configurations defined for this template", since = "4.15.1")
private Boolean deployAsIs;
@Parameter(name=ApiConstants.FOR_CKS,
type = CommandType.BOOLEAN,
description = "if true, the templates would be available for deploying CKS clusters", since = "4.20.0")
protected Boolean forCks;
public String getDisplayText() {
return StringUtils.isBlank(displayText) ? getName() : displayText;
}
@ -164,6 +169,10 @@ public class GetUploadParamsForTemplateCmd extends AbstractGetUploadParamsCmd {
Boolean.TRUE.equals(deployAsIs);
}
public boolean isForCks() {
return Boolean.TRUE.equals(forCks);
}
@Override
public void execute() throws ServerApiException {
validateRequest();

View File

@ -29,10 +29,10 @@ public class TemplateUploadParams extends UploadParamsBase {
Long zoneId, Hypervisor.HypervisorType hypervisorType, String chksum,
String templateTag, long templateOwnerId,
Map details, Boolean sshkeyEnabled,
Boolean isDynamicallyScalable, Boolean isRoutingType, boolean deployAsIs) {
Boolean isDynamicallyScalable, Boolean isRoutingType, boolean deployAsIs, boolean forCks) {
super(userId, name, displayText, bits, passwordEnabled, requiresHVM, isPublic, featured, isExtractable,
format, guestOSId, zoneId, hypervisorType, chksum, templateTag, templateOwnerId, details,
sshkeyEnabled, isDynamicallyScalable, isRoutingType, deployAsIs);
sshkeyEnabled, isDynamicallyScalable, isRoutingType, deployAsIs, forCks);
setBootable(true);
}
}

View File

@ -45,6 +45,7 @@ public abstract class UploadParamsBase implements UploadParams {
private boolean isDynamicallyScalable;
private boolean isRoutingType;
private boolean deployAsIs;
private boolean forCks;
UploadParamsBase(long userId, String name, String displayText,
Integer bits, boolean passwordEnabled, boolean requiresHVM,
@ -53,7 +54,7 @@ public abstract class UploadParamsBase implements UploadParams {
Long zoneId, Hypervisor.HypervisorType hypervisorType, String checksum,
String templateTag, long templateOwnerId,
Map details, boolean sshkeyEnabled,
boolean isDynamicallyScalable, boolean isRoutingType, boolean deployAsIs) {
boolean isDynamicallyScalable, boolean isRoutingType, boolean deployAsIs, boolean forCks) {
this.userId = userId;
this.name = name;
this.displayText = displayText;
@ -229,6 +230,10 @@ public abstract class UploadParamsBase implements UploadParams {
this.bootable = bootable;
}
void setForCks(boolean forCks) {
this.forCks = forCks;
}
void setBits(Integer bits) {
this.bits = bits;
}

View File

@ -78,6 +78,6 @@ public interface TemplateAdapter extends Adapter {
TemplateProfile prepare(boolean isIso, long userId, String name, String displayText, Integer bits, Boolean passwordEnabled, Boolean requiresHVM, String url, Boolean isPublic,
Boolean featured, Boolean isExtractable, String format, Long guestOSId, List<Long> zoneId, HypervisorType hypervisorType, String chksum, Boolean bootable, String templateTag, Account templateOwner, Map details, Boolean sshKeyEnabled, String imageStoreUuid, Boolean isDynamicallyScalable,
TemplateType templateType, boolean directDownload, boolean deployAsIs) throws ResourceAllocationException;
TemplateType templateType, boolean directDownload, boolean deployAsIs, boolean forCks) throws ResourceAllocationException;
}

View File

@ -134,14 +134,14 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat
Boolean isPublic, Boolean featured, Boolean isExtractable, String format, Long guestOSId, List<Long> zoneId, HypervisorType hypervisorType, String accountName,
Long domainId, String chksum, Boolean bootable, Map details, boolean directDownload, boolean deployAsIs) throws ResourceAllocationException {
return prepare(isIso, userId, name, displayText, bits, passwordEnabled, requiresHVM, url, isPublic, featured, isExtractable, format, guestOSId, zoneId,
hypervisorType, chksum, bootable, null, null, details, false, null, false, TemplateType.USER, directDownload, deployAsIs);
hypervisorType, chksum, bootable, null, null, details, false, null, false, TemplateType.USER, directDownload, deployAsIs, false);
}
@Override
public TemplateProfile prepare(boolean isIso, long userId, String name, String displayText, Integer bits, Boolean passwordEnabled, Boolean requiresHVM, String url,
Boolean isPublic, Boolean featured, Boolean isExtractable, String format, Long guestOSId, List<Long> zoneIdList, HypervisorType hypervisorType, String chksum,
Boolean bootable, String templateTag, Account templateOwner, Map details, Boolean sshkeyEnabled, String imageStoreUuid, Boolean isDynamicallyScalable,
TemplateType templateType, boolean directDownload, boolean deployAsIs) throws ResourceAllocationException {
TemplateType templateType, boolean directDownload, boolean deployAsIs, boolean forCks) throws ResourceAllocationException {
//Long accountId = null;
// parameters verification
@ -262,9 +262,11 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat
Long id = _tmpltDao.getNextInSequence(Long.class, "id");
CallContext.current().setEventDetails("Id: " + id + " name: " + name);
return new TemplateProfile(id, userId, name, displayText, bits, passwordEnabled, requiresHVM, url, isPublic, featured, isExtractable, imgfmt, guestOSId, zoneIdList,
TemplateProfile profile = 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);
profile.setForCks(forCks);
return profile;
}
@ -307,7 +309,7 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat
return prepare(false, CallContext.current().getCallingUserId(), cmd.getTemplateName(), cmd.getDisplayText(), cmd.getBits(), cmd.isPasswordEnabled(), cmd.getRequiresHvm(),
cmd.getUrl(), cmd.isPublic(), cmd.isFeatured(), cmd.isExtractable(), cmd.getFormat(), cmd.getOsTypeId(), zoneId, hypervisorType, cmd.getChecksum(), true,
cmd.getTemplateTag(), owner, details, cmd.isSshKeyEnabled(), null, cmd.isDynamicallyScalable(), templateType,
cmd.isDirectDownload(), cmd.isDeployAsIs());
cmd.isDirectDownload(), cmd.isDeployAsIs(), cmd.isForCks());
}
@ -338,7 +340,7 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat
params.isExtractable(), params.getFormat(), params.getGuestOSId(), zoneList,
params.getHypervisorType(), params.getChecksum(), params.isBootable(), params.getTemplateTag(), owner,
params.getDetails(), params.isSshKeyEnabled(), params.getImageStoreUuid(),
params.isDynamicallyScalable(), params.isRoutingType() ? TemplateType.ROUTING : TemplateType.USER, params.isDirectDownload(), params.isDeployAsIs());
params.isDynamicallyScalable(), params.isRoutingType() ? TemplateType.ROUTING : TemplateType.USER, params.isDirectDownload(), params.isDeployAsIs(), false);
}
private Long getDefaultDeployAsIsGuestOsId() {
@ -359,7 +361,7 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat
BooleanUtils.toBoolean(cmd.isFeatured()), BooleanUtils.toBoolean(cmd.isExtractable()), cmd.getFormat(), osTypeId,
cmd.getZoneId(), HypervisorType.getType(cmd.getHypervisor()), cmd.getChecksum(),
cmd.getTemplateTag(), cmd.getEntityOwnerId(), cmd.getDetails(), BooleanUtils.toBoolean(cmd.isSshKeyEnabled()),
BooleanUtils.toBoolean(cmd.isDynamicallyScalable()), BooleanUtils.toBoolean(cmd.isRoutingType()), cmd.isDeployAsIs());
BooleanUtils.toBoolean(cmd.isDynamicallyScalable()), BooleanUtils.toBoolean(cmd.isRoutingType()), cmd.isDeployAsIs(), cmd.isForCks());
return prepareUploadParamsInternal(params);
}
@ -390,7 +392,7 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat
return prepare(true, CallContext.current().getCallingUserId(), cmd.getIsoName(), cmd.getDisplayText(), 64, cmd.isPasswordEnabled(), true, cmd.getUrl(), cmd.isPublic(),
cmd.isFeatured(), cmd.isExtractable(), ImageFormat.ISO.toString(), cmd.getOsTypeId(), zoneList, HypervisorType.None, cmd.getChecksum(), cmd.isBootable(), null,
owner, null, false, cmd.getImageStoreUuid(), cmd.isDynamicallyScalable(), TemplateType.USER, cmd.isDirectDownload(), false);
owner, null, false, cmd.getImageStoreUuid(), cmd.isDynamicallyScalable(), TemplateType.USER, cmd.isDirectDownload(), false, false);
}
protected VMTemplateVO persistTemplate(TemplateProfile profile, VirtualMachineTemplate.State initialState) {

View File

@ -425,7 +425,7 @@
</a-checkbox>
</a-col>
<a-col :span="12">
<a-checkbox value="forCks">
<a-checkbox value="forCks" v-if="currentForm === 'Create'">
{{ $t('label.for.cks') }}
</a-checkbox>
</a-col>