diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h index 4097b33fd..8eb2dd3ad 100644 --- a/lib/guestfs-internal.h +++ b/lib/guestfs-internal.h @@ -172,6 +172,17 @@ cleanup_mutex_unlock (pthread_mutex_t **ptr) #define VIRTIO_DEVICE_NAME(type) type "-pci" #endif +/* Place the virtio-net controller in slot 0x1e on the root bus, on normal + * hardware with PCI. Refer to RHBZ#2034160. + */ +#ifdef HAVE_LIBVIRT_BACKEND +#if defined(__arm__) || defined(__s390x__) +#define VIRTIO_NET_PCI_ADDR "" +#else +#define VIRTIO_NET_PCI_ADDR ",addr=1e.0" +#endif +#endif + /* Guestfs handle and associated structures. */ /* State. */ diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c index 194530c49..9e8336938 100644 --- a/lib/launch-libvirt.c +++ b/lib/launch-libvirt.c @@ -1851,7 +1851,9 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g, } end_element (); start_element ("qemu:arg") { - attribute ("value", VIRTIO_DEVICE_NAME ("virtio-net") ",netdev=usernet"); + attribute ("value", (VIRTIO_DEVICE_NAME ("virtio-net") + ",netdev=usernet" + VIRTIO_NET_PCI_ADDR)); } end_element (); }