[PATCH 04/25] qemu: driver: Use virDomainDiskDefParseSource in qemuDomainBlockCopy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 88ee9e5d5e..d908e95ba7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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;
 }
-- 
2.30.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux