Fix bad snapshot removals

This commit is contained in:
Joshua Boniface 2023-10-17 12:02:24 -04:00
parent a8e4b01b67
commit a58c1d5a8c
1 changed files with 5 additions and 8 deletions

View File

@ -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,9 +1452,6 @@ 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)}',