Fix bad snapshot removals
This commit is contained in:
parent
a8e4b01b67
commit
a58c1d5a8c
|
@ -1434,7 +1434,7 @@ def backup_vm(
|
||||||
"backup_files": [f".{datestring}/{v}.{export_fileext}" for p, v in vm_volumes],
|
"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:
|
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
|
# 8. Remove snapshots if retain_snapshot is False
|
||||||
if not retain_snapshots:
|
if not retain_snapshots:
|
||||||
|
@ -1452,9 +1452,6 @@ def backup_vm(
|
||||||
msg_snapshot_remove_failed.append(retmsg)
|
msg_snapshot_remove_failed.append(retmsg)
|
||||||
|
|
||||||
if is_snapshot_remove_failed:
|
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 (
|
return (
|
||||||
True,
|
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)}',
|
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)}',
|
||||||
|
|
Loading…
Reference in New Issue