Skip to content

Commit aca4d84

Browse files
committed
refactor: rename CD-ROM references to ISO and update related logic
1 parent 3ea7edf commit aca4d84

6 files changed

Lines changed: 23 additions & 23 deletions

File tree

api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
170170
@Param(description = "All ISOs attached to the Instance, keyed by cdrom slot. The first entry mirrors isoid/isoname for back-compat.", responseObject = AttachedIsoResponse.class, since = "4.23.0")
171171
private List<AttachedIsoResponse> isos;
172172

173-
@SerializedName("cdrommaxcount")
174-
@Param(description = "Maximum number of CD-ROM drives this Instance may have, after applying the cluster-scoped vm.cdrom.max.count and the hypervisor's own cap.", since = "4.23.0")
175-
private Integer cdromMaxCount;
173+
@SerializedName("isomaxcount")
174+
@Param(description = "Maximum number of ISOs that may be attached to this Instance, after applying the cluster-scoped vm.iso.max.count and the hypervisor's own cap.", since = "4.23.0")
175+
private Integer isoMaxCount;
176176

177177
@SerializedName(ApiConstants.SERVICE_OFFERING_ID)
178178
@Param(description = "The ID of the service offering of the Instance")
@@ -887,12 +887,12 @@ public List<AttachedIsoResponse> getIsos() {
887887
return isos;
888888
}
889889

