Don't allow attached PCI devices and virt_mode = 'pvh'

This commit is contained in:
HW42 2017-10-11 21:10:43 +02:00
parent ec4c7d7263
commit 67c06eb428
2 changed files with 7 additions and 0 deletions

View File

@ -225,6 +225,10 @@ class PCIDeviceExtension(qubes.ext.Extension):
raise qubes.exc.QubesException(
'Invalid PCI device: {}'.format(device.ident))
if vm.virt_mode == 'pvh':
raise qubes.exc.QubesException(
"Can't attach PCI device to VM in pvh mode")
if not vm.is_running():
return

View File

@ -96,6 +96,9 @@ def _setter_virt_mode(self, prop, value):
if value not in ('hvm', 'pv', 'pvh'):
raise qubes.exc.QubesPropertyValueError(self, prop, value,
'Invalid virtualization mode, supported values: hvm, pv, pvh')
if value == 'pvh' and list(self.devices['pci'].persistent()):
raise qubes.exc.QubesPropertyValueError(self, prop, value,
"pvh mode can't be set if pci devices are attached")
return value