[libvirt] [PATCH v2] Ignore virtio-mmio disks in qemuAssignDevicePCISlots()

Pavel Fedin p.fedin at samsung.com
Wed Sep 9 08:27:25 UTC 2015

Fixes the following error when attempting to add a disk with bus='virtio'
to a machine which actually supports virtio-mmio (caught with ARM virt):

virtio disk cannot have an address of type 'virtio-mmio'

The problem has been likely introduced by
e8d55172544c1fafe31a9e09346bdebca4f0d6f9. Before that
qemuAssignDevicePCISlots() was never called for ARM "virt" machine.

Signed-off-by: Pavel Fedin <p.fedin at samsung.com>
v1 => v2
- Added check for QEMU_CAPS_DEVICE_VIRTIO_MMIO, this leaves the
  error message for machines which actually do not support
  virtio-mmio. In this case the user may still attempt to add
  such a disk manually.
 src/qemu/qemu_command.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ec5e3d4..db21ee9 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2598,6 +2598,12 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
+        /* Also ignore virtio-mmio disks if our machine allows them */
+        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MMIO) &&
+            def->disks[i]->info.type ==
+            continue;
         if (def->disks[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
                            _("virtio disk cannot have an address of type '%s'"),

More information about the libvir-list mailing list