backups: fix VM size calculation
Count only files included in the backup, not all of them (so ignore temporary files etc).
This commit is contained in:
parent
f461c09d89
commit
7278102aef
@ -135,6 +135,7 @@ def backup_prepare(vms_list = None, exclude_list = None,
|
|||||||
s += fmt.format('-')
|
s += fmt.format('-')
|
||||||
print_callback(s)
|
print_callback(s)
|
||||||
|
|
||||||
|
files_to_backup_index = 0
|
||||||
for vm in vms_for_backup:
|
for vm in vms_for_backup:
|
||||||
if vm.is_template():
|
if vm.is_template():
|
||||||
# handle templates later
|
# handle templates later
|
||||||
@ -184,8 +185,13 @@ def backup_prepare(vms_list = None, exclude_list = None,
|
|||||||
else:
|
else:
|
||||||
s += fmt.format("AppVM" + (" + Sys" if vm.updateable else ""))
|
s += fmt.format("AppVM" + (" + Sys" if vm.updateable else ""))
|
||||||
|
|
||||||
|
vm_size = reduce(lambda x, y: x + y["size"],
|
||||||
|
files_to_backup[files_to_backup_index:],
|
||||||
|
0)
|
||||||
|
files_to_backup_index = len(files_to_backup)
|
||||||
|
|
||||||
fmt="{{0:>{0}}} |".format(fields_to_display[2]["width"] + 1)
|
fmt="{{0:>{0}}} |".format(fields_to_display[2]["width"] + 1)
|
||||||
s += fmt.format(size_to_human(vm.get_disk_utilization()))
|
s += fmt.format(size_to_human(vm_size))
|
||||||
|
|
||||||
if vm.is_running():
|
if vm.is_running():
|
||||||
s += " <-- The VM is running, please shut it down before proceeding with the backup!"
|
s += " <-- The VM is running, please shut it down before proceeding with the backup!"
|
||||||
|
Loading…
Reference in New Issue
Block a user