Skip to content

Commit

Permalink
q-dev: get parent device directly from vm
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrbartman committed Jun 12, 2024
1 parent 3313291 commit 9e52556
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions qubes/ext/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,12 @@ def parent_device(self) -> Optional[qubes.device_protocol.Device]:
devclass = 'usb' if sep == ':' else 'block'
if not parent_ident:
return None
self._parent = qubes.device_protocol.Device(
self.backend_domain, parent_ident, devclass=devclass)
try:
self._parent = (
self.backend_domain.devices)[devclass][parent_ident]
except KeyError:
self._parent = qubes.device_protocol.UnknownDevice(
self.backend_domain, parent_ident, devclass=devclass)
self._interface_num = interface_num
return self._parent

Expand Down

0 comments on commit 9e52556

Please sign in to comment.