All supported QEMUs now accept werror/rerror as argument for the frontend disk device, so we can remove the old code. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_command.c | 34 +++++++--------------------------- src/qemu/qemu_command.h | 3 +-- src/qemu/qemu_hotplug.c | 3 +-- 3 files changed, 9 insertions(+), 31 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5db9d6c041..fed17891af 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2036,8 +2036,7 @@ qemuBuildDiskGetErrorPolicy(virDomainDiskDef *disk, static char * -qemuBuildDriveStr(virDomainDiskDef *disk, - virQEMUCaps *qemuCaps) +qemuBuildDriveStr(virDomainDiskDef *disk) { g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER; int detect_zeroes = virDomainDiskGetDetectZeroesMode(disk->discard, @@ -2058,20 +2057,6 @@ qemuBuildDriveStr(virDomainDiskDef *disk, virDiskNameToIndex(disk->dst)); } - /* werror/rerror are really frontend attributes, but older - * qemu requires them on -drive instead of -device */ - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_STORAGE_WERROR)) { - const char *wpolicy = NULL; - const char *rpolicy = NULL; - - qemuBuildDiskGetErrorPolicy(disk, &wpolicy, &rpolicy); - - if (wpolicy) - virBufferAsprintf(&opt, ",werror=%s", wpolicy); - if (rpolicy) - virBufferAsprintf(&opt, ",rerror=%s", rpolicy); - } - if (disk->src->readonly) virBufferAddLit(&opt, ",readonly=on"); @@ -2307,8 +2292,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, serial = virBufferContentAndReset(&buf); } - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_STORAGE_WERROR)) - qemuBuildDiskGetErrorPolicy(disk, &wpolicy, &rpolicy); + qemuBuildDiskGetErrorPolicy(disk, &wpolicy, &rpolicy); if (virJSONValueObjectAdd(&props, "S:device_id", scsiVPDDeviceId, @@ -2588,7 +2572,7 @@ qemuBuildDiskSourceCommandLine(virCommand *cmd, !(copyOnReadProps = qemuBlockStorageGetCopyOnReadProps(disk))) return -1; } else { - if (!(data = qemuBuildStorageSourceChainAttachPrepareDrive(disk, qemuCaps))) + if (!(data = qemuBuildStorageSourceChainAttachPrepareDrive(disk))) return -1; } @@ -10892,20 +10876,18 @@ qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu) /** * qemuBuildStorageSourceAttachPrepareDrive: * @disk: disk object to prepare - * @qemuCaps: qemu capabilities object * * Prepare qemuBlockStorageSourceAttachData *for use with the old approach * using -drive/drive_add. See qemuBlockStorageSourceAttachPrepareBlockdev. */ static qemuBlockStorageSourceAttachData * -qemuBuildStorageSourceAttachPrepareDrive(virDomainDiskDef *disk, - virQEMUCaps *qemuCaps) +qemuBuildStorageSourceAttachPrepareDrive(virDomainDiskDef *disk) { g_autoptr(qemuBlockStorageSourceAttachData) data = NULL; data = g_new0(qemuBlockStorageSourceAttachData, 1); - if (!(data->driveCmd = qemuBuildDriveStr(disk, qemuCaps)) || + if (!(data->driveCmd = qemuBuildDriveStr(disk)) || !(data->driveAlias = qemuAliasDiskDriveFromDisk(disk))) return NULL; @@ -10987,20 +10969,18 @@ qemuBuildStorageSourceAttachPrepareCommon(virStorageSource *src, /** * qemuBuildStorageSourceChainAttachPrepareDrive: * @disk: disk definition - * @qemuCaps: qemu capabilities object * * Prepares qemuBlockStorageSourceChainData *for attaching @disk via -drive. */ qemuBlockStorageSourceChainData * -qemuBuildStorageSourceChainAttachPrepareDrive(virDomainDiskDef *disk, - virQEMUCaps *qemuCaps) +qemuBuildStorageSourceChainAttachPrepareDrive(virDomainDiskDef *disk) { g_autoptr(qemuBlockStorageSourceAttachData) elem = NULL; g_autoptr(qemuBlockStorageSourceChainData) data = NULL; data = g_new0(qemuBlockStorageSourceChainData, 1); - if (!(elem = qemuBuildStorageSourceAttachPrepareDrive(disk, qemuCaps))) + if (!(elem = qemuBuildStorageSourceAttachPrepareDrive(disk))) return NULL; if (qemuBuildStorageSourceAttachPrepareCommon(disk->src, elem) < 0) diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index d84de3f093..a653ff7218 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -110,8 +110,7 @@ qemuBuildStorageSourceAttachPrepareCommon(virStorageSource *src, qemuBlockStorageSourceChainData * -qemuBuildStorageSourceChainAttachPrepareDrive(virDomainDiskDef *disk, - virQEMUCaps *qemuCaps); +qemuBuildStorageSourceChainAttachPrepareDrive(virDomainDiskDef *disk); qemuBlockStorageSourceChainData * diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index d9ba0b7abe..274f47c25d 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -770,8 +770,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver, } } else { - if (!(data = qemuBuildStorageSourceChainAttachPrepareDrive(disk, - priv->qemuCaps))) + if (!(data = qemuBuildStorageSourceChainAttachPrepareDrive(disk))) return -1; } -- 2.35.1