From 96bd73485277c3d168c427347d8fdf5485a3e911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 14 Dec 2017 21:57:59 +0100 Subject: [PATCH] storage/lvm: clean -snap LV on volume removal --- qubes/storage/lvm.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/qubes/storage/lvm.py b/qubes/storage/lvm.py index 59d3ea2a..8b76dd71 100644 --- a/qubes/storage/lvm.py +++ b/qubes/storage/lvm.py @@ -323,9 +323,12 @@ class ThinVolume(qubes.storage.Volume): def remove(self): assert self.vid - if self.is_dirty(): - cmd = ['remove', self._vid_snap] - qubes_lvm(cmd, self.log) + try: + if os.path.exists('/dev/' + self._vid_snap): + cmd = ['remove', self._vid_snap] + qubes_lvm(cmd, self.log) + except AttributeError: + pass self._remove_revisions(self.revisions.keys()) if not os.path.exists(self.path):