提交 ef6b88de 编写于 作者: P Peter Krempa

qemu: snapshot: Pass 'cfg' to external snapshot functions

The caller has it so there's no point in getting it again.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 6f15c82f
...@@ -15231,6 +15231,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, ...@@ -15231,6 +15231,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainMomentObjPtr snap, virDomainMomentObjPtr snap,
unsigned int flags, unsigned int flags,
virQEMUDriverConfigPtr cfg,
qemuDomainAsyncJob asyncJob) qemuDomainAsyncJob asyncJob)
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
...@@ -15240,7 +15241,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, ...@@ -15240,7 +15241,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
size_t i; size_t i;
bool persist = false; bool persist = false;
bool reuse = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT) != 0; bool reuse = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT) != 0;
virQEMUDriverConfigPtr cfg = NULL;
qemuDomainSnapshotDiskDataPtr diskdata = NULL; qemuDomainSnapshotDiskDataPtr diskdata = NULL;
virErrorPtr orig_err = NULL; virErrorPtr orig_err = NULL;
virDomainSnapshotDefPtr snapdef = virDomainSnapshotObjGetDef(snap); virDomainSnapshotDefPtr snapdef = virDomainSnapshotObjGetDef(snap);
...@@ -15256,8 +15256,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, ...@@ -15256,8 +15256,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
if (!(diskdata = qemuDomainSnapshotDiskDataCollect(driver, vm, snap, reuse))) if (!(diskdata = qemuDomainSnapshotDiskDataCollect(driver, vm, snap, reuse)))
goto cleanup; goto cleanup;
cfg = virQEMUDriverGetConfig(driver);
/* Based on earlier qemuDomainSnapshotPrepare, all disks in this list are /* Based on earlier qemuDomainSnapshotPrepare, all disks in this list are
* now either VIR_DOMAIN_SNAPSHOT_LOCATION_NONE, or * now either VIR_DOMAIN_SNAPSHOT_LOCATION_NONE, or
* VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL with a valid file name and * VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL with a valid file name and
...@@ -15344,7 +15342,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, ...@@ -15344,7 +15342,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
cleanup: cleanup:
qemuDomainSnapshotDiskDataFree(diskdata, snapdef->ndisks, driver, vm); qemuDomainSnapshotDiskDataFree(diskdata, snapdef->ndisks, driver, vm);
virJSONValueFree(actions); virJSONValueFree(actions);
virObjectUnref(cfg);
if (orig_err) { if (orig_err) {
virSetError(orig_err); virSetError(orig_err);
...@@ -15359,6 +15356,7 @@ static int ...@@ -15359,6 +15356,7 @@ static int
qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver, qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainMomentObjPtr snap, virDomainMomentObjPtr snap,
virQEMUDriverConfigPtr cfg,
unsigned int flags) unsigned int flags)
{ {
virObjectEventPtr event; virObjectEventPtr event;
...@@ -15371,7 +15369,6 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver, ...@@ -15371,7 +15369,6 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver,
bool memory_unlink = false; bool memory_unlink = false;
int thaw = 0; /* 1 if freeze succeeded, -1 if freeze failed */ int thaw = 0; /* 1 if freeze succeeded, -1 if freeze failed */
bool pmsuspended = false; bool pmsuspended = false;
virQEMUDriverConfigPtr cfg = NULL;
int compressed; int compressed;
char *compressedpath = NULL; char *compressedpath = NULL;
virQEMUSaveDataPtr data = NULL; virQEMUSaveDataPtr data = NULL;
...@@ -15442,7 +15439,6 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver, ...@@ -15442,7 +15439,6 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver,
JOB_MASK(QEMU_JOB_SUSPEND) | JOB_MASK(QEMU_JOB_SUSPEND) |
JOB_MASK(QEMU_JOB_MIGRATION_OP))); JOB_MASK(QEMU_JOB_MIGRATION_OP)));
cfg = virQEMUDriverGetConfig(driver);
if ((compressed = qemuGetCompressionProgram(cfg->snapshotImageFormat, if ((compressed = qemuGetCompressionProgram(cfg->snapshotImageFormat,
&compressedpath, &compressedpath,
"snapshot", false)) < 0) "snapshot", false)) < 0)
...@@ -15473,7 +15469,7 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver, ...@@ -15473,7 +15469,7 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver,
/* the domain is now paused if a memory snapshot was requested */ /* the domain is now paused if a memory snapshot was requested */
if ((ret = qemuDomainSnapshotCreateDiskActive(driver, vm, snap, flags, if ((ret = qemuDomainSnapshotCreateDiskActive(driver, vm, snap, flags, cfg,
QEMU_ASYNC_JOB_SNAPSHOT)) < 0) QEMU_ASYNC_JOB_SNAPSHOT)) < 0)
goto cleanup; goto cleanup;
...@@ -15532,7 +15528,6 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver, ...@@ -15532,7 +15528,6 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver,
virQEMUSaveDataFree(data); virQEMUSaveDataFree(data);
VIR_FREE(xml); VIR_FREE(xml);
VIR_FREE(compressedpath); VIR_FREE(compressedpath);
virObjectUnref(cfg);
if (memory_unlink && ret < 0) if (memory_unlink && ret < 0)
unlink(snapdef->file); unlink(snapdef->file);
...@@ -15771,7 +15766,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, ...@@ -15771,7 +15766,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
virDomainSnapshotObjGetDef(snap)->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) { virDomainSnapshotObjGetDef(snap)->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) {
/* external full system or disk snapshot */ /* external full system or disk snapshot */
if (qemuDomainSnapshotCreateActiveExternal(driver, if (qemuDomainSnapshotCreateActiveExternal(driver,
vm, snap, flags) < 0) vm, snap, cfg, flags) < 0)
goto endjob; goto endjob;
} else { } else {
/* internal full system */ /* internal full system */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册