qemu: capabilities: Unconditionally set QEMU_CAPS_BLOCKDEV/QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI

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>
This commit is contained in:
Peter Krempa 2022-07-15 16:58:34 +02:00
parent 78ad796a43
commit 9b54efb7cf
4 changed files with 21 additions and 14 deletions

View 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
*/

View 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);
}
}

View File

@ -141,7 +141,7 @@
<gic supported='no'/>
<vmcoreinfo supported='no'/>
<genid supported='no'/>
<backingStoreInput supported='no'/>
<backingStoreInput supported='yes'/>
<backup supported='no'/>
<sev supported='no'/>
</features>

View File

@ -111,6 +111,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'/>
@ -139,11 +140,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'/>