From 660c224914c38391ebc0207ef9d81c65b2be01a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Thu, 27 Feb 2020 10:31:29 +0100 Subject: [PATCH] Allow AudioVM to be ran after any attached qubes --- qubes/ext/audio.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/qubes/ext/audio.py b/qubes/ext/audio.py index ff0c5f46..610fae6e 100644 --- a/qubes/ext/audio.py +++ b/qubes/ext/audio.py @@ -41,14 +41,6 @@ class AUDIO(qubes.ext.Extension): self, 'There are running VMs using this VM as AudioVM: ' '{}'.format(', '.join(vm.name for vm in attached_vms))) - @qubes.ext.handler('domain-pre-start') - def on_domain_pre_start(self, vm, event, start_guid, **kwargs): - if getattr(vm, 'audiovm', None): - if vm.audiovm.qid != 0: - if not vm.audiovm.is_running(): - yield from vm.audiovm.start(start_guid=start_guid, - notify_function=None) - @qubes.ext.handler('domain-init', 'domain-load') def on_domain_init_load(self, vm, event): if getattr(vm, 'audiovm', None): @@ -79,7 +71,7 @@ class AUDIO(qubes.ext.Extension): def on_domain_qdb_create(self, vm, event): # Add AudioVM Xen ID for gui-agent if getattr(vm, 'audiovm', None): - if vm != vm.audiovm: + if vm != vm.audiovm and vm.audiovm.is_running(): vm.untrusted_qdb.write('/qubes-audio-domain-xid', str(vm.audiovm.xid)) @@ -91,3 +83,11 @@ class AUDIO(qubes.ext.Extension): vm.fire_event('property-set:audiovm', name='audiovm', newvalue=newvalue, oldvalue=oldvalue) + + @qubes.ext.handler('domain-start') + def on_domain_start(self, vm, event, **kwargs): + attached_vms = [domain for domain in self.attached_vms(vm) if + domain.is_running()] + for attached_vm in attached_vms: + attached_vm.untrusted_qdb.write('/qubes-audio-domain-xid', + str(vm.xid))