ext/pci: use correct backend domain for getting PCIDevice instance

In practice backend_domain is ignored (all PCI devices belongs to dom0),
but lets fix this anyway.
This commit is contained in:
Marek Marczykowski-Górecki 2018-11-01 22:21:50 +01:00
parent 15cf593bc5
commit 00ca0459d9
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -234,7 +234,7 @@ class PCIDeviceExtension(qubes.ext.Extension):
return return
try: try:
device = _cache_get(vm, device.ident) device = _cache_get(device.backend_domain, device.ident)
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(
@ -254,7 +254,7 @@ class PCIDeviceExtension(qubes.ext.Extension):
# provision in libvirt for extracting device-side BDF; we need it for # provision in libvirt for extracting device-side BDF; we need it for
# qubes.DetachPciDevice, which unbinds driver, not to oops the kernel # qubes.DetachPciDevice, which unbinds driver, not to oops the kernel
device = _cache_get(vm, device.ident) device = _cache_get(device.backend_domain, device.ident)
p = subprocess.Popen(['xl', 'pci-list', str(vm.xid)], p = subprocess.Popen(['xl', 'pci-list', str(vm.xid)],
stdout=subprocess.PIPE) stdout=subprocess.PIPE)
result = p.communicate()[0].decode() result = p.communicate()[0].decode()
@ -282,7 +282,7 @@ class PCIDeviceExtension(qubes.ext.Extension):
def on_domain_pre_start(self, vm, _event, **_kwargs): def on_domain_pre_start(self, vm, _event, **_kwargs):
# Bind pci devices to pciback driver # Bind pci devices to pciback driver
for assignment in vm.devices['pci'].persistent(): for assignment in vm.devices['pci'].persistent():
device = _cache_get(vm, assignment.ident) device = _cache_get(assignment.backend_domain, assignment.ident)
self.bind_pci_to_pciback(vm.app, device) self.bind_pci_to_pciback(vm.app, device)
@staticmethod @staticmethod