backup: simplify ordering of restoring VMs
No other change than reducing two nested loops into one.
This commit is contained in:
parent
20d53fbf69
commit
71a7730168
@ -2110,16 +2110,12 @@ class BackupRestore(object):
|
||||
return
|
||||
|
||||
# First load templates, then other VMs
|
||||
for do_templates in (True, False):
|
||||
if self.canceled:
|
||||
break
|
||||
for vm in vms.values():
|
||||
for vm in sorted(vms.values(), key=lambda x: x.is_template(),
|
||||
reverse=True):
|
||||
if self.canceled:
|
||||
# only break the loop to save qubes.xml
|
||||
# with already restored VMs
|
||||
break
|
||||
if vm.is_template() != do_templates:
|
||||
continue
|
||||
self.log.info("-> Restoring {0}...".format(vm.name))
|
||||
retcode = subprocess.call(
|
||||
["mkdir", "-p", os.path.dirname(vm.dir_path)])
|
||||
|
Loading…
Reference in New Issue
Block a user