[PATCH 17/24] virstoragetest: Don't rewrite the 'qcow2' image

Peter Krempa pkrempa at redhat.com
Thu Sep 9 08:49:17 UTC 2021


Create it with the appropriate backing file path rather than using
another instance of 'qemu-img rebase'.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 tests/virstoragetest.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 1ee7bb5230..9a7905e28d 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -132,18 +132,15 @@ testPrepImages(void)
     /* Create a qcow2 wrapping relative raw; later on, we modify its
      * metadata to test other configurations */
     virCommandFree(cmd);
-    cmd = virCommandNewArgList(qemuimg, "create", "-f", "qcow2", NULL);
-    virCommandAddArgFormat(cmd, "-obacking_file=raw,backing_fmt=raw%s",
-                           compat ? ",compat=0.10" : "");
+    cmd = virCommandNewArgList(qemuimg, "create",
+                               "-f", "qcow2",
+                               "-F", "raw",
+                               "-b", absraw, NULL);
+    if (compat)
+        virCommandAddArgList(cmd, "-o", "compat=0.10", NULL);
     virCommandAddArg(cmd, "qcow2");
     if (virCommandRun(cmd, NULL) < 0)
         goto skip;
-    /* Make sure our later uses of 'qemu-img rebase' will work */
-    virCommandFree(cmd);
-    cmd = virCommandNewArgList(qemuimg, "rebase", "-u", "-f", "qcow2",
-                               "-F", "raw", "-b", absraw, "qcow2", NULL);
-    if (virCommandRun(cmd, NULL) < 0)
-        goto skip;

     /* Create a second qcow2 wrapping the first, to be sure that we
      * can correctly avoid insecure probing.  */
-- 
2.31.1




More information about the libvir-list mailing list