From a58c1d5a8ca04a55c41f77251f6d8dbb6b18fb5e Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 17 Oct 2023 12:02:24 -0400 Subject: [PATCH] Fix bad snapshot removals --- daemon-common/vm.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/daemon-common/vm.py b/daemon-common/vm.py index 6e1d7120..20604291 100644 --- a/daemon-common/vm.py +++ b/daemon-common/vm.py @@ -1434,7 +1434,7 @@ def backup_vm( "backup_files": [f".{datestring}/{v}.{export_fileext}" for p, v in vm_volumes], } with open(f"{vm_target_root}/{domain}.{datestring}.pvcbackup", "w") as fh: - jdump(fh, vm_backup) + jdump(vm_backup, fh) # 8. Remove snapshots if retain_snapshot is False if not retain_snapshots: @@ -1452,12 +1452,9 @@ def backup_vm( msg_snapshot_remove_failed.append(retmsg) if is_snapshot_remove_failed: - for pool, volume in vm_volumes: - if ceph.verifySnapshot(zkhandler, pool, volume, snapshot_name): - ceph.remove_snapshot(zkhandler, pool, volume, snapshot_name) - return ( - True, - f'WARNING: Successfully backed up VM {domain} @ {datestring} to {target_path}, but failed to remove snapshot as requested for volume(s) {", ".join(which_snapshot_remove_failed)}: {", ".join(msg_snapshot_remove_failed)}', - ) + return ( + True, + f'WARNING: Successfully backed up VM {domain} @ {datestring} to {target_path}, but failed to remove snapshot as requested for volume(s) {", ".join(which_snapshot_remove_failed)}: {", ".join(msg_snapshot_remove_failed)}', + ) return True, f"Successfully backed up VM {domain} @ {datestring} to {target_path}"