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

QubesOS/qubes-issues#2256
This commit is contained in:
Marek Marczykowski-Górecki 2017-04-27 00:45:08 +02:00
parent 0dfcaa63c9
commit 838553baf8
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -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