Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/qemu/qemu_snapshot.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index cbacb05c16..787186605f 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -2284,11 +2284,12 @@ qemuSnapshotChildrenReparent(void *payload,
static int
qemuSnapshotDiscardMetadata(virDomainObj *vm,
virDomainMomentObj *snap,
- virQEMUDriver *driver)
+ virQEMUDriver *driver,
+ bool update_parent)
{
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
- if (snap->nchildren) {
+ if (update_parent && snap->nchildren) {
virQEMUMomentReparent rep;
rep.dir = cfg->snapshotDir;
@@ -2351,10 +2352,8 @@ qemuSnapshotDiscard(virQEMUDriver *driver,
}
}
- if (update_parent &&
- qemuSnapshotDiscardMetadata(vm, snap, driver) < 0) {
+ if (qemuSnapshotDiscardMetadata(vm, snap, driver, update_parent) < 0)
return -1;
- }
snapFile = g_strdup_printf("%s/%s/%s.xml", cfg->snapshotDir,
vm->def->name,
snap->def->name);
--
2.37.2