vm/qubesvm: default to PVH unless PCI devices are assigned

Fixes QubesOS/qubes-issues#2185
This commit is contained in:
Marek Marczykowski-Górecki 2018-01-15 03:25:10 +01:00
parent d9da747ab0
commit 4ff53879a0
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -99,6 +99,11 @@ def _setter_virt_mode(self, prop, value):
"pvh mode can't be set if pci devices are attached")
return value
def _default_virt_mode(self):
if self.devices['pci'].persistent():
return 'hvm'
return 'pvh'
class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
'''Base functionality of Qubes VM shared between all VMs.
@ -385,9 +390,9 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
virt_mode = qubes.property('virt_mode',
type=str, setter=_setter_virt_mode,
default='hvm',
default=_default_virt_mode,
doc='''Virtualisation mode: full virtualisation ("hvm"),
or paravirtualisation ("pv")''')
or paravirtualisation ("pv"), or hybrid ("pvh")''')
installed_by_rpm = qubes.property('installed_by_rpm',
type=bool, setter=qubes.property.bool,