Set template field before check its correctness.

Backup from Aplha3 with updateable VMs contains case, when updateable VM have template.
So set this template (to make qvm-backup-restore working), but give error message.

Also fix typo.
This commit is contained in:
Marek Marczykowski 2011-04-01 02:06:22 +02:00
parent 97403a8e45
commit 156778fcd7

View File

@ -237,10 +237,11 @@ class QubesVm(object):
self.memory = memory self.memory = memory
self.template_vm = template_vm
if template_vm is not None: if template_vm is not None:
if updateable: if updateable:
print "ERROR: Template based VM cannot be updateable!" print "ERROR: Template based VM cannot be updateable!"
return false return False
if not template_vm.is_template(): if not template_vm.is_template():
print "ERROR: template_qid={0} doesn't point to a valid TemplateVM".\ print "ERROR: template_qid={0} doesn't point to a valid TemplateVM".\
format(template_vm.qid) format(template_vm.qid)
@ -250,8 +251,6 @@ class QubesVm(object):
else: else:
assert self.root_img is not None, "Missing root_img for standalone VM!" assert self.root_img is not None, "Missing root_img for standalone VM!"
self.template_vm = template_vm
# By default allow use all VCPUs # By default allow use all VCPUs
if vcpus is None: if vcpus is None:
qubes_host = QubesHost() qubes_host = QubesHost()