Avoid removing nonexistent snapshots

Store retain_snapshot in JSON and use that to check during delete.
This commit is contained in:
Joshua Boniface 2023-10-24 01:32:18 -04:00
parent 714bde89e6
commit 83b937654c
1 changed files with 10 additions and 8 deletions

View File

@ -1468,6 +1468,7 @@ def backup_vm(
"type": backup_type,
"datestring": datestring,
"incremental_parent": incremental_parent,
"retained_snapshot": retain_snapshot,
"vm_detail": vm_detail,
"backup_files": [
(f"{domain}.{datestring}.pvcdisks/{p}.{v}.{export_fileext}", s)
@ -1561,6 +1562,7 @@ def remove_backup(zkhandler, domain, backup_path, datestring):
is_snapshot_remove_failed = False
which_snapshot_remove_failed = list()
msg_snapshot_remove_failed = list()
if backup_source_details["retained_snapshot"]:
for volume_file, _ in backup_source_details.get("backup_files"):
pool, volume, _ = volume_file.split("/")[-1].split(".")
snapshot = f"backup_{datestring}"