Skip to content

Commit

Permalink
q-dev: extend backward compatibility of attach --persistent
Browse files Browse the repository at this point in the history
If front-vm is down, we still want assignment
  • Loading branch information
piotrbartman committed Oct 14, 2024
1 parent 65f7311 commit 5fc60a7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion qubesadmin/tools/qvm_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,14 @@ def attach_device(args):
options['read-only'] = 'yes'
parse_ro_option_as_read_only(options)
assignment.options = options
vm.devices[args.devclass].attach(assignment)
try:
vm.devices[args.devclass].attach(assignment)
except qubesadmin.exc.QubesException as exc:
# backward compatibility
# if `--persistent` we ignore if attachment fails,
# we want at least assign device
if not args.required:
raise exc
# backward compatibility
if args.required:
vm.devices[args.devclass].assign(assignment)
Expand Down

0 comments on commit 5fc60a7

Please sign in to comment.