From 1ea7d15949ef9672b52a57f461ce18fb1ab5c06b Mon Sep 17 00:00:00 2001 From: Robin Sonnabend <robin.sonnabend@rwth-aachen.de> Date: Mon, 12 Jun 2017 18:41:47 +0200 Subject: [PATCH] Catch errors when unmounting snapshots --- lvmsnapshot.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lvmsnapshot.py b/lvmsnapshot.py index 29adae3..c2145b5 100644 --- a/lvmsnapshot.py +++ b/lvmsnapshot.py @@ -264,12 +264,15 @@ class Snapshot: def remove(self): logging.debug("removing snapshot {}".format(self.get_name())) - self.unmount() - remove_command = [ - "/sbin/lvremove", - self.get_full_volume() - ] - run_process(remove_command, check=True) + try: + self.unmount() + remove_command = [ + "/sbin/lvremove", + self.get_full_volume() + ] + run_process(remove_command, check=True) + except sp.CalledProcessError: + logging.warn("Removing {} failed".format(self.get_name())) def unmount(self): logging.debug("unmounting snapshot {}".format(self.get_name())) -- GitLab