Skip to content

Commit

Permalink
q-dev: update api
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrbartman committed May 26, 2024
1 parent a853de9 commit 6c57e91
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 4 additions & 6 deletions qui/devices/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,8 @@ def attach_to_vm(self, vm: VM):
Perform attachment to provided VM.
"""
try:
assignment = qubesadmin.devices.DeviceAssignment(
self.backend_domain, self.id_string,
persistent=False)
assignment = qubesadmin.device_protocol.DeviceAssignment(
self.backend_domain, self.id_string)

vm.vm_object.devices[self.device_class].attach(assignment)
self.gtk_app.emit_notification(
Expand Down Expand Up @@ -261,9 +260,8 @@ def detach_from_vm(self, vm: VM):
Gio.NotificationPriority.NORMAL,
notification_id=self.notification_id)
try:
assignment = qubesadmin.devices.DeviceAssignment(
self.backend_domain, self._ident,
persistent=False)
assignment = qubesadmin.device_protocol.DeviceAssignment(
self.backend_domain, self._ident)
vm.vm_object.devices[self.device_class].detach(assignment)
except qubesadmin.exc.QubesException as ex:
self.gtk_app.emit_notification(
Expand Down
5 changes: 3 additions & 2 deletions qui/devices/device_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ def initialize_dev_data(self):
for domain in self.qapp.domains:
for devclass in DEV_TYPES:
try:
for device in domain.devices[devclass].attached():
for device in domain.devices[devclass
].get_attached_devices():
dev = str(device)
if dev in self.devices:
# occassionally ghost UnknownDevices appear when a
Expand Down Expand Up @@ -227,7 +228,7 @@ def vm_start(self, vm, _event, **_kwargs):

for devclass in DEV_TYPES:
try:
for device in vm.devices[devclass].attached():
for device in vm.devices[devclass].get_attached_devices():
dev = str(device)
if dev in self.devices:
self.devices[dev].attachments.add(wrapped_vm)
Expand Down

0 comments on commit 6c57e91

Please sign in to comment.