vm/qubesvm: call storage.remove() *before* removing dir_path

Give the varlibqubes storage pool, which places volume images inside the
VM directory, a chance to remove them (and e.g. to log that).
This commit is contained in:
Rusty Bird 2019-06-28 10:29:34 +00:00
parent cfa1c7171e
commit aa931fdbf7
No known key found for this signature in database
GPG Key ID: 469D78F47AAF2ADF

View File

@ -1623,11 +1623,13 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
yield from self.fire_event_async('domain-remove-from-disk')
try:
# TODO: make it async?
shutil.rmtree(self.dir_path)
except FileNotFoundError:
pass
yield from self.storage.remove()
yield from self.storage.remove()
finally:
try:
# TODO: make it async?
shutil.rmtree(self.dir_path)
except FileNotFoundError:
pass
@asyncio.coroutine
def clone_disk_files(self, src, pool=None, pools=None, ):