From 18f976abe208bb755d647b7d3bdaad7a84864397 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 28 Apr 2021 14:12:39 +0200 Subject: [PATCH] qemuSnapshotDiskContext: Store virQEMUDriverConfig in the struct MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko Reviewed-by: Pavel Hrdina --- 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 4e666cdf41..b917a2924d 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); }