diff --git a/qubes/devices.py b/qubes/devices.py index 108bdb9b..1fce57f4 100644 --- a/qubes/devices.py +++ b/qubes/devices.py @@ -195,7 +195,11 @@ class DeviceCollection(object): def attached(self): '''List devices which are (or may be) attached to this vm ''' - return self._vm.fire_event('device-list-attached:' + self._class) or [] + attached = self._vm.fire_event('device-list-attached:' + self._class) + if attached: + return [dev for dev, _ in attached] + + return [] def persistent(self): ''' Devices persistently attached and safe to access before libvirt @@ -218,7 +222,7 @@ class DeviceCollection(object): devices = self._vm.fire_event('device-list-attached:' + self._class, persistent=persistent) result = [] - for dev in devices: + for dev, options in devices: if dev in self._set and persistent is False: continue elif dev in self._set: @@ -228,7 +232,7 @@ class DeviceCollection(object): else: result.append( DeviceAssignment(backend_domain=dev.backend_domain, - ident=dev.ident, options=dev.options, + ident=dev.ident, options=options, frontend_domain=self._vm)) if persistent is not False and len(result) == 0: result.extend(self._set) diff --git a/qubes/ext/pci.py b/qubes/ext/pci.py index 1dc471ff..416e3bee 100644 --- a/qubes/ext/pci.py +++ b/qubes/ext/pci.py @@ -212,7 +212,7 @@ class PCIDeviceExtension(qubes.ext.Extension): device=device, function=function, ) - yield PCIDevice(vm.app.domains[0], ident) + yield (PCIDevice(vm.app.domains[0], ident), {}) @qubes.ext.handler('device-pre-attach:pci') def on_device_pre_attached_pci(self, vm, event, device): diff --git a/qubes/tests/devices.py b/qubes/tests/devices.py index e0184a75..3f104725 100644 --- a/qubes/tests/devices.py +++ b/qubes/tests/devices.py @@ -60,7 +60,7 @@ class TestVM(qubes.tests.TestEmitter): def dev_testclass_list_attached(self, event, persistent = False): for vm in self.app.domains: if vm.device.frontend_domain == self: - yield vm.device + yield (vm.device, {}) @qubes.events.handler('device-list:testclass') def dev_testclass_list(self, event):