virstoragetest: Don't rewrite the 'qcow2' image

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-09-08 17:07:31 +02:00
parent 2d6bd113e2
commit b8732224a7

View File

@ -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. */