From aa931fdbf73fcd0952a0176873f9e6b174b35491 Mon Sep 17 00:00:00 2001 From: Rusty Bird Date: Fri, 28 Jun 2019 10:29:34 +0000 Subject: [PATCH] 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). --- qubes/vm/qubesvm.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index e69c1661..50542a56 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -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, ):