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

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@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, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) continue; + /* Also ignore virtio-mmio disks if our machine allows them */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MMIO) && + def->disks[i]->info.type == + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO) + continue; + if (def->disks[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("virtio disk cannot have an address of type '%s'"), -- 1.9.5.msysgit.0

On Wed, Sep 09, 2015 at 11:27:25AM +0300, Pavel Fedin wrote:
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@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, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) continue;
+ /* Also ignore virtio-mmio disks if our machine allows them */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MMIO) && + def->disks[i]->info.type == + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO) + continue; +
There is no qemuCaps here, you have to pas it the whole way.
if (def->disks[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("virtio disk cannot have an address of type '%s'"), -- 1.9.5.msysgit.0

Hello!
There is no qemuCaps here, you have to pas it the whole way.
Damn, sorry, it went away in a3ecd63e928ff39d73c1c14b0fb3be8addbc977b. I use older version for my distro, and the patch seemed to be so simple, so i decided not to do even compile test :) Respinning... Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia

On Wed, Sep 09, 2015 at 11:27:25AM +0300, Pavel Fedin wrote:
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.
Adding a test case to qemuxml2argvtest would help us prevent that breakage in the future.
Signed-off-by: Pavel Fedin <p.fedin@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, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) continue;
+ /* Also ignore virtio-mmio disks if our machine allows them */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MMIO) &&
Please check that both 'make check' and 'make syntax-check' pass with your patch, as mentioned on our Hacking page: http://libvirt.org/hacking.html Jan
+ def->disks[i]->info.type == + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO) + continue; + if (def->disks[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("virtio disk cannot have an address of type '%s'"), -- 1.9.5.msysgit.0
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

Hello!
Adding a test case to qemuxml2argvtest would help us prevent that breakage in the future.
Yes, but the problem with this was that our test suite does not create qemuCapsCache which is required for the whole ARM-virt thing to function correctly. I posted a patch for this, still waiting for the review. Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia
participants (3)
-
Ján Tomko
-
Martin Kletzander
-
Pavel Fedin