Skip to content

Commit 5ead756

Browse files
committed
q-dev: assign only device
1 parent 1ad66e5 commit 5ead756

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

qubesadmin/tools/qvm_device.py

+17-7
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,10 @@ def assign_device(args):
220220
"""
221221
vm = args.domains[0]
222222
device = args.device
223-
if args.port:
223+
if args.only_port:
224224
device.device_id = None
225+
if args.only_device:
226+
device.port = None
225227
options = dict(opt.split('=', 1) for opt in args.option or [])
226228
if args.ro:
227229
options['read-only'] = 'yes'
@@ -453,12 +455,20 @@ def get_parser(device_class=None):
453455
"be required to the qube's startup and then"
454456
" automatically attached)")
455457

456-
assign_parser.add_argument('--port',
457-
action='store_true',
458-
default=False,
459-
help="Ignore device presented identity and "
460-
"attach any device connected to the given "
461-
"port number")
458+
id_parser = assign_parser.add_mutually_exclusive_group()
459+
id_parser.add_argument('--port',
460+
dest='only_port',
461+
action='store_true',
462+
default=False,
463+
help="Ignore device presented identity and "
464+
"attach later any device connected "
465+
"to the given port")
466+
id_parser.add_argument('--device',
467+
dest='only_device',
468+
action='store_true',
469+
default=False,
470+
help="Ignore current port identity and "
471+
"attach this device connected to any port")
462472
attach_parser.set_defaults(func=attach_device)
463473
detach_parser.set_defaults(func=detach_device)
464474
assign_parser.set_defaults(func=assign_device)

0 commit comments

Comments
 (0)