Skip to content

Commit

Permalink
Attempt to fix the rest of PCI device reordering
Browse files Browse the repository at this point in the history
  • Loading branch information
Vít Šesták authored and marmarek committed Oct 9, 2023
1 parent 14d6a1a commit accd564
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 41 deletions.
40 changes: 0 additions & 40 deletions qubes/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,46 +342,6 @@ def assignments(self, persistent=None):
:file:`qubes.xml`) or not. Device can also be in :file:`qubes.xml`,
but be temporarily detached.
:param bool persistent: only include devices which are or are not
attached persistently.
'''

try:
devices = self._vm.fire_event('device-list-attached:' + self._bus,
persistent=persistent)
except Exception: # pylint: disable=broad-except
self._vm.log.exception('Failed to list {} devices'.format(
self._bus))
if persistent is True:
# don't break app.save()
return self._set
raise
result = set()
for dev, options in devices:
if dev in self._set and not persistent:
continue
if dev in self._set:
result.add(self._set.get(dev))
elif dev not in self._set and persistent:
continue
else:
result.add(
DeviceAssignment(
backend_domain=dev.backend_domain,
ident=dev.ident, options=options,
bus=self._bus))
if persistent is not False:
result.update(self._set)
return result

def assignments_list(self, persistent: Optional[bool]=None):
'''List assignments for devices which are (or may be) attached to the
vm.
Devices may be attached persistently (so they are included in
:file:`qubes.xml`) or not. Device can also be in :file:`qubes.xml`,
but be temporarily detached.
:param Optional[bool] persistent: only include devices which are or are not
attached persistently.
'''
Expand Down
2 changes: 1 addition & 1 deletion qubes/vm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def __xml__(self):
for devclass in self.devices:
devices = lxml.etree.Element('devices')
devices.set('class', devclass)
for device in self.devices[devclass].assignments_list(persistent=True):
for device in self.devices[devclass].assignments(persistent=True):
node = lxml.etree.Element('device')
node.set('backend-domain', device.backend_domain.name)
node.set('id', device.ident)
Expand Down

0 comments on commit accd564

Please sign in to comment.