Merge branch 'fixes-20171019'

* fixes-20171019:
  tools: fix handling qvm-run --no-autostart
  backup: improve migrating templates from Qubes 3.x
This commit is contained in:
Marek Marczykowski-Górecki 2017-10-21 04:10:02 +02:00
commit 7f269770d5
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
4 changed files with 37 additions and 4 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,

View File

@ -404,3 +404,19 @@ class TC_00_qvm_run(qubesadmin.tests.QubesTestCase):
('test-vm', 'qubes.VMShell', b'command; exit\n'),
])
self.assertAllCalled()
def test_013_no_autostart(self):
self.app.expected_calls[
('dom0', 'admin.vm.List', None, None)] = \
b'0\x00test-vm class=AppVM state=Running\n' \
b'test-vm2 class=AppVM state=Running\n' \
b'test-vm3 class=AppVM state=Halted\n'
self.app.expected_calls[
('test-vm3', 'admin.vm.List', None, None)] = \
b'0\x00test-vm3 class=AppVM state=Halted\n'
ret = qubesadmin.tools.qvm_run.main(
['--no-gui', '--no-autostart', 'test-vm3', 'command'],
app=self.app)
self.assertEqual(ret, 0)
self.assertEqual(self.app.service_calls, [])
self.assertAllCalled()

View File

@ -41,7 +41,7 @@ parser.add_argument('--autostart', '--auto', '-a',
help='option ignored, this is default')
parser.add_argument('--no-autostart', '--no-auto', '-n',
action='store_false',
action='store_false', dest='autostart',
help='do not autostart qube')
parser.add_argument('--pass-io', '-p',