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

2019-12-10 Thread Peter Krempa
On Tue, Dec 10, 2019 at 17:25:40 +0100, Pavel Mores wrote:
> 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 
> ---
>  src/qemu/qemu_domain.c   | 4 
>  tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml | 1 +
>  2 files changed, 5 insertions(+)

Reviewed-by: Peter Krempa 

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



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

2019-12-10 Thread Pavel Mores
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 
---
 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 767790bfc0..27926c7670 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2586,6 +2586,8 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void 
*payload,
 virBufferAsprintf(, "\n", 
job->data.commit.top->nodeformat);
 if (job->data.commit.topparent)
 virBufferAsprintf(, "\n", 
job->data.commit.topparent->nodeformat);
+if (job->data.commit.deleteCommittedImages)
+virBufferAddLit(, "\n");
 break;
 
 case QEMU_BLOCKJOB_TYPE_CREATE:
@@ -3185,6 +3187,8 @@ 
qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qemuBlockJobDataPtr job,
  
"string(./base/@node)",
  
>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 67ab099bd9..b5d62fd4ab 100644
--- a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
+++ b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
@@ -242,6 +242,7 @@
   
   
   
+  
 
 
   
-- 
2.21.0

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