[libvirt] [PATCH 3/4] qemu: block: store the delete flag in libvirtd's status XML

Pavel Mores pmores at redhat.com
Wed Nov 20 09:55:26 UTC 2019


Since blockcommit is asynchronous, libvirtd can be restarted while the
operation runs.  To ensure the information necessary to finish up the job
is not lost, serialisation to and deserialisation from the status XML is
added.

Signed-off-by: Pavel Mores <pmores at redhat.com>
---
 src/qemu/qemu_domain.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 262b74d1ab..dba287973c 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2512,6 +2512,8 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *payload,
                 virBufferAsprintf(&childBuf, "<top node='%s'/>\n", job->data.commit.top->nodeformat);
             if (job->data.commit.topparent)
                 virBufferAsprintf(&childBuf, "<topparent node='%s'/>\n", job->data.commit.topparent->nodeformat);
+            if (job->data.commit.deleteCommittedImages)
+                virBufferAddLit(&childBuf, "<deleteCommittedImages/>\n");
             break;
 
         case QEMU_BLOCKJOB_TYPE_CREATE:
@@ -3069,6 +3071,8 @@ qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qemuBlockJobDataPtr job,
                                                          "string(./base/@node)",
                                                          &job->data.commit.base,
                                                          ctxt);
+            if (virXPathNode("./deleteCommittedImages", ctxt))
+                job->data.commit.deleteCommittedImages = true;
             if (!job->data.commit.top ||
                 !job->data.commit.base)
                 goto broken;
-- 
2.21.0




More information about the libvir-list mailing list