[Libguestfs] [PATCH 0/3] resolve conflict between manual and libvirt-assigned PCI addresses

Laszlo Ersek lersek at redhat.com
Thu Dec 23 10:36:58 UTC 2021

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2034160

The first patch extends our current <qemu:commandline> hack, moving the
virtio-net-pci device to slot 0x1E, where it is very unlikely to
conflict with any libvirt-assigned PCI address.

The second patch is only refactoring.

The third patch resolves the conflict on libvirt >= 3.8.0 in a better
way (suggested by Rich): such libvirt versions permit SLIRP network
address and prefix specifications right in the <interface> element.
Therefore we can have libvirt manage the virtio-net device for us,
similarly to virtio-rng, virtio-scsi, and virtio-serial. The (updated)
<qemu:commandline> hack is preserved for libvirt < 3.8.0.

Gruesomely meticulously tested. (See the Notes sections on the patches.)
Sanity-tested both back-ends *without* the "--network" switch as well.


Laszlo Ersek (3):
  launch-libvirt: place our virtio-net-pci device in slot 0x1e
  lib: extract NETWORK_ADDRESS and NETWORK_PREFIX as macros
  launch-libvirt: add virtio-net via the standard <interface> element

 lib/guestfs-internal.h | 18 ++++++++++++++++++
 lib/launch-direct.c    |  2 +-
 lib/launch-libvirt.c   | 34 ++++++++++++++++++++++++++++++----
 3 files changed, 49 insertions(+), 5 deletions(-)

base-commit: 4af6d68e2d8b856d91fa5527216ea3db04556086

More information about the Libguestfs mailing list