Repository navigation
kvm: honour explicit root and data disk controllers for UEFI and Windows VMs - #14844
andrijapanicsb wants to merge 3 commits into
Conversation
…ows VMs When the rootDiskController or dataDiskController detail of a VM is set to virtio, scsi, sata or ide, the KVM agent now uses that bus for the disk on every primary storage type, whatever the guest OS and the boot mode. Until now a Windows VM with UEFI Secure Boot on a file-based pool (and every Windows UEFI VM on PowerFlex) always got SATA disks, whatever was set. Without these details the existing defaults stay, including SATA for Windows UEFI VMs. CD-ROMs are not changed (SATA on UEFI, IDE on BIOS). ide on a UEFI VM gives sata, as the q35 machine type has no IDE bus. skip.force.disk.controller keeps working as before.
|
On the concern raised in #10213 that virtio disks break Windows guests with UEFI Secure Boot (#10213 (comment)): I looked into this claim and tested it. Short version: I found no evidence that virtio disks break Windows under UEFI Secure Boot, and my tests show the What I tested
When Windows really fails None of these cases is caused by the disk bus:
For this PR: forcing SATA only covers case 1, and it overrides every operator who sets virtio on purpose. This If there is a specific Windows version or scenario to check, I can run it and post the results. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #14844 +/- ##
============================================
+ Coverage 20.83% 20.86% +0.02%
- Complexity 20973 21055 +82
============================================
Files 6053 6053
Lines 548955 549082 +127
Branches 73359 73392 +33
============================================
+ Hits 114377 114567 +190
+ Misses 421186 421116 -70
- Partials 13392 13399 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@ACSHomeBot package G |
|
Accepted: Planned: RPM + DEB, KVM SystemVM. Status: Completed. Packaging results. |
Packaging results:
Test packages are available at:
|
Windows keeps only the storage driver it booted from ready for boot: it demotes the others with StartOverride. A Windows VM that has booted on SATA stops with INACCESSIBLE_BOOT_DEVICE when it is moved to virtio. So honouring rootDiskController and dataDiskController on every existing VM would break Windows UEFI VMs that carry rootDiskController=virtio (for example from the VMware to KVM import) but have always run on SATA. The KVM agent now honours the controller details only on VMs with the honour.disk.controller=true detail. Without it, the buses stay as before on every storage pool type. The management server sets this detail, hidden, on a new KVM VM: - when the deploy or import details name a controller (virtio, scsi, sata or ide); imports pass the bus the source disk used; - when the controller comes from a template that has the detail: KVM templates registered or uploaded from this version on, and templates captured from a VM that has it; - for a VM created from a backup, a volume or a snapshot, only when the source VM has it. KVM agents report host.honour.disk.controller=true when they connect; agents that do not report it get false. When a VM with the detail starts on a host whose agent does not honour it (during a rolling upgrade), the management server removes the detail for good, so the VM keeps the bus that agent boots it from. SATA always boots on UEFI, because the CD-ROMs keep the SATA driver in use. skip.force.disk.controller is unchanged.
TemplateAdapterBase.addHonourDiskControllerDetail() added the detail to the details map of the caller, which can be read-only (it failed with UnsupportedOperationException in ExternalTemplateAdapterTest). It now returns a copy with the detail. The host capability sync and the start guard also write to copies of the host and VM details now.
|
@ACSHomeBot package G |
|
Accepted: Planned: RPM + DEB, KVM SystemVM. Status: Failed. Packaging results:
Built package artifacts were retained locally, but no public repository was promoted. Status: Package building failed. |
|
@ACSHomeBot package G |
|
Accepted: Planned: RPM + DEB, KVM SystemVM. Status: Completed. Packaging results. |
Packaging results:
Test packages are available at:
|
Description
In short: the KVM agent now uses the disk controller set for a VM (
rootDiskController,dataDiskController) on every storage type, for VMs created or imported from this version on. Existing VMs keep exactly the disk buses they have today.The problem. A Windows VM with UEFI Secure Boot on NFS, local or SharedMountPoint storage (and every Windows UEFI VM on PowerFlex) always gets SATA disks, even with
rootDiskController=virtio. A typical case: a Windows Server VM moved from VMware with CloudStack's VMware to KVM import. The import storesvirtio, the guest has the virtio drivers, and the disks still end up on SATA. The forcing comes from #3638, #4773 and #11554;skip.force.disk.controller(#11750) is the only way out today.Why only new VMs. Windows keeps only the storage driver it booted from ready for boot, and marks the others as not needed at boot (registry value
StartOverride). So a VM that has booted on SATA stops with INACCESSIBLE_BOOT_DEVICE (0x7B) when it is moved to virtio. We reproduced it: an imported Windows Server 2025 VM that had booted on SATA failed on virtio, and booted on virtio once that registry value was removed. Changing the bus of existing VMs at upgrade would break them.How it works
honour.disk.controller=truewhen it is created or imported with an explicit controller (virtio,scsi,sataoride). A controller inherited from a template counts only if the template has the setting too: KVM templates registered from this version on get it, and so do templates captured from a VM that has it. VMs created from a backup, a volume or a snapshot follow the source VM.host.honour.disk.controller=true. When a VM with the setting starts on a host whose agent does not report it (during a rolling upgrade), the management server removes the setting for good. The VM then stays on the bus that agent gives it; SATA always boots on UEFI, because the CD-ROMs keep the SATA driver in use.skip.force.disk.controlleris unchanged.rootDiskController=virtio, NFSdataDiskController, RBD or GlusterdataDiskControllerExisting VMs can be moved by an operator: remove the registry value inside Windows, set
honour.disk.controller=true, restart. The steps are in the documentation PR apache/cloudstack-documentation#704.Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
honour.disk.controlleron file-based, PowerFlex and RBD pools (without it the buses are the same as before, for example SATA for an older Windows UEFI Secure Boot VM withvirtio); which new VMs and templates get the setting (deploy, import, template, volume, snapshot, backup); the start guard; the host capability.Lab with this rework. A new test cloud built from stock
main04fa924 (1 management server, 2 AlmaLinux 9 KVM hosts, NFS primary storage), then the management server and one host upgraded to packages of this head (first a local build, then the ACSHomeBot packages, merged ontomain85ca17a); the other host stayed on stock packages. Guest: Windows Server 2025 with UEFI Secure Boot, imported from vSphere withrootDiskController=virtioanddataDiskController=virtio.host.honour.disk.controller=true, the stock host nothingaddResourceDetail, started on the upgraded hostNot tested yet with this rework: Windows Server 2019/2022 and Linux guests, ISO installs, three or more disks,
skip.force.disk.controller, storage other than NFS, templates registered after the upgrade, and a management server rollback.Details
Bus per storage type, VMs with
honour.disk.controller=true(without it: unchanged)rootDiskControllerdataDiskController; Windows UEFI without it: the root disk busrootDiskController(before: the data disk bus)dataDiskControllerrootDiskControllerdataDiskController(before: the root disk bus)rootDiskControllerdataDiskControllerideon a UEFI VM givessata(q35 has no IDE bus).osdefaultandvirtio-blkare not explicit. CD-ROMs are not changed (SATA on UEFI, IDE on BIOS).Files:
VmDetailConstants,Host(new names);LibvirtComputingResource(honour only with the setting),LibvirtReadyCommandWrapper(report the capability);AgentManagerImpl(store it);UserVmManagerImpl(set the setting at creation, follow backups, remove it on a host without the capability);TemplateAdapterBase(new KVM templates),TemplateManagerImpl(templates from a VM follow the VM).Not covered: an operator who changes the controller of a VM that has the setting, after it booted on another bus, needs the registry fix first (documented). A full rollback of the management server and a new upgrade is not handled.