feat: update log_and_notify_run to calculate total backup size based on individual VM directories

This commit is contained in:
Rizqi 2026-06-27 03:07:47 +07:00
parent 9e5f6bfa24
commit eef3025abd

View File

@ -1034,6 +1034,15 @@ td:last-child{{color:#f8fafc}}
def log_and_notify_run(jid, info, start_time, end_time, status, run_dest):
vm_names = info.get('vm_names')
if vm_names:
# Sum of sizes of each VM's backup folder
run_timestamp = datetime.fromtimestamp(info.get('started', start_time)).strftime('%Y%m%d%H%M%S')
size_bytes = 0
for vm in vm_names:
vm_dest = os.path.join(info.get('dest', './backups'), vm, f"backup-{run_timestamp}")
size_bytes += get_dir_size(vm_dest)
else:
size_bytes = get_dir_size(run_dest) if run_dest else 0
duration = end_time - start_time