Skip to content

Conversation

@shwstppr
Copy link
Contributor

@shwstppr shwstppr commented Sep 29, 2025

Description

Fixes #9460

A VM or template detail can be added with key skip.force.disk.controller and value true to allow skipping forcing disk controllers for the VM especially in case of UEFI VMs.
Otherwise, current behaviour of disk controllers depend on the guest OS, UEFI secure boot where Windows VM may always be provisioned with sata and other OS VMs with virtio.

Doc PR: apache/cloudstack-documentation#616

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

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

@shwstppr
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@weizhouapache weizhouapache added this to the 4.20.2 milestone Sep 29, 2025
@blueorangutan
Copy link

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

@weizhouapache
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

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

@vishesh92 vishesh92 requested a review from Copilot September 30, 2025 13:01
@vishesh92
Copy link
Member

@blueorangutan package

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds functionality to allow skipping disk controller forcing for KVM VMs by introducing a new VM detail flag. The enhancement improves flexibility for UEFI VMs that may have specific disk controller requirements.

Key changes:

  • Introduces a new VM detail constant skip.force.disk.controller to bypass default disk controller logic
  • Extracts disk definition logic into a separate method for better testability and maintainability
  • Adds comprehensive test coverage for the new functionality

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
VmDetailConstants.java Adds new constant for the skip force disk controller feature
LibvirtComputingResource.java Refactors disk definition logic and implements the skip functionality
LibvirtComputingResourceTest.java Adds test coverage for the new disk definition method

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@shwstppr shwstppr marked this pull request as ready for review September 30, 2025 13:21
@codecov
Copy link

codecov bot commented Oct 1, 2025

Codecov Report

❌ Patch coverage is 73.33333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.23%. Comparing base (750290b) to head (88d9334).
⚠️ Report is 3 commits behind head on 4.20.

Files with missing lines Patch % Lines
...ervisor/kvm/resource/LibvirtComputingResource.java 78.57% 1 Missing and 2 partials ⚠️
...ain/java/com/cloud/api/query/QueryManagerImpl.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #11750      +/-   ##
============================================
- Coverage     16.23%   16.23%   -0.01%     
- Complexity    13378    13380       +2     
============================================
  Files          5657     5657              
  Lines        498932   498942      +10     
  Branches      60552    60554       +2     
============================================
- Hits          81016    81005      -11     
- Misses       408882   408902      +20     
- Partials       9034     9035       +1     
Flag Coverage Δ
uitests 4.00% <ø> (ø)
unittests 17.09% <73.33%> (-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.

Copy link
Member

@vishesh92 vishesh92 left a comment

Choose a reason for hiding this comment

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

clgtm

@vishesh92
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

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

@weizhouapache
Copy link
Member

@blueorangutan test

@blueorangutan
Copy link

@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-14511)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 46129 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11750-t14511-kvm-ol8.zip
Smoke tests completed. 133 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

