summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-04-11 15:09:18 +0300
committerLars Wirzenius <liw@liw.fi>2020-04-11 15:09:18 +0300
commit10f283fb5b0d716be864c2e520b8e188d63d4f58 (patch)
tree79f0db7a8f9686b7da3ecd955d0e7b58ede057af
parenta52fbb7794bc4f851d37589993c092a22a230bb1 (diff)
downloadvmdb2-10f283fb5b0d716be864c2e520b8e188d63d4f58.tar.gz
Change: ignore umount failures
If umount fails, it can be for many reasons, but a common one is that the mount has already been undone, so we ignore the failure. It's not perfect, but good enough for now, I think.
-rw-r--r--vmdb/unmount.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/vmdb/unmount.py b/vmdb/unmount.py
index 1d9aaa5..8239f8c 100644
--- a/vmdb/unmount.py
+++ b/vmdb/unmount.py
@@ -22,10 +22,15 @@
# in /proc/mounts.
+import logging
+
+import cliapp
+
import vmdb
def unmount(what, mounts=None, real_unmount=None):
+ logging.debug('Unmounting {} and everything on top of it'.format(what))
if mounts is None: # pragma: no cover
mounts = _read_proc_mounts()
if real_unmount is None: # pragma: no cover
@@ -35,6 +40,7 @@ def unmount(what, mounts=None, real_unmount=None):
dirnames = _find_what_to_unmount(mounts, what)
for dirname in dirnames:
real_unmount(dirname)
+ logging.debug('Finishd unmounting {}'.format(what))
def _read_proc_mounts(): # pragma: no cover
@@ -43,7 +49,10 @@ def _read_proc_mounts(): # pragma: no cover
def _real_unmount(what): # pragma: no cover
- vmdb.runcmd(['umount', what])
+ try:
+ vmdb.runcmd(['umount', what])
+ except cliapp.AppException:
+ logging.info('unmount failed, but ignoring that')
def _parse_proc_mounts(text):