backup: simplify ordering of restoring VMs

No other change than reducing two nested loops into one.
This commit is contained in:
Marek Marczykowski-Górecki 2016-04-04 22:06:21 +02:00 committed by Wojtek Porczyk
parent 20d53fbf69
commit 71a7730168

View File

@ -2110,16 +2110,12 @@ class BackupRestore(object):
return return
# First load templates, then other VMs # First load templates, then other VMs
for do_templates in (True, False): for vm in sorted(vms.values(), key=lambda x: x.is_template(),
if self.canceled: reverse=True):
break
for vm in vms.values():
if self.canceled: if self.canceled:
# only break the loop to save qubes.xml # only break the loop to save qubes.xml
# with already restored VMs # with already restored VMs
break break
if vm.is_template() != do_templates:
continue
self.log.info("-> Restoring {0}...".format(vm.name)) self.log.info("-> Restoring {0}...".format(vm.name))
retcode = subprocess.call( retcode = subprocess.call(
["mkdir", "-p", os.path.dirname(vm.dir_path)]) ["mkdir", "-p", os.path.dirname(vm.dir_path)])