890-
public void setCdromMaxCount(Integer cdromMaxCount) {
891-
this.cdromMaxCount = cdromMaxCount;
890+
public void setIsoMaxCount(Integer isoMaxCount) {
891+
this.isoMaxCount = isoMaxCount;
892892
}
893893

894-
public Integer getCdromMaxCount() {
895-
return cdromMaxCount;
894+
public Integer getIsoMaxCount() {
895+
return isoMaxCount;
896896
}
897897

898898
public void setIsoName(String isoName) {

engine/components-api/src/main/java/com/cloud/template/TemplateManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ public interface TemplateManager {
6464
true,
6565
ConfigKey.Scope.Global);
6666

67-
ConfigKey<Integer> VmCdromMaxCount = new ConfigKey<Integer>("Advanced",
67+
ConfigKey<Integer> VmIsoMaxCount = new ConfigKey<Integer>("Advanced",
6868
Integer.class,
69-
"vm.cdrom.max.count", "1",
70-
"Maximum number of CD-ROM drives per VM.",
69+
"vm.iso.max.count", "1",
70+
"Maximum number of ISOs that may be attached to a VM.",
7171
true,
7272
ConfigKey.Scope.Cluster);
7373

server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public UserVmResponse newUserVmResponse(ResponseView view, String objectName, Us
269269
}
270270
}
271271
userVmResponse.setIsos(attachedIsos);
272-
userVmResponse.setCdromMaxCount(effectiveCdromMaxCount(userVm));
272+
userVmResponse.setIsoMaxCount(effectiveCdromMaxCount(userVm));
273273
}
274274
if (details.contains(VMDetails.all) || details.contains(VMDetails.servoff)) {
275275
userVmResponse.setServiceOfferingId(userVm.getServiceOfferingUuid());
@@ -564,7 +564,7 @@ private long computeLeaseDurationFromExpiryDate(Date created, Date leaseExpiryDa
564564
}
565565

566566
int effectiveCdromMaxCount(UserVmJoinVO userVm) {
567-
int configuredCap = TemplateManager.VmCdromMaxCount.valueIn(userVm.getClusterId());
567+
int configuredCap = TemplateManager.VmIsoMaxCount.valueIn(userVm.getClusterId());
568568
int hypervisorCap = advertisedCdromCap(userVm.getHostId() != null ? userVm.getHostId() : userVm.getLastHostId());
569569
// List endpoint clamps for display robustness; the action paths in TemplateManagerImpl
570570
// throw on misconfiguration so operators still see the loud error when they try to attach.

server/src/main/java/com/cloud/template/TemplateManagerImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,12 +1559,12 @@ void enforceCdromAttachLimits(long vmId, UserVm vm, long isoId) {
15591559
int effectiveMaxCdroms(VirtualMachine vm, Long hostId) {
15601560
HostVO host = hostId != null ? _hostDao.findById(hostId) : null;
15611561
Long clusterId = host != null ? host.getClusterId() : null;
1562-
int configuredCap = VmCdromMaxCount.valueIn(clusterId);
1562+
int configuredCap = VmIsoMaxCount.valueIn(clusterId);
15631563
int hypervisorCap = advertisedCdromCap(hostId);
15641564
if (configuredCap > hypervisorCap) {
15651565
String message = String.format(
15661566
"%s is set to %d but the placement host supports a maximum of %d CD-ROM(s) per Instance; lower %s to %d or less.",
1567-
VmCdromMaxCount.key(), configuredCap, hypervisorCap, VmCdromMaxCount.key(), hypervisorCap);
1567+
VmIsoMaxCount.key(), configuredCap, hypervisorCap, VmIsoMaxCount.key(), hypervisorCap);
15681568
logger.error(message);
15691569
throw new InvalidParameterValueException(message);
15701570
}
@@ -2713,7 +2713,7 @@ public ConfigKey<?>[] getConfigKeys() {
27132713
TemplatePreloaderPoolSize,
27142714
ValidateUrlIsResolvableBeforeRegisteringTemplate,
27152715
TemplateDeleteFromPrimaryStorage,
2716-
VmCdromMaxCount};
2716+
VmIsoMaxCount};
27172717
}
27182718

27192719
public List<TemplateAdapter> getTemplateAdapters() {

ui/src/config/section/compute.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ import { getLatestKubernetesIsoParams } from '@/utils/acsrepo'
2323
import kubernetesIcon from '@/assets/icons/kubernetes.svg?inline'
2424

2525
const attachedIsoCount = (record) => (record.isos && record.isos.length) || (record.isoid ? 1 : 0)
26-
// Server pre-computes the effective cap (cluster-scoped vm.cdrom.max.count clamped to the
26+
// Server pre-computes the effective cap (cluster-scoped vm.iso.max.count clamped to the
2727
// hypervisor's own limit). Fall back to the hypervisor floor for older servers.
28-
const cdromMaxCount = (record) => record.cdrommaxcount != null
29-
? record.cdrommaxcount
28+
const isoMaxCount = (record) => record.isomaxcount != null
29+
? record.isomaxcount
3030
: (record.hypervisor === 'KVM' ? 2 : 1)
3131
const isoActionAvailable = (record) =>
3232
record.hypervisor !== 'External' && ['Running', 'Stopped'].includes(record.state) && record.vmtype !== 'sharedfsvm'
@@ -308,7 +308,7 @@ export default {
308308
docHelp: 'adminguide/templates.html#attaching-an-iso-to-a-vm',
309309
dataView: true,
310310
popup: true,
311-
show: (record) => isoActionAvailable(record) && attachedIsoCount(record) < cdromMaxCount(record),
311+
show: (record) => isoActionAvailable(record) && attachedIsoCount(record) < isoMaxCount(record),
312312
disabled: (record) => { return record.hostcontrolstate === 'Offline' || record.hostcontrolstate === 'Maintenance' },
313313
component: shallowRef(defineAsyncComponent(() => import('@/views/compute/AttachIso.vue')))
314314
},

ui/src/views/compute/AttachIso.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ export default {
103103
},
104104
methods: {
105105
computeMaxSelections () {
106-
// Server pre-computes the effective cap (cluster-scoped vm.cdrom.max.count clamped to
107-
// the hypervisor's own limit) and exposes it on the VM as cdrommaxcount.
108-
const effectiveCap = this.resource.cdrommaxcount != null
109-
? this.resource.cdrommaxcount
106+
// Server pre-computes the effective cap (cluster-scoped vm.iso.max.count clamped to
107+
// the hypervisor's own limit) and exposes it on the VM as isomaxcount.
108+
const effectiveCap = this.resource.isomaxcount != null
109+
? this.resource.isomaxcount
110110
: (this.resource.hypervisor === 'KVM' ? 2 : 1)
111111
const alreadyAttached = (this.resource.isos && this.resource.isos.length) ||
112112
(this.resource.isoid ? 1 : 0)

0 commit comments

Comments
 (0)