Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.List;
import java.util.Map;

import com.cloud.cpu.CPU;
import org.apache.cloudstack.acl.SecurityChecker;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandResourceType;
Expand Down Expand Up @@ -148,6 +149,11 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd implements UserCmd {
since = "4.19.0")
private String accountName;

@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
description = "the CPU arch of the template. Valid options are: x86_64, aarch64. Defaults to x86_64",
since = "4.20.2")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
since = "4.20.2")
since = "4.21.0")

if this is part of 4.21

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is based off of 4.20 @sureshanaparti , I think it is good like this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DaanHoogland is it ok if it goes in 4.21 first (before 4.20.2)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if both versions are to use the same template (which it looks like ti is going to be).

private String arch;

// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
Expand Down Expand Up @@ -234,6 +240,10 @@ public String getAccountName() {
return accountName;
}

public CPU.CPUArch getArch() {
return CPU.CPUArch.fromType(arch);
}

// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1831,6 +1831,7 @@ public VMTemplateVO createPrivateTemplateRecord(CreateTemplateCmd cmd, Account t
throw new InvalidParameterValueException("Failed to create private template record, please specify only one of volume ID (" + volumeId +
") and snapshot ID (" + snapshotId + ")");
}
CPU.CPUArch arch = cmd.getArch();

HypervisorType hyperType;
VolumeVO volume = null;
Expand Down Expand Up @@ -1923,7 +1924,6 @@ public VMTemplateVO createPrivateTemplateRecord(CreateTemplateCmd cmd, Account t
String description = cmd.getDisplayText();
boolean isExtractable = false;
Long sourceTemplateId = null;
CPU.CPUArch arch = CPU.CPUArch.amd64;
if (volume != null) {
VMTemplateVO template = ApiDBUtils.findTemplateById(volume.getTemplateId());
isExtractable = template != null && template.isExtractable() && template.getTemplateType() != Storage.TemplateType.SYSTEM;
Expand Down
25 changes: 23 additions & 2 deletions ui/src/views/storage/CreateTemplate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,25 @@
</a-select-option>
</a-select>
</a-form-item>
<a-form-item
name="arch"
ref="arch">
<template #label>
<tooltip-label :title="$t('label.arch')" :tooltip="apiParams.arch.description"/>
</template>
<a-select
showSearch
optionFilterProp="label"
:filterOption="(input, option) => {
return option.children[0].children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}"
v-model:value="form.arch"
:placeholder="apiParams.arch.description">
<a-select-option v-for="opt in architectureTypes.opts" :key="opt.id">
{{ opt.name || opt.description }}
</a-select-option>
</a-select>
</a-form-item>
<a-row :gutter="12">
<a-col :md="24" :lg="12">
<a-form-item ref="isdynamicallyscalable" name="isdynamicallyscalable">
Expand Down Expand Up @@ -163,7 +182,7 @@
<tooltip-label :title="$t('label.isfeatured')" :tooltip="apiParams.isfeatured.description"/>
</template>
<a-switch v-model:checked="form.isfeatured" />
</a-form-item>
</a-form-item>
</a-col>
</a-row>
<div :span="24" class="action-button">
Expand Down Expand Up @@ -204,7 +223,8 @@ export default {
accounts: [],
domainLoading: false,
domainid: null,
account: null
account: null,
architectureTypes: {}
}
},
computed: {
Expand Down Expand Up @@ -239,6 +259,7 @@ export default {
if ('listDomains' in this.$store.getters.apis) {
this.fetchDomains()
}
this.architectureTypes.opts = this.$fetchCpuArchitectureTypes()
},
fetchOsTypes () {
this.osTypes.opts = []
Expand Down
Loading