When daemon is restarted and libvirt tries to recover domain jobs we need to know if the snapshot job was a snapshot delete in order to safely abort running QEMU block jobs. Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- src/qemu/qemu_domain.c | 23 +++++++++++++++++++++++ src/qemu/qemu_domain.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 73dc13e178..7be431dd19 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -197,6 +197,15 @@ qemuDomainObjPrivateXMLFormatMigrateTempBitmap(virBuffer *buf, } +static void +qemuDomainFormatJobPrivateSnapshot(virBuffer *buf, + qemuDomainJobPrivate *priv) +{ + if (priv->snapshotDelete) + virBufferAddLit(buf, "<snapshotDelete/>\n"); +} + + static int qemuDomainFormatJobPrivate(virBuffer *buf, virDomainJobObj *job, @@ -214,6 +223,9 @@ qemuDomainFormatJobPrivate(virBuffer *buf, if (priv->migParams) qemuMigrationParamsFormat(buf, priv->migParams); + if (job->asyncJob == VIR_ASYNC_JOB_SNAPSHOT) + qemuDomainFormatJobPrivateSnapshot(buf, priv); + return 0; } @@ -340,6 +352,15 @@ qemuDomainObjPrivateXMLParseMigrateTempBitmap(qemuDomainJobPrivate *jobPriv, } +static void +qemuDomainParseJobPrivateSnapshot(xmlXPathContextPtr ctxt, + qemuDomainJobPrivate *priv) +{ + if (virXPathNode("./snapshotDelete", ctxt)) + priv->snapshotDelete = true; +} + + static int qemuDomainParseJobPrivate(xmlXPathContextPtr ctxt, virDomainJobObj *job, @@ -356,6 +377,8 @@ qemuDomainParseJobPrivate(xmlXPathContextPtr ctxt, if (qemuMigrationParamsParse(ctxt, &priv->migParams) < 0) return -1; + qemuDomainParseJobPrivateSnapshot(ctxt, priv); + return 0; } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index e34d52c033..4b0593d5db 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -550,6 +550,8 @@ struct _qemuDomainJobPrivate { * should wait for it to finish */ bool spiceMigrated; /* spice migration completed */ bool dumpCompleted; /* dump completed */ + bool snapshotDelete; /* indicate that snapshot job is + * deleting snapshot */ qemuMigrationParams *migParams; GSList *migTempBitmaps; /* temporary block dirty bitmaps - qemuDomainJobPrivateMigrateTempBitmap */ }; -- 2.39.0