[libvirt] [PATCH 04/34] qemu: domain: Replace qemuDomainObjPrivateXMLFormatNBDMigrationSource

Peter Krempa pkrempa at redhat.com
Mon Mar 18 15:54:53 UTC 2019


Use virDomainStorageSourceFormatFull which has the same functionality.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_domain.c | 43 ++++--------------------------------------
 1 file changed, 4 insertions(+), 39 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d25d9ab666..78287b4d3e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2341,47 +2341,11 @@ qemuDomainObjPrivateXMLFormatPR(virBufferPtr buf,
 }


-static int
-qemuDomainObjPrivateXMLFormatNBDMigrationSource(virBufferPtr buf,
-                                                virStorageSourcePtr src)
-{
-    VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
-    VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
-    VIR_AUTOCLEAN(virBuffer) privateDataBuf = VIR_BUFFER_INITIALIZER;
-    int ret = -1;
-
-    virBufferSetChildIndent(&childBuf, buf);
-    virBufferSetChildIndent(&privateDataBuf, &childBuf);
-
-    virBufferAsprintf(&attrBuf, " type='%s' format='%s'",
-                      virStorageTypeToString(src->type),
-                      virStorageFileFormatTypeToString(src->format));
-
-    if (virDomainStorageSourceFormat(&attrBuf, &childBuf, src,
-                                     VIR_DOMAIN_DEF_FORMAT_STATUS, true,
-                                     false, 0, NULL) < 0)
-        goto cleanup;
-
-    if (qemuStorageSourcePrivateDataFormat(src, &privateDataBuf) < 0)
-        goto cleanup;
-
-    if (virXMLFormatElement(&childBuf, "privateData", NULL, &privateDataBuf) < 0)
-        goto cleanup;
-
-    if (virXMLFormatElement(buf, "migrationSource", &attrBuf, &childBuf) < 0)
-        goto cleanup;
-
-    ret = 0;
-
- cleanup:
-    return ret;
-}
-
-
 static int
 qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPtr buf,
                                           virDomainObjPtr vm)
 {
+    qemuDomainObjPrivatePtr priv = vm->privateData;
     VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
     VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
     size_t i;
@@ -2399,8 +2363,9 @@ qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPtr buf,
                           disk->dst, diskPriv->migrating ? "yes" : "no");

         if (diskPriv->migrSource &&
-            qemuDomainObjPrivateXMLFormatNBDMigrationSource(&childBuf,
-                                                            diskPriv->migrSource) < 0)
+            virDomainStorageSourceFormatFull(&childBuf, diskPriv->migrSource,
+                                             "migrationSource", true,
+                                             priv->driver->xmlopt) < 0)
             goto cleanup;

         if (virXMLFormatElement(buf, "disk", &attrBuf, &childBuf) < 0)
-- 
2.20.1




More information about the libvir-list mailing list