backup: improve migrating templates from Qubes 3.x

In Qubes 3.x any PV template had qrexec-agent and gui-agent installed.
Adjust features appropriately while restoring them.
This commit is contained in:
Marek Marczykowski-Górecki 2017-10-19 14:54:30 +02:00
parent abc0d0063e
commit f89d67c3e3
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 20 additions and 3 deletions

View File

@ -302,6 +302,11 @@ class Core2Qubes(qubesadmin.backup.BackupApp):
vm.properties['provides_network'] = True
if vm_class_name == 'QubesNetVm':
vm.properties['netvm'] = None
if vm_class_name == 'QubesTemplateVm' or \
(vm_class_name == 'QubesAppVm' and vm.template is None):
# PV VMs in Qubes 3.x assumed gui-agent and qrexec-agent installed
vm.features['qrexec'] = True
vm.features['gui'] = True
if element.get('internal', False) == 'True':
vm.features['internal'] = True

View File

@ -159,7 +159,11 @@ parsed_qubes_xml_r2 = {
},
'devices': {},
'tags': set(),
'features': {'service.meminfo-writer': True},
'features': {
'service.meminfo-writer': True,
'qrexec': True,
'gui': True,
},
'template': None,
'backup_path': None,
'included_in_backup': False,
@ -320,7 +324,11 @@ parsed_qubes_xml_r2 = {
'properties': {'virt_mode': 'pv', 'maxmem': '1535'},
'devices': {},
'tags': set(),
'features': {'service.meminfo-writer': True},
'features': {
'service.meminfo-writer': True,
'qrexec': True,
'gui': True,
},
'template': None,
'backup_path': 'vm-templates/test-template-clone',
'included_in_backup': True,
@ -343,7 +351,11 @@ parsed_qubes_xml_r2 = {
'properties': {'virt_mode': 'pv', 'maxmem': '1535'},
'devices': {},
'tags': set(),
'features': {'service.meminfo-writer': True},
'features': {
'service.meminfo-writer': True,
'qrexec': True,
'gui': True,
},
'template': None,
'backup_path': 'appvms/test-standalonevm',
'included_in_backup': True,