qvm-backup: automatically exclude destination VM from backup (#767)
This commit is contained in:
parent
8921df90d8
commit
16f8e46f68
@ -36,7 +36,8 @@ def main():
|
|||||||
usage = "usage: %prog [options] <backup-dir-path> [vmname ...]"
|
usage = "usage: %prog [options] <backup-dir-path> [vmname ...]"
|
||||||
parser = OptionParser (usage)
|
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)")
|
help="Exclude the specified VM from backup (might be repeated)")
|
||||||
parser.add_option ("--force-root", action="store_true", dest="force_root", default=False,
|
parser.add_option ("--force-root", action="store_true", dest="force_root", default=False,
|
||||||
help="Force to run, even with root privileges")
|
help="Force to run, even with root privileges")
|
||||||
@ -80,6 +81,11 @@ def main():
|
|||||||
if (len (args) > 1):
|
if (len (args) > 1):
|
||||||
vms = [qvm_collection.get_vm_by_name(vmname) for vmname in 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
|
files_to_backup = None
|
||||||
try:
|
try:
|
||||||
files_to_backup = backup_prepare(
|
files_to_backup = backup_prepare(
|
||||||
|
Loading…
Reference in New Issue
Block a user