From 838553baf87c2927afe5c9540cb114af011c3668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 27 Apr 2017 00:45:08 +0200 Subject: [PATCH] qubesvm: move storage.stop() to 'domain-shutdown' event handler QubesOS/qubes-issues#2256 --- qubes/vm/qubesvm.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index 06ab69c1..b03672c8 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -901,6 +901,11 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): return self + @qubes.events.handler('domain-shutdown') + def on_domain_shutdown(self, _event, **_kwargs): + '''Cleanup after domain shutdown''' + asyncio.ensure_future(self.storage.stop()) + @asyncio.coroutine def shutdown(self, force=False, wait=False): '''Shutdown domain. @@ -916,9 +921,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): self.libvirt_domain.shutdown() - # FIXME: move to libvirt domain destroy event handler - yield from self.storage.stop() - while wait and not self.is_halted(): yield from asyncio.sleep(0.25) @@ -936,8 +938,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): raise qubes.exc.QubesVMNotStartedError(self) self.libvirt_domain.destroy() - # FIXME: move to libvirt domain destroy event handler - yield from self.storage.stop() return self