Pārlūkot izejas kodu

pci: use device attach options for disabling strict reset

Since we have now per-device options, it's more logical to use it here,
instead of features with device identifier encoded into feature name.
Marek Marczykowski-Górecki 7 gadi atpakaļ
vecāks
revīzija
402afa1925
3 mainītis faili ar 5 papildinājumiem un 3 dzēšanām
  1. 1 1
      qubes/ext/pci.py
  2. 1 1
      templates/libvirt/devices/pci.xml
  3. 3 1
      templates/libvirt/xen.xml

+ 1 - 1
qubes/ext/pci.py

@@ -233,7 +233,7 @@ class PCIDeviceExtension(qubes.ext.Extension):
             self.bind_pci_to_pciback(vm.app, device)
             vm.libvirt_domain.attachDevice(
                 vm.app.env.get_template('libvirt/devices/pci.xml').render(
-                    device=device, vm=vm))
+                    device=device, vm=vm, options=options))
         except subprocess.CalledProcessError as e:
             vm.log.exception('Failed to attach PCI device {!r} on the fly,'
                 ' changes will be seen after VM restart.'.format(

+ 1 - 1
templates/libvirt/devices/pci.xml

@@ -1,5 +1,5 @@
 <hostdev type="pci" managed="yes"
-{% if vm.features.get('pci-no-strict-reset/' + device.ident, False) %}
+{% if options.get('no-strict-reset', False) %}
  nostrictreset="yes"
 {% endif %}
 >

+ 3 - 1
templates/libvirt/xen.xml

@@ -106,7 +106,9 @@
                 {% include 'libvirt/devices/net.xml' with context %}
             {% endif %}
 
-            {% for device in vm.devices.pci.persistent() %}
+            {% for assignment in vm.devices.pci.assignments(True) %}
+                {% set device = assignment.device %}
+                {% set options = assignment.options %}
                 {% include 'libvirt/devices/pci.xml' %}
             {% endfor %}