The config is used both with the preparation and execution functions, so
we can store it in the context to simplify other helpers.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_snapshot.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index b93b9b9fb0..def2733958 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -896,6 +896,8 @@ struct _qemuSnapshotDiskContext {
virJSONValue *actions;
+ virQEMUDriverConfig *cfg;
+
/* needed for automatic cleanup of 'dd' */
virDomainObj *vm;
qemuDomainAsyncJob asyncJob;
@@ -909,11 +911,14 @@ qemuSnapshotDiskContextNew(size_t ndisks,
virDomainObj *vm,
qemuDomainAsyncJob asyncJob)
{
+ qemuDomainObjPrivate *priv = vm->privateData;
+ virQEMUDriver *driver = priv->driver;
qemuSnapshotDiskContext *ret = g_new0(qemuSnapshotDiskContext, 1);
ret->dd = g_new0(qemuSnapshotDiskData, ndisks);
ret->actions = virJSONValueNewArray();
ret->vm = vm;
+ ret->cfg = virQEMUDriverGetConfig(driver);
ret->asyncJob = asyncJob;
return ret;
@@ -930,6 +935,8 @@ qemuSnapshotDiskContextCleanup(qemuSnapshotDiskContext *snapctxt)
qemuSnapshotDiskCleanup(snapctxt->dd, snapctxt->ndd, snapctxt->vm,
snapctxt->asyncJob);
+ virObjectUnref(snapctxt->cfg);
+
g_free(snapctxt);
}
--
2.31.1