qubes/backup: misc fixes

Fix restoring ProxyVM and NetVM from core2. Use correct VM class.
This commit is contained in:
Marek Marczykowski-Górecki 2016-10-05 01:58:11 +02:00
parent 339c47480e
commit 33fecd90c1
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 8 additions and 4 deletions

View File

@ -2100,11 +2100,10 @@ class BackupRestore(object):
"updbl": {"func": "'Yes' if vm.updateable else ''"},
"template": {"func": "'n/a' if not hasattr(vm, 'template') is None "
"template": {"func": "'n/a' if not hasattr(vm, 'template') "
"else vm_info.template"},
"netvm": {"func": "'n/a' if vm.provides_network else\
('*' if vm.property_is_default('netvm') else '') +\
"netvm": {"func": "('*' if vm.property_is_default('netvm') else '') +\
vm_info.netvm if vm_info.netvm is not None "
"else '-'"},
@ -2409,8 +2408,9 @@ class BackupRestore(object):
try:
# first only minimal set, later clone_properties
# will be called
cls = self.app.get_vm_class(vm.__class__.__name__)
new_vm = self.app.add_new_vm(
vm.__class__,
cls,
name=vm_name,
label=vm.label,
installed_by_rpm=False,

View File

@ -180,6 +180,10 @@ class Core2Qubes(qubes.Qubes):
"true":
kwargs[attr] = value
kwargs['hvm'] = "HVm" in vm_class_name
kwargs['provides_network'] = \
vm_class_name in ('QubesNetVm', 'QubesProxyVm')
if vm_class_name == 'QubesNetVm':
kwargs['netvm'] = None
vm = self.add_new_vm(vm_class,
qid=int(element.get('qid')), **kwargs)
services = element.get('services')