qvm-backup: automatically exclude destination VM from backup (#767)

This commit is contained in:
Marek Marczykowski-Górecki 2014-01-15 05:51:18 +01:00
parent 8921df90d8
commit 16f8e46f68

View File

@ -36,7 +36,8 @@ def main():
usage = "usage: %prog [options] <backup-dir-path> [vmname ...]"
parser = OptionParser (usage)
parser.add_option ("-x", "--exclude", action="append", dest="exclude_list",
parser.add_option ("-x", "--exclude", action="append",
dest="exclude_list", default=[],
help="Exclude the specified VM from backup (might be repeated)")
parser.add_option ("--force-root", action="store_true", dest="force_root", default=False,
help="Force to run, even with root privileges")
@ -80,6 +81,11 @@ def main():
if (len (args) > 1):
vms = [qvm_collection.get_vm_by_name(vmname) for vmname in args[1:]]
if options.appvm:
print >>sys.stderr, ("WARNING: VM {} excluded because it's used to "
"store the backup.").format(options.appvm)
options.exclude_list.append(options.appvm)
files_to_backup = None
try:
files_to_backup = backup_prepare(