]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: capabilities: Unconditionally set QEMU_CAPS_BLOCKDEV/QEMU_CAPS_BLOCKDEV_HOSTDEV...
authorPeter Krempa <pkrempa@redhat.com>
Fri, 15 Jul 2022 14:58:34 +0000 (16:58 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 11 Aug 2022 12:38:31 +0000 (14:38 +0200)
The cleanup of the code to always assume support for QEMU_CAPS_BLOCKDEV
will not be simple, so for now we hardcode the support and the code will
be cleaned up gradually.

We also disallow users to clear the flags via the namespace property or
qemu.conf configuration.

The change to the PPC64 test data originates from the fact that the
capability dump is not from the release version but is lacking one of
the necessary flags to enable -blockdev.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_capabilities.c
src/qemu/qemu_process.c
tests/domaincapsdata/qemu_4.2.0.ppc64.xml
tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml

index 20b019ba4a8f18bedf6fe1218b50e24043626af8..d88f01745714f3088bfde11132753617183013e5 100644 (file)
@@ -5227,6 +5227,11 @@ virQEMUCapsInitQMPBasicArch(virQEMUCaps *qemuCaps)
 static void
 virQEMUCapsInitQMPVersionCaps(virQEMUCaps *qemuCaps)
 {
+    /* While the removal of pre-blockdev code is in progress we always hard-code
+     * the support for QEMU_CAPS_BLOCKDEV */
+    virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKDEV);
+    virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI);
+
     /* -enable-fips is deprecated in QEMU 5.2.0, and QEMU
      * should be built with gcrypt to achieve FIPS compliance
      * automatically / implicitly
@@ -5246,17 +5251,11 @@ virQEMUCapsInitQMPVersionCaps(virQEMUCaps *qemuCaps)
 void
 virQEMUCapsInitProcessCapsInterlock(virQEMUCaps *qemuCaps)
 {
-    if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV))
-        virQEMUCapsClear(qemuCaps, QEMU_CAPS_BLOCKDEV_BACKUP);
-
     if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_BACKUP) &&
         virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN) &&
         virQEMUCapsGet(qemuCaps, QEMU_CAPS_MIGRATION_PARAM_BLOCK_BITMAP_MAPPING))
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP);
 
-    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV))
-        virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI);
-
     /* The -compat qemu command line argument is implemented using a newer
      * method which doesn't show up in query-command-line-options. As we'll use
      * it only for development and testing purposes we can base the capability
@@ -5301,13 +5300,6 @@ virQEMUCapsInitProcessCaps(virQEMUCaps *qemuCaps)
     if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_UNAVAILABLE_FEATURES))
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_CANONICAL_CPU_FEATURES);
 
-    /* To avoid guest ABI regression, blockdev shall be enabled only when
-     * we are able to pass the custom 'device_id' for SCSI disks and cdroms. */
-    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCK_FILE_AUTO_READONLY_DYNAMIC) &&
-        virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_DEVICE_ID) &&
-        virQEMUCapsGet(qemuCaps, QEMU_CAPS_SAVEVM_MONITOR_NODES))
-        virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKDEV);
-
     /* We can't probe "esp" as a type via virQEMUCapsObjectTypes
      * array as it is only usable when builtin to the machine type
      */
index 9c773b06b07b8caec510369fd6fcf9335b51dad5..5f69c57fd42cebbf3fc09b01bc27edfafde29a85 100644 (file)
@@ -5623,6 +5623,12 @@ qemuProcessStartUpdateCustomCaps(virDomainObj *vm)
                 return -1;
             }
 
+            /* The code is being cleaned up to always assume the support for
+             * -blockdev thus we must no longer allow users to clear it */
+            if (tmp == QEMU_CAPS_BLOCKDEV ||
+                tmp == QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI)
+                continue;
+
             virQEMUCapsClear(priv->qemuCaps, tmp);
         }
     }
@@ -5647,6 +5653,12 @@ qemuProcessStartUpdateCustomCaps(virDomainObj *vm)
                 return -1;
             }
 
+            /* The code is being cleaned up to always assume the support for
+             * -blockdev thus we must no longer allow users to clear it */
+            if (tmp == QEMU_CAPS_BLOCKDEV ||
+                tmp == QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI)
+                continue;
+
             virQEMUCapsClear(priv->qemuCaps, tmp);
         }
     }
index e21ba9372b67f9dc947a532269dcac183570f33f..8ea7ad571430058823ba32cf110b06c81fa805c7 100644 (file)
     <gic supported='no'/>
     <vmcoreinfo supported='no'/>
     <genid supported='no'/>
-    <backingStoreInput supported='no'/>
+    <backingStoreInput supported='yes'/>
     <backup supported='no'/>
     <sev supported='no'/>
   </features>
index 8cba4628ee0f637a702bf5cc3c4d617490a7ae1a..4a165e5c6bb5e86b3b16bf3c47fc97f91fdfd079 100644 (file)
   <flag name='machine.pseries.cap-htm'/>
   <flag name='egl-headless'/>
   <flag name='vfio-pci.display'/>
+  <flag name='blockdev'/>
   <flag name='memory-backend-memfd'/>
   <flag name='memory-backend-memfd.hugetlb'/>
   <flag name='iothread.poll-max-ns'/>
   <flag name='tcg'/>
   <flag name='pvscsi'/>
   <flag name='spapr-tpm-proxy'/>
+  <flag name='blockdev-hostdev-scsi'/>
   <flag name='dc390'/>
   <flag name='am53c974'/>
   <flag name='vhost-user-blk'/>
   <flag name='cpu-max'/>
   <flag name='memory-backend-file.x-use-canonical-path-for-ramblock-id'/>
+  <flag name='blockdev-backup'/>
   <flag name='rotation-rate'/>
   <flag name='input-linux'/>
   <flag name='query-display-options'/>