Skip to content

Multiple CD-ROM / ISO Support Per VM#13101

Draft
Damans227 wants to merge 20 commits intoapache:mainfrom
Damans227:fr283-multi-cdrom
Draft

Multiple CD-ROM / ISO Support Per VM#13101
Damans227 wants to merge 20 commits intoapache:mainfrom
Damans227:fr283-multi-cdrom

Conversation

@Damans227
Copy link
Copy Markdown
Collaborator

@Damans227 Damans227 commented May 4, 2026

Description

Adds multiple CD-ROM support per VM on KVM. Today CloudStack allows only one ISO per VM, forcing a manual ISO-swap workflow to install Windows on KVM (Windows installer + VirtIO drivers). After this PR each VM can hold up to vm.cdrom.max.count ISOs simultaneously, each appearing as its own CD-ROM inside the guest.

What changes:

  • detachIso takes an optional id (required when multiple ISOs are attached).
  • listVirtualMachines returns isos[]; legacy isoid still reflects the bootable ISO.
  • New global config vm.cdrom.max.count (default 1), clamped by the hypervisor cap (KVM/IDE = 2).
  • New vm_iso_map table holds extra slots; user_vm.iso_id is kept as the bootable pointer for back-compat.

Scope: KVM only.

Design doc: https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=421957739

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Screenshots (if appropriate):

Screen.Recording.2026-05-04.at.5.20.18.PM.mov

How Has This Been Tested?

  • End-to-end on a KVM lab across cap=1/2/5, plus the UI manually.
  • Unit tests added in TemplateManagerImplTest for slot allocation, the duplicate-attach check, and the detach-id resolution helper.

How did you try to break this feature and the system with this change?

  • Set the global cap both lower and higher than the hypervisor's actual capacity to confirm clamping
  • Tried to re-attach an already-attached ISO
  • Detached the bootable and non-bootable ISO in turn to confirm user_vm.iso_id and vm_iso_map stay in sync
  • Stopped and restarted a multi-ISO VM to confirm boot-time persistence
  • Confirmed legacy single-ISO API consumers (isoid in listVirtualMachines) see no functional change

@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

❌ Patch coverage is 20.98765% with 192 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.08%. Comparing base (1e512ab) to head (61396a1).

Files with missing lines Patch % Lines
...n/java/com/cloud/template/TemplateManagerImpl.java 27.20% 91 Missing and 8 partials ⚠️
...rc/main/java/com/cloud/vm/dao/VmIsoMapDaoImpl.java 0.00% 36 Missing ⚠️
...e/cloudstack/api/response/AttachedIsoResponse.java 0.00% 21 Missing ⚠️
.../schema/src/main/java/com/cloud/vm/VmIsoMapVO.java 37.50% 15 Missing ⚠️
...ava/com/cloud/api/query/dao/UserVmJoinDaoImpl.java 18.18% 7 Missing and 2 partials ⚠️
...ud/hypervisor/kvm/storage/KVMStorageProcessor.java 0.00% 7 Missing ⚠️
...apache/cloudstack/api/response/UserVmResponse.java 33.33% 4 Missing ⚠️
.../cloudstack/api/command/user/iso/DetachIsoCmd.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #13101      +/-   ##
============================================
- Coverage     18.08%   18.08%   -0.01%     
- Complexity    16706    16722      +16     
============================================
  Files          6037     6041       +4     
  Lines        542437   542707     +270     
  Branches      66420    66471      +51     
============================================
+ Hits          98088    98126      +38     
- Misses       433333   433554     +221     
- Partials      11016    11027      +11     
Flag Coverage Δ
uitests 3.52% <ø> (+<0.01%) ⬆️
unittests 19.24% <20.98%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Damans227
Copy link
Copy Markdown
Collaborator Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@Damans227 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 17708

@Damans227
Copy link
Copy Markdown
Collaborator Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@Damans227 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17709

@sureshanaparti
Copy link
Copy Markdown
Contributor

@blueorangutan package

@sureshanaparti sureshanaparti added this to the 4.23.0 milestone May 5, 2026
@blueorangutan
Copy link
Copy Markdown

@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants