diff --git a/core/qubesutils.py b/core/qubesutils.py index f4622970..89ddc740 100644 --- a/core/qubesutils.py +++ b/core/qubesutils.py @@ -964,19 +964,10 @@ def backup_prepare(base_backup_dir, vms_list = None, exclude_list = [], print_ca fmt="{{0:-^{0}}}-+".format(f["width"] + 1) s += fmt.format('-') print_callback(s) - # TODO: check at least if backing up to local drive - ''' - stat = os.statvfs(base_backup_dir) - backup_fs_free_sz = stat.f_bsize * stat.f_bavail - print_callback("") - if (total_backup_sz > backup_fs_free_sz): - raise QubesException("Not enough space available on the backup filesystem!") if (there_are_running_vms): raise QubesException("Please shutdown all VMs before proceeding.") - print_callback("-> Available space: {0}".format(size_to_human(backup_fs_free_sz))) - ''' return files_to_backup def backup_do(base_backup_dir, files_to_backup, progress_callback = None): diff --git a/qvm-tools/qvm-backup b/qvm-tools/qvm-backup index 46d48096..b8ddac61 100755 --- a/qvm-tools/qvm-backup +++ b/qvm-tools/qvm-backup @@ -75,6 +75,19 @@ def main(): print >>sys.stderr, "ERROR: %s" % str(e) exit(1) + total_backup_sz = reduce(lambda size, file: size+file["size"], + files_to_backup, 0) + + if not options.appvm: + stat = os.statvfs(base_backup_dir) + backup_fs_free_sz = stat.f_bsize * stat.f_bavail + print + if (total_backup_sz > backup_fs_free_sz): + print >>sys.stderr, "ERROR: Not enough space available on the backup filesystem!" + exit(1) + + print "-> Available space: {0}".format(size_to_human(backup_fs_free_sz)) + prompt = raw_input ("Do you want to proceed? [y/N] ") if not (prompt == "y" or prompt == "Y"): exit (0)