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 originatest 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(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 18 +++++-------------
src/qemu/qemu_process.c | 12 ++++++++++++
tests/domaincapsdata/qemu_4.2.0.ppc64.xml | 2 +-
.../qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 3 +++
4 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index e8b7d91062..9cffb07b9d 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5228,6 +5228,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
@@ -5247,17 +5252,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
@@ -5302,13 +5301,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
*/
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d42333195a..438c903578 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5644,6 +5644,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);
}
}
@@ -5668,6 +5674,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);
}
}
diff --git a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml
b/tests/domaincapsdata/qemu_4.2.0.ppc64.xml
index 4c3a2c6d98..7d3dd3c917 100644
--- a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml
+++ b/tests/domaincapsdata/qemu_4.2.0.ppc64.xml
@@ -138,7 +138,7 @@
<gic supported='no'/>
<vmcoreinfo supported='no'/>
<genid supported='no'/>
- <backingStoreInput supported='no'/>
+ <backingStoreInput supported='yes'/>
<backup supported='no'/>
<sev supported='no'/>
</features>
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
index cbdc1dd09a..702f6551a4 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
@@ -112,6 +112,7 @@
<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'/>
@@ -140,11 +141,13 @@
<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'/>
--
2.36.1