On 05/18/2018 07:29 AM, Peter Krempa wrote: > Allow saving various aspects necessary to do NBD migration via blockdev > by storing a 'virStorageSource' in the disk private data meant to store > the NBD target of migration. Along with this add code to parse and > format it into the status XML. > > Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> > --- > src/qemu/qemu_domain.c | 162 ++++++++++++++++++++++++++++++++++++++++++++++--- > src/qemu/qemu_domain.h | 1 + > 2 files changed, 156 insertions(+), 7 deletions(-) > > diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c > index 94a9c5d1bc..632c025bef 100644 > --- a/src/qemu/qemu_domain.c > +++ b/src/qemu/qemu_domain.c [...] > > @@ -2092,6 +2155,7 @@ qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf, > virBuffer attrBuf = VIR_BUFFER_INITIALIZER; > virBuffer childBuf = VIR_BUFFER_INITIALIZER; > qemuDomainJob job = priv->job.active; > + int ret = -1; > > if (!qemuDomainTrackJob(job)) > job = QEMU_JOB_NONE; > @@ -2115,13 +2179,23 @@ qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf, > if (priv->job.asyncJob != QEMU_ASYNC_JOB_NONE) > virBufferAsprintf(&attrBuf, " flags='0x%lx'", priv->job.apiFlags); > > - if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT) > - qemuDomainObjPrivateXMLFormatNBDMigration(&childBuf, vm); > + if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT && > + qemuDomainObjPrivateXMLFormatNBDMigration(&childBuf, vm) < 0) > + goto cleanup; > > if (priv->job.migParams) > qemuMigrationParamsFormat(&childBuf, priv->job.migParams); > > - return virXMLFormatElement(buf, "job", &attrBuf, &childBuf); > + if (virXMLFormatElement(buf, "job", &attrBuf, &childBuf) < 0) > + goto cleanup; > + > + ret = 0; > + > + cleanup: > + virBufferFreeAndReset(&attrBuf); > + virBufferFreeAndReset(&childBuf); So I assume the lack of FreeAndReset was existing prior to this patch since d8be0f4bc? > + > + return ret; > } > > > @@ -2367,12 +2441,79 @@ qemuDomainObjPrivateXMLParsePR(xmlXPathContextPtr ctxt, > } > > [...] John -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list