Merge git://git.qubes-os.org/joanna/core
This commit is contained in:
commit
2b78538376
@ -56,6 +56,9 @@ def main():
|
||||
usage = "usage: %prog [options] <backup-dir-path>"
|
||||
parser = OptionParser (usage)
|
||||
|
||||
parser.add_option ("-x", "--exclude", action="append", dest="exclude_list",
|
||||
help="Exclude the specified VM from backup (might be repeated)")
|
||||
|
||||
(options, args) = parser.parse_args ()
|
||||
|
||||
if (len (args) != 1):
|
||||
@ -73,7 +76,13 @@ def main():
|
||||
qvm_collection.lock_db_for_reading()
|
||||
qvm_collection.load()
|
||||
|
||||
|
||||
if options is not None and options.exclude_list is not None:
|
||||
print "Excluding the following VMs:", options.exclude_list
|
||||
vms_list = [vm for vm in qvm_collection.values() if vm.name not in options.exclude_list]
|
||||
else:
|
||||
vms_list = [vm for vm in qvm_collection.values()]
|
||||
|
||||
no_vms = len (vms_list)
|
||||
|
||||
files_to_backup = file_to_backup (qubes_store_filename)
|
||||
|
@ -113,6 +113,9 @@ def main():
|
||||
parser.add_option ("--ignore-missing", action="store_true", dest="ignore_missing", default=False,
|
||||
help="Ignore missing templates or netvms, restore VMs anyway")
|
||||
|
||||
parser.add_option ("--skip-conflicting", action="store_true", dest="skip_conflicting", default=False,
|
||||
help="Do not restore VMs that are already present on the host")
|
||||
|
||||
(options, args) = parser.parse_args ()
|
||||
|
||||
if (len (args) != 1):
|
||||
@ -186,7 +189,7 @@ def main():
|
||||
if host_collection.get_vm_by_name (vm.name) is not None:
|
||||
s += " <-- A VM with the same name already exists on the host!"
|
||||
there_are_conflicting_vms = True
|
||||
good_to_go = False
|
||||
good_to_go = False # Do not overwrite VMs on the host!
|
||||
|
||||
if vm.is_appvm():
|
||||
templatevm_name = vm.template_vm.name
|
||||
@ -224,9 +227,11 @@ def main():
|
||||
|
||||
if there_are_conflicting_vms:
|
||||
print "*** There VMs with conflicting names on the host! ***"
|
||||
if options.skip_conflicting:
|
||||
print "Those VMs will not be restored, the host VMs will not be overwritten!"
|
||||
else:
|
||||
print "Remove VMs with conflicting names from the host before proceeding."
|
||||
print "You can use 'qvm-remove <vmname>' command for this."
|
||||
print "Be careful! Think twice before typing qvm-remove!!!"
|
||||
print "... or use --skip-conflicting to restore only those VMs that do not exist on the host."
|
||||
exit (1)
|
||||
|
||||
print "The above VMs will be copied and added to your system."
|
||||
@ -241,7 +246,7 @@ def main():
|
||||
elif options.skip_broken:
|
||||
print "... VMs that depend on it will not be restored (--skip-broken used)"
|
||||
elif options.ignore_missing:
|
||||
print "... VMs that depend on it be restored anyway (--ignore-missing used)"
|
||||
print "... VMs that depend on it will be restored anyway (--ignore-missing used)"
|
||||
else:
|
||||
print "INTERNAL ERROR?!"
|
||||
exit (1)
|
||||
|
Loading…
Reference in New Issue
Block a user