On Fri, Mar 25, 2011 at 07:47:45PM +0100, Philipp Hahn wrote:
> 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 <[email protected]>
The motivation for this patch is ok, but the impl isn't quite
robust enough. When nextslot gets to 31, libvirt resets it back
to 0 and starts searching again (in case there are now gaps from
unplugged devices). So when this happens, it'll pick up slot 2
again.
In qemuAssignDevicePCISlots() we do this
if (!reservedIDE &&
qemuDomainPCIAddressReserveSlot(addrs, 1) < 0)
goto error;
To ensure the PIIX is always reserved, even if no IDE disks
are present. I think we can just do the same with VGA but
with s/1/2/ in the slot number.
> ---
> 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;
> }
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list