andrijapanicsb opened a new pull request, #14867:
URL: https://github.com/apache/cloudstack/pull/14867

   Fixes #11212
   
   ### In short
   
   On KVM, a UEFI (q35) guest can hot-plug only one more disk or NIC, then the 
next attach fails with `No more available PCI slots`. This gives every x86 q35 
guest 28 empty PCIe root ports at start, as aarch64/s390x guests already get 32 
(#5193), so disks and NICs can be hot-plugged.
   
   ### Change
   
   1. `LibvirtComputingResource`: an x86 guest with a q35 machine type (`q35`, 
`pc-q35-*`) gets a `pcie-root` controller and 28 `pcie-root-port` controllers. 
The count is fixed, with no setting.
   2. `LibvirtVMDef`: these controllers go after all devices, without `index` 
or `<address>`, so libvirt places every existing device exactly where it did 
before. The extra ports are the empty ones after them.
   3. `LibvirtPlugNicCommandWrapper`: on q35, a hot-plugged NIC is no longer 
pinned to a bus 0 slot (since #12826). libvirt refuses that on q35, because the 
PCIe root complex isn't hot-pluggable.
   
   i440fx (`pc`), LXC, aarch64 and s390x guests get exactly the same XML as 
before. 28 is also the maximum OpenStack Nova allows for `num_pcie_ports`.
   
   ### Firmware note: OVMF before May 2023
   
   OVMF before edk2 commit 27727338b2c0 reserves I/O space for every empty 
hot-plug port, and only about 10 ports get resources. On such hosts, a Windows 
guest takes the first hot-plugged disk after a start. The following ones show 
Device Manager code 10 until the guest is rebooted, then they work. Linux 
guests and NICs aren't affected. Today the second hot-plug fails outright, so 
this is still an improvement.
   
   Fixed firmware: EL 9.3 and later (`edk2-ovmf-20230524-3.el9` backports the 
fix) and Ubuntu 24.04. Affected, by package version: EL8, EL9.0-9.2, Ubuntu 
22.04, Debian 12.
   
   ### Tests
   
   Unit tests (JDK 17): `mvn -pl plugins/hypervisors/kvm test`, 1115 tests, 0 
failures, 0 Checkstyle violations.
   
   Lab: AlmaLinux 9.1 KVM hosts, libvirt 8.5.0, QEMU 7.0. The agent was built 
from an October 24.0.0-SNAPSHOT commit (d3f0700e) with the same change. That 
commit predates #12826, so change 3 wasn't needed there.
   
   | Test | Before | After |
   |---|---|---|
   | Hot-plug into a UEFI guest | 2nd attach fails | Windows: 19 disks + 4 NICs 
attached; Linux: 10 disks + 4 NICs; then libvirt refuses cleanly (all ports 
used) |
   | Existing guests (Windows UEFI Secure Boot with static IP, Ubuntu UEFI, 
CentOS i440fx) stopped and started on the new agent | - | Same PCI 
bus/device/function for every device; same NICs, MACs and static IP; no ghost 
devices |
   | Windows, 10 disks hot-plugged after a start, on edk2-ovmf 20220526 (EL9.1) 
| - | 1 works, 9 code 10 until a reboot |
   | Same guest and host, on edk2-ovmf 20241117-9.el9 | - | 10 of 10 work, back 
to back and with pauses; Secure Boot on |
   | Live migration of a Linux guest, new agent to old agent and back | - | 
Works; the layout moves with the guest |
   
   ### Not tested yet
   
   - This exact commit in a lab, including the NIC change (3) on `main`. 
Planned; results will follow here.
   - Reverting a VM snapshot with memory taken before the upgrade.
   - q35 with SeaBIOS in a lab (checked locally with QEMU only), and guests 
that start with 28 or more PCIe devices.
   - aarch64 and s390x: unit tests only; their code path is unchanged.
   
   Related: #14844 (explicit disk controllers). With it, more Windows UEFI 
guests use virtio-blk disks, one root port each.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to