Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions qubes/api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,13 @@ async def deviceclass_list(self):
scope='local', read=True)
async def vm_device_available(self, endpoint):
devclass = endpoint
devices = self.dest.devices[devclass].get_exposed_devices()
try:
devices = self.dest.devices[devclass].get_exposed_devices()
except AttributeError as e:
if e.name == 'devices':
# shutdown in progress, return specific error
raise qubes.exc.QubesException("qubesd shutdown in progress")
raise
if self.arg:
devices = [dev for dev in devices if dev.ident == self.arg]
# no duplicated devices, but device may not exist, in which case
Expand All @@ -1216,8 +1222,14 @@ async def vm_device_available(self, endpoint):
scope='local', read=True)
async def vm_device_list(self, endpoint):
devclass = endpoint
device_assignments = list(
self.dest.devices[devclass].get_assigned_devices())
try:
device_assignments = list(
self.dest.devices[devclass].get_assigned_devices())
except AttributeError as e:
if e.name == 'devices':
# shutdown in progress, return specific error
raise qubes.exc.QubesException("qubesd shutdown in progress")
raise
if self.arg:
select_backend, select_ident = self.arg.split('+', 1)
device_assignments = [dev for dev in device_assignments
Expand Down Expand Up @@ -1245,7 +1257,14 @@ async def vm_device_list(self, endpoint):
no_payload=True, scope='local', read=True)
async def vm_device_attached(self, endpoint):
devclass = endpoint
device_assignments = self.dest.devices[devclass].get_attached_devices()
try:
device_assignments = \
self.dest.devices[devclass].get_attached_devices()
except AttributeError as e:
if e.name == 'devices':
# shutdown in progress, return specific error
raise qubes.exc.QubesException("qubesd shutdown in progress")
raise
if self.arg:
select_backend, select_ident = self.arg.split('+', 1)
device_assignments = [dev for dev in device_assignments
Expand Down
3 changes: 2 additions & 1 deletion qubes/vm/adminvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import grp
import subprocess
import libvirt
import uuid

import qubes
import qubes.exc
Expand All @@ -45,7 +46,7 @@ class AdminVM(BaseVM):
default=0, type=int, setter=qubes.property.forbidden)

uuid = qubes.property('uuid',
default='00000000-0000-0000-0000-000000000000',
default=uuid.UUID('00000000-0000-0000-0000-000000000000'),
setter=qubes.property.forbidden)

default_dispvm = qubes.VMProperty('default_dispvm',
Expand Down