Skip to content

Commit bee1797

Browse files
committed
q-dev: fix conflicted attachments
1 parent 9bdeb52 commit bee1797

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

qubes/ext/utils.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,14 @@ def device_list_change(
8181
frontends[front_vm] = ass
8282
to_attach[device.port_id] = frontends
8383

84+
asyncio.ensure_future(resolve_conflicts_and_attach(ext, to_attach))
85+
86+
async def resolve_conflicts_and_attach(ext, to_attach):
8487
for port_id, frontends in to_attach.items():
8588
if len(frontends) > 1:
8689
# unique
8790
device = tuple(frontends.values())[0].device
88-
target_name = asyncio.ensure_future(
89-
confirm_device_attachment(device, frontends)).result()
91+
target_name = await confirm_device_attachment(device, frontends)
9092
for front in frontends:
9193
if front.name == target_name:
9294
target = front
@@ -101,8 +103,7 @@ def device_list_change(
101103
target = tuple(frontends.keys())[0]
102104
assignment = frontends[target]
103105

104-
asyncio.ensure_future(ext.attach_and_notify(target, assignment))
105-
106+
await ext.attach_and_notify(target, assignment)
106107

107108
def compare_device_cache(vm, devices_cache, current_devices):
108109
# compare cached devices and current devices, collect:

0 commit comments

Comments
 (0)