You need to sign in or sign up before continuing.
提交 96785030 编写于 作者: P Peter Krempa

qemu: snapshot: Always save config XML after qemuDomainSnapshotCreateDiskActive

If there's an offline config definition save it unconditionally even if
it was not modified.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 999e450c
...@@ -15157,13 +15157,11 @@ qemuDomainSnapshotUpdateDiskSourcesRenumber(virStorageSourcePtr src) ...@@ -15157,13 +15157,11 @@ qemuDomainSnapshotUpdateDiskSourcesRenumber(virStorageSourcePtr src)
/** /**
* qemuDomainSnapshotUpdateDiskSources: * qemuDomainSnapshotUpdateDiskSources:
* @dd: snapshot disk data object * @dd: snapshot disk data object
* @persist: set to true if persistent config of the VM was changed
* *
* Updates disk definition after a successful snapshot. * Updates disk definition after a successful snapshot.
*/ */
static void static void
qemuDomainSnapshotUpdateDiskSources(qemuDomainSnapshotDiskDataPtr dd, qemuDomainSnapshotUpdateDiskSources(qemuDomainSnapshotDiskDataPtr dd)
bool *persist)
{ {
if (!dd->src) if (!dd->src)
return; return;
...@@ -15185,7 +15183,6 @@ qemuDomainSnapshotUpdateDiskSources(qemuDomainSnapshotDiskDataPtr dd, ...@@ -15185,7 +15183,6 @@ qemuDomainSnapshotUpdateDiskSources(qemuDomainSnapshotDiskDataPtr dd,
if (dd->persistdisk) { if (dd->persistdisk) {
VIR_STEAL_PTR(dd->persistsrc->backingStore, dd->persistdisk->src); VIR_STEAL_PTR(dd->persistsrc->backingStore, dd->persistdisk->src);
VIR_STEAL_PTR(dd->persistdisk->src, dd->persistsrc); VIR_STEAL_PTR(dd->persistdisk->src, dd->persistsrc);
*persist = true;
} }
} }
...@@ -15234,7 +15231,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, ...@@ -15234,7 +15231,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
bool do_transaction = false; bool do_transaction = false;
int ret = 0; int ret = 0;
size_t i; size_t i;
bool persist = false;
bool reuse = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT) != 0; bool reuse = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT) != 0;
qemuDomainSnapshotDiskDataPtr diskdata = NULL; qemuDomainSnapshotDiskDataPtr diskdata = NULL;
virErrorPtr orig_err = NULL; virErrorPtr orig_err = NULL;
...@@ -15287,7 +15283,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, ...@@ -15287,7 +15283,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
virDomainAuditDisk(vm, dd->disk->src, dd->src, "snapshot", ret >= 0); virDomainAuditDisk(vm, dd->disk->src, dd->src, "snapshot", ret >= 0);
if (ret == 0) if (ret == 0)
qemuDomainSnapshotUpdateDiskSources(dd, &persist); qemuDomainSnapshotUpdateDiskSources(dd);
} }
if (ret < 0) if (ret < 0)
...@@ -15328,7 +15324,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, ...@@ -15328,7 +15324,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
} }
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0 || if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0 ||
(persist && virDomainSaveConfig(cfg->configDir, driver->caps, (vm->newDef && virDomainSaveConfig(cfg->configDir, driver->caps,
vm->newDef) < 0)) vm->newDef) < 0))
ret = -1; ret = -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册