[libvirt] [PATCH RFC 10/39] qemu: process: clear QEMU_CAPS_BLOCKDEV for VMs where we can't support it

Peter Krempa posted 39 patches 7 years, 6 months ago
There is a newer version of this series
[libvirt] [PATCH RFC 10/39] qemu: process: clear QEMU_CAPS_BLOCKDEV for VMs where we can't support it
Posted by Peter Krempa 7 years, 6 months ago
SD cards are currently passed by using -drive only which would not be
compatible with using -blockdev fully.

Floppies at least in the case of the i440 machine type don't have a
reasonable qdev ID if -drive is not used and thus would not allow
queries and other operations. Since floppy drives are obsolete anyways
clear blockdev when using them.

Clear QEMU_CAPS_BLOCKDEV if the VM has such devices.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_process.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 27bd8b9465..8dd25e2736 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5884,6 +5884,16 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver,

     qemuProcessPrepareAllowReboot(vm);

+    /* clear the 'blockdev' capability for VMs which have disks that need
+     * -drive or which have floppies where we can't reliably get the QOM path */
+    for (i = 0; i < vm->def->ndisks; i++) {
+        if (qemuDiskBusNeedsDriveArg(vm->def->disks[i]->bus) ||
+            vm->def->disks[i]->bus == VIR_DOMAIN_DISK_BUS_FDC) {
+            virQEMUCapsClear(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
+            break;
+        }
+    }
+
     /*
      * Normally PCI addresses are assigned in the virDomainCreate
      * or virDomainDefine methods. We might still need to assign
-- 
2.16.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH RFC 10/39] qemu: process: clear QEMU_CAPS_BLOCKDEV for VMs where we can't support it
Posted by Ján Tomko 7 years, 6 months ago
On Wed, Jul 25, 2018 at 05:57:41PM +0200, Peter Krempa wrote:
>SD cards are currently passed by using -drive only which would not be
>compatible with using -blockdev fully.
>
>Floppies at least in the case of the i440 machine type don't have a
>reasonable qdev ID if -drive is not used and thus would not allow
>queries and other operations. Since floppy drives are obsolete anyways
>clear blockdev when using them.
>
>Clear QEMU_CAPS_BLOCKDEV if the VM has such devices.
>

Do you see any value in mentioning that this gets recorded in the status
XML?

>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/qemu/qemu_process.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list