mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
qemu_domain: store snapshotDelete in qemuDomainJobPrivate
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@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
565bcb5d79
commit
f474e80ac3
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 */
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user