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

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

 



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.

To unittest this, the new element was only added to the active commit test,
the non-active commit test doesn't have the new element so as to test its
absence.

Signed-off-by: Pavel Mores <pmores@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c                               | 4 ++++
 tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml | 1 +
 2 files changed, 5 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 07bf8f5a54..f4cb0f9ea0 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;
diff --git a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
index 4f6930001e..5fd2ed1d78 100644
--- a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
+++ b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
@@ -242,6 +242,7 @@
       <disk dst='vde'/>
       <base node='libvirt-19-format'/>
       <top node='libvirt-17-format'/>
+      <deleteCommittedImages/>
     </blockjob>
     <blockjob name='create-libvirt-1337-storage' type='create' state='running'>
       <create mode='storage'/>
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[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