DiskDef.DiskBus diskBusType, DiskDef.DiskBus diskBusTypeData, Map<String, String> details) {
boolean skipForceDiskController = MapUtils.getBoolean(details, VmDetailConstants.KVM_SKIP_FORCE_DISK_CONTROLLER,
false);
if (skipForceDiskController) {

Choose a reason for hiding this comment

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

@shwstppr
This condition forces the root disk controller to use its configured settings instead of the UEFI workflow settings, even when the VM is deployed with UEFI and this setting "skip.force.disk.controller" is enabled. Consequently, a UEFI-deployed VM may fail to boot because some guest operating systems still depend on SATA disk. Please include a comment or a note detailing the change in behavior."

@weizhouapache weizhouapache modified the milestones: 4.20.2, 4.20.3 Oct 23, 2025
@DaanHoogland DaanHoogland changed the base branch from 4.19 to 4.20 November 11, 2025 13:12
@DaanHoogland DaanHoogland changed the base branch from 4.20 to 4.19 November 11, 2025 13:14
@RosiKyu
Copy link
Collaborator

RosiKyu commented Dec 17, 2025

@blueorangutan package

@blueorangutan
Copy link

@RosiKyu a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

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

@DaanHoogland DaanHoogland changed the base branch from 4.19 to 4.20 January 7, 2026 10:41
@DaanHoogland DaanHoogland changed the base branch from 4.20 to 4.19 January 7, 2026 10:42
@shwstppr shwstppr force-pushed the fix-kvm-securebootvm-diskcontroller branch from dfa2832 to d1d9890 Compare January 7, 2026 11:00
Fixes apache#9460

A VM or template detail can be added with key `skip.force.disk.controller` and value `true` to allow skipping forcing disk controllers for the VM especially in case of UEFI VMs.
Otherwise, current behaviour of disk controllers depend on the guest OS, UEFI secure boot where Windows VM may always be provisioned with `sata` and other OS VMs with `virtio`.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@shwstppr shwstppr force-pushed the fix-kvm-securebootvm-diskcontroller branch from d1d9890 to 88d9334 Compare January 7, 2026 11:13
@shwstppr shwstppr changed the base branch from 4.19 to 4.20 January 7, 2026 11:13
@shwstppr
Copy link
Contributor Author

shwstppr commented Jan 7, 2026

@blueorangutan package

@blueorangutan
Copy link

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

shwstppr added a commit to shapeblue/cloudstack-documentation that referenced this pull request Jan 7, 2026
Related apache/cloudstack#11750

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@blueorangutan
Copy link

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

@RosiKyu
Copy link
Collaborator

RosiKyu commented Jan 8, 2026

@blueorangutan test

@blueorangutan
Copy link

@RosiKyu a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-15149)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 54188 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11750-t15149-kvm-ol8.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

Copy link
Collaborator

@RosiKyu RosiKyu left a comment

Choose a reason for hiding this comment

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

LGTM

Test Results

PR: #11750 - kvm: allow skip forcing disk controller
Issue: #9460
Tested on: CloudStack 4.20.3.0-SNAPSHOT
Environment: KVM (Oracle Linux 9), 2 hosts

API Tests

Test Description Status
TC-001 API detail availability via listDetailOptions $\color{green}{\textsf{PASSED}}$
TC-002 Windows UEFI + skip flag - VirtIO persistence (main fix) $\color{green}{\textsf{PASSED}}$
TC-003 Windows UEFI default behavior (SATA enforced) $\color{green}{\textsf{PASSED}}$
TC-004 Linux UEFI default behavior (VirtIO enforced) $\color{green}{\textsf{PASSED}}$
TC-005 Data disk attachment with skip flag $\color{green}{\textsf{PASSED}}$
TC-006 Windows BIOS VM - no regression $\color{green}{\textsf{PASSED}}$
TC-007 Template-level skip.force.disk.controller setting $\color{green}{\textsf{PASSED}}$
TC-008 Detail priority - Instance overrides Template $\color{green}{\textsf{PASSED}}$
TC-009 VM live migration with skip flag $\color{green}{\textsf{PASSED}}$
TC-010 Different disk bus types (virtio, scsi, sata) $\color{green}{\textsf{PASSED}}$
TC-011 Null/empty details map handling $\color{green}{\textsf{PASSED}}$

UI Tests

Test Description Status
UI-001 Verify skip.force.disk.controller appears in VM Settings $\color{green}{\textsf{PASSED}}$
UI-002 Set skip.force.disk.controller via UI $\color{green}{\textsf{PASSED}}$
UI-003 Verify Template Settings $\color{green}{\textsf{PASSED}}$

Key Observations

  1. Main bug fix verified: Windows UEFI Secure Boot VMs with skip.force.disk.controller=true maintain VirtIO disk controllers through stop/start cycles.

  2. API: listDetailOptions requires a resourceid (VM UUID) parameter to return hypervisor-specific details - the hypervisor parameter alone is insufficient.

  3. Detail Priority: Instance-level details override template-level details (standard CloudStack behavior).

  4. No Regressions: Default UEFI behavior (SATA for Windows, VirtIO for Linux) preserved when skip flag is not set.


Detailed Test Results

Can be found in the following pdf: Detailed Test Results PR #11750.pdf

@DaanHoogland DaanHoogland merged commit ef1aaa0 into apache:4.20 Jan 9, 2026
26 checks passed
@DaanHoogland DaanHoogland deleted the fix-kvm-securebootvm-diskcontroller branch January 9, 2026 12:56
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.

RootDiskController setting not Honored throughout Instance lifecycle

8 participants