[PATCH 16/17] qemu: Always assume QEMU_CAPS_STORAGE_WERROR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 134fa0a2b2..57c1f604a7 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2003,8 +2003,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,
@@ -2025,20 +2024,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");

@@ -2274,8 +2259,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,
@@ -2552,7 +2536,7 @@ qemuBuildDiskSourceCommandLine(virCommand *cmd,
             !(copyOnReadProps = qemuBlockStorageGetCopyOnReadProps(disk)))
             return -1;
     } else {
-        if (!(data = qemuBuildStorageSourceChainAttachPrepareDrive(disk, qemuCaps)))
+        if (!(data = qemuBuildStorageSourceChainAttachPrepareDrive(disk)))
             return -1;
     }

@@ -10847,20 +10831,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;

@@ -10942,20 +10924,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 c70bc361fd..fe5f7e46e4 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.34.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux