[libvirt] [PATCH 12/34] conf: Add possibility to format full chain with virDomainStorageSourceFormatFull

Peter Krempa pkrempa at redhat.com
Mon Mar 18 15:55:01 UTC 2019


Add switch which will allow formating full chain.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/conf/domain_conf.c | 11 ++++++++++-
 src/conf/domain_conf.h |  1 +
 src/qemu/qemu_domain.c |  2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b67f9bbd2c..fb98629c77 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -23910,6 +23910,7 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf,
  * @src: storage source to format
  * @elemname: name of the top level element to use
  * @status: output status-XML style private data
+ * @backingStore: output full backing chain of @src
  * @xmlopt: formatter callback data structure
  *
  * Formats @src into a XML element called @elemname. The element has both 'type'
@@ -23920,6 +23921,7 @@ virDomainStorageSourceFormatFull(virBufferPtr buf,
                                  virStorageSourcePtr src,
                                  const char *elemname,
                                  bool status,
+                                 bool backingStore,
                                  virDomainXMLOptionPtr xmlopt)
 {
     VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
@@ -23939,7 +23941,14 @@ virDomainStorageSourceFormatFull(virBufferPtr buf,
                                      true, true, 0, xmlopt) < 0)
         return -1;

-    return virXMLFormatElement(buf, elemname, &attrBuf, &childBuf);
+    if (virXMLFormatElement(buf, elemname, &attrBuf, &childBuf) < 0)
+        return -1;
+
+    if (backingStore && src->backingStore &&
+        virDomainDiskBackingStoreFormat(buf, src->backingStore, xmlopt, flags) < 0)
+        return -1;
+
+    return 0;
 }


diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index b373dbf939..0bdd6c0f55 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3465,6 +3465,7 @@ virDomainStorageSourceFormatFull(virBufferPtr buf,
                                  virStorageSourcePtr src,
                                  const char *elemname,
                                  bool status,
+                                 bool backingStore,
                                  virDomainXMLOptionPtr xmlopt)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 78287b4d3e..ea70979f8b 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2364,7 +2364,7 @@ qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPtr buf,

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

-- 
2.20.1




More information about the libvir-list mailing list