Skip to content

Commit 8e90d90

Browse files
committed
q-dev: make devclass required
1 parent ac42e08 commit 8e90d90

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

qubesadmin/device_protocol.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ def serialize(self) -> bytes:
534534
('devclass', self.devclass)))
535535

536536
properties += b' ' + DeviceSerializer.pack_property(
537-
'backend_domain', self.backend_domain.name)
537+
'backend_domain', self.backend_name)
538538

539539
return properties
540540

@@ -1252,12 +1252,12 @@ def _deserialize(
12521252
return cls(**properties)
12531253

12541254
def matches(self, device: VirtualDevice) -> bool:
1255+
if self.devclass != device.devclass:
1256+
return False
12551257
if self.backend_domain != '*' and self.backend_domain != device.backend_domain:
12561258
return False
12571259
if self.port_id != '*' and self.port_id != device.port_id:
12581260
return False
1259-
if self.devclass != '*' and self.devclass != device.devclass:
1260-
return False
12611261
if self.device_id != '*' and self.device_id != device.device_id:
12621262
return False
12631263
return True

qubesadmin/tools/qvm_device.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def assign_device(args):
223223
if args.only_port:
224224
device.device_id = None
225225
if args.only_device:
226-
device.port = None
226+
device.port = Port(None, None, device.devclass)
227227
options = dict(opt.split('=', 1) for opt in args.option or [])
228228
if args.ro:
229229
options['read-only'] = 'yes'

0 commit comments

Comments
 (0)