Skip to content
Draft
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d3668e2
pre-allocate a second empty cdrom slot at boot (hardcoded)
Damans227 May 4, 2026
90b415f
drive cdrom slot count via vm.cdrom.max.count ConfigKey
Damans227 May 4, 2026
0516f82
add vm_iso_map table + VO/DAO
Damans227 May 4, 2026
945f2bd
persist multi-ISO state via vm_iso_map
Damans227 May 4, 2026
9570369
carry target cdrom slot through AttachCommand to KVM agent
Damans227 May 4, 2026
5fd487a
enforce per-VM cdrom cap, clamp to hypervisor max
Damans227 May 4, 2026
3a13ac7
make detachIso accepts an ISO id
Damans227 May 4, 2026
b05b9f9
expose attached ISOs as isos[] in listVirtualMachines response
Damans227 May 4, 2026
6d2ae5a
extract CDROM_PRIMARY_DEVICE_SEQ constant
Damans227 May 4, 2026
a44b4fb
unit tests for cdrom slot allocation logic
Damans227 May 4, 2026
a6afd26
implement multi-ISO attachment and detachment for VMs with enhanced v…
Damans227 May 4, 2026
71fe082
implement multi-ISO display in InstanceTab with computed property for…
Damans227 May 4, 2026
2ff3ce6
add warning alert for max CDROM selections and enhance global capacit…
Damans227 May 4, 2026
e394f1c
enhance ISO attachment validation to handle multiple ISOs and prevent…
Damans227 May 4, 2026
e7185ab
refactor ISO attachment logic for detachment and validation
Damans227 May 4, 2026
1e5bd63
add unit tests for ISO detachment resolution and validation logic
Damans227 May 4, 2026
79e8edf
add mock for VmIsoMapDao in UserVmJoinDaoImplTest and set lenient beh…
Damans227 May 4, 2026
bac8122
refactor ISO attachment logic and enhance UI for multi-CDROM management
Damans227 May 4, 2026
0570cf2
refactor ISO attachment methods to use VM ID and improve parameter ha…
Damans227 May 4, 2026
61396a1
remove unnecessary mock for VM ISO mapping in TemplateManagerImplTest
Damans227 May 4, 2026
fdaffb5
add 'since' attribute to ISO detach command parameter description
Damans227 May 5, 2026
6634da7
scope vm.cdrom.max.count to cluster
Damans227 May 5, 2026
082896e
add support for configurable CD-ROM count per VM and improve handling…
Damans227 May 5, 2026
ce530d2
add HostDetailsDao mock to UserVmJoinDaoImplTest
Damans227 May 5, 2026
7717002
fix: handle null poolId when loading attached ISO slots in prepareIso…
Damans227 May 5, 2026
2932522
implement listByIsoId method in VmIsoMapDao and update TemplateManage…
Damans227 May 5, 2026
22fae71
improve logging messages for ISO deletion checks
Damans227 May 5, 2026
893c6df
add unit tests for CD-ROM handling and enforce limits in TemplateManager
Damans227 May 6, 2026
3ea7edf
refactor: update configuration value handling and improve notificatio…
Damans227 May 14, 2026
aca4d84
refactor: rename CD-ROM references to ISO and update related logic
Damans227 May 14, 2026
fdc33d4
refactor: enhance effective CD-ROM max count logic to handle missing …
Damans227 May 14, 2026
fa84824
refactor: enhance effective CD-ROM max count logic to handle misconfi…
Damans227 May 14, 2026
80e87df
refactor: enhance effective CD-ROM max count logic to retrieve host I…
Damans227 May 14, 2026
a38c383
refactor: enhance host ID retrieval logic for VMs based on hypervisor…
Damans227 May 14, 2026
68ac686
Merge remote-tracking branch 'upstream/main' into fr283-multi-cdrom
Damans227 May 14, 2026
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
Prev Previous commit
Next Next commit
refactor: enhance effective CD-ROM max count logic to handle misconfi…
…gurations during VM boot
  • Loading branch information
Damans227 committed May 14, 2026
commit fa84824034dfdce58ee5179e1fc281b4d86a0f85
16 changes: 13 additions & 3 deletions server/src/main/java/com/cloud/template/TemplateManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ public void prepareIsoForVmProfile(VirtualMachineProfile profile, DeployDestinat

// Pre-allocate every cdrom slot at boot. QEMU/IDE refuses to hot-add new cdrom drives, so
// runtime attachIso can only media-swap into a slot the domain already owns.
int totalSlots = Math.max(effectiveMaxCdroms(vm, dest.getHost().getId()), slotsNeededFor(slotToIsoId));
int totalSlots = Math.max(effectiveMaxCdroms(vm, dest.getHost().getId(), false), slotsNeededFor(slotToIsoId));
for (int i = 0; i < totalSlots; i++) {
int diskSeq = CDROM_PRIMARY_DEVICE_SEQ + i;
Long isoId = slotToIsoId.get(diskSeq);
Expand Down Expand Up @@ -1557,6 +1557,10 @@ void enforceCdromAttachLimits(long vmId, UserVm vm, long isoId) {
}

int effectiveMaxCdroms(VirtualMachine vm, Long hostId) {
return effectiveMaxCdroms(vm, hostId, true);
}

int effectiveMaxCdroms(VirtualMachine vm, Long hostId, boolean failOnMisconfig) {
HostVO host = hostId != null ? _hostDao.findById(hostId) : null;
Long clusterId = host != null ? host.getClusterId() : null;
int configuredCap = VmIsoMaxCount.valueIn(clusterId);
Expand All @@ -1565,8 +1569,14 @@ int effectiveMaxCdroms(VirtualMachine vm, Long hostId) {
String message = String.format(
"%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.",
VmIsoMaxCount.key(), configuredCap, hypervisorCap, VmIsoMaxCount.key(), hypervisorCap);
logger.error(message);
throw new InvalidParameterValueException(message);
if (failOnMisconfig) {
logger.error(message);
throw new InvalidParameterValueException(message);
}
// VM start path: don't block the Instance from booting just because the cap was misconfigured.
// The next attach attempt will surface the misconfig loudly via the strict variant.
logger.warn("{} Clamping to {} for VM start.", message, hypervisorCap);
return hypervisorCap;
}
return configuredCap;
}
Expand Down