If a domain is initially created without a <vidoe> device but with other
devices (like <interface>), PCI device slots normally reserved for
hardcoded devices (host bridge, IDE controller, video) get assigned to
these. If than later on a <video> device is added without removing the
already assigned <addresse>s, the re-definition fails in
qemuAssignDevicePCISlots() with the error message "Primary video card
must have PCI address 0:0:2.0"
To simplify editing existing domains just reserve the first three slots
for internal usage by setting qemuDomainPCIAddressSet.nextslot = 3.
Signed-off-by: Philipp Hahn <hahn(a)univention.de>
---
src/qemu/qemu_command.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c63de09..c359fd0 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -733,6 +733,9 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def)
if (!(addrs = qemuDomainPCIAddressSetCreate(def)))
goto cleanup;
+ /* reserve first 3 slots for hardcoded devices */
+ addrs->nextslot = 3;
+
if (qemuAssignDevicePCISlots(def, addrs) < 0)
goto cleanup;
}
--
1.7.1