qubes/ext/pci: implement pci-no-strict-reset/BDF feature
Instead of old per-VM flag 'pci_strictreset', now implement this as per-device flag using features. To not fail on particular device assignment set 'pci-no-strict-reset/DEVICE-BDF' to True. For example 'pci-no-strict-reset/00:1b.0'. QubesOS/qubes-issues#2257
This commit is contained in:
parent
4d327fbc95
commit
93e88e0c22
@ -231,7 +231,7 @@ class PCIDeviceExtension(qubes.ext.Extension):
|
|||||||
self.bind_pci_to_pciback(vm.app, device)
|
self.bind_pci_to_pciback(vm.app, device)
|
||||||
vm.libvirt_domain.attachDevice(
|
vm.libvirt_domain.attachDevice(
|
||||||
vm.app.env.get_template('libvirt/devices/pci.xml').render(
|
vm.app.env.get_template('libvirt/devices/pci.xml').render(
|
||||||
device=device))
|
device=device, vm=vm))
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
vm.log.exception('Failed to attach PCI device {!r} on the fly,'
|
vm.log.exception('Failed to attach PCI device {!r} on the fly,'
|
||||||
' changes will be seen after VM restart.'.format(
|
' changes will be seen after VM restart.'.format(
|
||||||
@ -261,7 +261,7 @@ class PCIDeviceExtension(qubes.ext.Extension):
|
|||||||
user='root', input='00:{}'.format(vmdev))
|
user='root', input='00:{}'.format(vmdev))
|
||||||
vm.libvirt_domain.detachDevice(
|
vm.libvirt_domain.detachDevice(
|
||||||
vm.app.env.get_template('libvirt/devices/pci.xml').render(
|
vm.app.env.get_template('libvirt/devices/pci.xml').render(
|
||||||
device=device))
|
device=device, vm=vm))
|
||||||
except (subprocess.CalledProcessError, libvirt.libvirtError) as e:
|
except (subprocess.CalledProcessError, libvirt.libvirtError) as e:
|
||||||
vm.log.exception('Failed to detach PCI device {!r} on the fly,'
|
vm.log.exception('Failed to detach PCI device {!r} on the fly,'
|
||||||
' changes will be seen after VM restart.'.format(
|
' changes will be seen after VM restart.'.format(
|
||||||
|
@ -50,6 +50,7 @@ class TC_00_Devices_PCI(qubes.tests.SystemTestsMixin,
|
|||||||
label='red',
|
label='red',
|
||||||
)
|
)
|
||||||
self.vm.create_on_disk()
|
self.vm.create_on_disk()
|
||||||
|
self.vm.features['pci-no-strict-reset/' + pcidev] = True
|
||||||
self.app.save()
|
self.app.save()
|
||||||
|
|
||||||
def test_000_list(self):
|
def test_000_list(self):
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<hostdev type="pci" managed="yes">
|
<hostdev type="pci" managed="yes"
|
||||||
|
{% if vm.features.get('pci-no-strict-reset/' + device.ident, False) %}
|
||||||
|
nostrictreset="yes"
|
||||||
|
{% endif %}
|
||||||
|
>
|
||||||
<source>
|
<source>
|
||||||
<address
|
<address
|
||||||
bus="0x{{ device.bus }}"
|
bus="0x{{ device.bus }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user