virstoragetest: testPrepImages: Use 'qemu-img' to format 'raw' image

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:14:29 +02:00
parent 570455d6be
commit aa3b29f8fc
1 changed files with 6 additions and 6 deletions

View File

@ -86,9 +86,9 @@ static int
testPrepImages(void) testPrepImages(void)
{ {
int ret = EXIT_FAILURE; int ret = EXIT_FAILURE;
g_autoptr(virCommand) cmdraw = NULL;
g_autoptr(virCommand) cmdqcow2 = NULL; g_autoptr(virCommand) cmdqcow2 = NULL;
g_autoptr(virCommand) cmdwrap = NULL; g_autoptr(virCommand) cmdwrap = NULL;
g_autofree char *buf = NULL;
g_autofree char *absraw = g_strdup_printf("%s/raw", datadir); g_autofree char *absraw = g_strdup_printf("%s/raw", datadir);
g_autofree char *absqcow2 = g_strdup_printf("%s/qcow2", datadir); g_autofree char *absqcow2 = g_strdup_printf("%s/qcow2", datadir);
g_autofree char *qemuimg = virFindFileInPath("qemu-img"); g_autofree char *qemuimg = virFindFileInPath("qemu-img");
@ -111,11 +111,11 @@ testPrepImages(void)
goto cleanup; goto cleanup;
} }
buf = g_strdup_printf("%1024d", 0); cmdraw = virCommandNewArgList(qemuimg, "create",
if (virFileWriteStr("raw", buf, 0600) < 0) { "-f", "raw",
fprintf(stderr, "unable to create raw file\n"); absraw, "1k", NULL);
goto cleanup; if (virCommandRun(cmdraw, NULL) < 0)
} goto skip;
/* Create a qcow2 wrapping relative raw; later on, we modify its /* Create a qcow2 wrapping relative raw; later on, we modify its
* metadata to test other configurations */ * metadata to test other configurations */