On 10/18/19 11:11 AM, Peter Krempa wrote:
A backup blockjob needs to be able to notify the parent backup job
as
well as track all data to be able to clean up the bitmap and blockdev
used for the backup.
Add the data structure, job allocation function and status XML formatter
and parser.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
+++ b/src/qemu/qemu_domain.c
@@ -2564,6 +2564,16 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *payload,
break;
case QEMU_BLOCKJOB_TYPE_BACKUP:
+ virBufferEscapeString(&childBuf, "<bitmap
name='%s'/>\n", job->data.backup.bitmap);
+ virBufferAsprintf(&childBuf, "<backup
id='%d'/>\n", job->data.backup.jobid);
+ if (job->data.backup.store &&
+ qemuDomainObjPrivateXMLFormatBlockjobFormatSource(&childBuf,
+ "store",
+
job->data.backup.store,
+ data->xmlopt,
+ false) < 0)
output of <store> is optional...
+ return -1;
+
case QEMU_BLOCKJOB_TYPE_NONE:
case QEMU_BLOCKJOB_TYPE_INTERNAL:
case QEMU_BLOCKJOB_TYPE_LAST:
@@ -3174,6 +3184,17 @@
qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qemuBlockJobDataPtr job,
break;
case QEMU_BLOCKJOB_TYPE_BACKUP:
+ if (!(job->data.backup.bitmap =
virXPathString("string(./bitmap/@name)", ctxt)))
+ goto broken;
+
+ if (virXPathInt("string(./backup/@id)", ctxt,
&job->data.backup.jobid) < 0)
+ goto broken;
+
+ if (!(tmp = virXPathNode("./store", ctxt)) ||
+ !(job->data.backup.store =
qemuDomainObjPrivateXMLParseBlockjobChain(tmp, ctxt, xmlopt)))
+ goto broken;
... so shouldn't this be:
if ((tmp = ...) &&
!(store = ...))
so we don't goto broken when it is not present?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization:
qemu.org |
libvirt.org