]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: driver: Use virDomainDiskDefParseSource in qemuDomainBlockCopy
authorPeter Krempa <pkrempa@redhat.com>
Wed, 14 Apr 2021 14:43:22 +0000 (16:43 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 19 Apr 2021 12:43:58 +0000 (14:43 +0200)
qemuDomainBlockCopy needs just the source portion of the disk but uses
the disk parser for it. Since we have a specific function now, refactor
the code to avoid having to deal with the unused virDomainDiskDef.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_driver.c

index 88ee9e5d5e6b6637b339f5e6c5c410576ab68565..d908e95ba795f8cec4f9913ec199b35df733c903 100644 (file)
@@ -15273,7 +15273,6 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *disk, const char *destxml,
     unsigned long long bandwidth = 0;
     unsigned int granularity = 0;
     unsigned long long buf_size = 0;
-    virDomainDiskDef *diskdef = NULL;
     virStorageSource *dest = NULL;
     size_t i;
 
@@ -15326,18 +15325,14 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *disk, const char *destxml,
         }
     }
 
-    if (!(diskdef = virDomainDiskDefParse(destxml, driver->xmlopt,
-                                          VIR_DOMAIN_DEF_PARSE_INACTIVE |
-                                          VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)))
+    if (!(dest = virDomainDiskDefParseSource(destxml, driver->xmlopt,
+                                             VIR_DOMAIN_DEF_PARSE_INACTIVE)))
         goto cleanup;
 
-    dest = g_steal_pointer(&diskdef->src);
-
     ret = qemuDomainBlockCopyCommon(vm, dom->conn, disk, dest, bandwidth,
                                     granularity, buf_size, flags, false);
 
  cleanup:
-    virDomainDiskDefFree(diskdef);
     virDomainObjEndAPI(&vm);
     return ret;
 }