]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: command: Inline qemuBuildDiskFrontendAttributeErrorPolicy
authorPeter Krempa <pkrempa@redhat.com>
Mon, 14 Feb 2022 12:33:41 +0000 (13:33 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 15 Feb 2022 08:28:57 +0000 (09:28 +0100)
Commit dc481f11a61 which converted the function generating properties
for disk '-device' argument to JSON removed the only other use of
qemuBuildDiskFrontendAttributeErrorPolicy, so we can now inline it into
qemuBuildDriveStr.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_command.c

index 1abff4fcaaa82fea39f8db9713b17bfffbc835c0..2c963a72970dfb6b6de3230f8d93f1bec650355a 100644 (file)
@@ -2002,22 +2002,6 @@ qemuBuildDiskGetErrorPolicy(virDomainDiskDef *disk,
 }
 
 
-static void
-qemuBuildDiskFrontendAttributeErrorPolicy(virDomainDiskDef *disk,
-                                          virBuffer *buf)
-{
-    const char *wpolicy = NULL;
-    const char *rpolicy = NULL;
-
-    qemuBuildDiskGetErrorPolicy(disk, &wpolicy, &rpolicy);
-
-    if (wpolicy)
-        virBufferAsprintf(buf, ",werror=%s", wpolicy);
-    if (rpolicy)
-        virBufferAsprintf(buf, ",rerror=%s", rpolicy);
-}
-
-
 static char *
 qemuBuildDriveStr(virDomainDiskDef *disk,
                   virQEMUCaps *qemuCaps)
@@ -2043,8 +2027,17 @@ qemuBuildDriveStr(virDomainDiskDef *disk,
 
     /* werror/rerror are really frontend attributes, but older
      * qemu requires them on -drive instead of -device */
-    if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_STORAGE_WERROR))
-        qemuBuildDiskFrontendAttributeErrorPolicy(disk, &opt);
+    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");