Browse Source

qubesvm: move storage.stop() to 'domain-shutdown' event handler

QubesOS/qubes-issues#2256
Marek Marczykowski-Górecki 7 years ago
parent
commit
838553baf8
1 changed files with 5 additions and 5 deletions
  1. 5 5
      qubes/vm/qubesvm.py

+ 5 - 5
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