summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2018-08-18 17:54:30 +0300
committerLars Wirzenius <liw@liw.fi>2018-08-18 18:09:15 +0300
commit6b13de4db058b27b4237a12e9db1742c60d46875 (patch)
tree203905c49721f5582cbd96e183a38b6d48374e8b
parent830dfba80df70ff0413b1a4723b38e429bee7200 (diff)
downloadvmdb2-6b13de4db058b27b4237a12e9db1742c60d46875.tar.gz
Change: use vmdb.unmount to unmount
-rw-r--r--vmdb/plugins/grub_plugin.py5
-rw-r--r--vmdb/plugins/mount_plugin.py6
-rw-r--r--vmdb/plugins/virtuals_plugin.py8
3 files changed, 14 insertions, 5 deletions
diff --git a/vmdb/plugins/grub_plugin.py b/vmdb/plugins/grub_plugin.py
index 1189e4e..406a492 100644
--- a/vmdb/plugins/grub_plugin.py
+++ b/vmdb/plugins/grub_plugin.py
@@ -187,7 +187,10 @@ class GrubStepRunner(vmdb.StepRunnerInterface):
mounts.reverse()
while mounts:
mount_point = mounts.pop()
- vmdb.runcmd(['umount', mount_point])
+ try:
+ vmdb.unmount(mount_point)
+ except vmdb.NotMounted as e:
+ logging.warning(str(e))
def get_image_loop_device(self, partition_device):
# We get /dev/mappers/loopXpY and return /dev/loopX
diff --git a/vmdb/plugins/mount_plugin.py b/vmdb/plugins/mount_plugin.py
index e8bdef1..2e478fe 100644
--- a/vmdb/plugins/mount_plugin.py
+++ b/vmdb/plugins/mount_plugin.py
@@ -80,6 +80,10 @@ class MountStepRunner(vmdb.StepRunnerInterface):
fs_tag = step['fs-tag']
mount_point = state.mounts[fs_tag]
- vmdb.runcmd(['umount', mount_point])
+ try:
+ vmdb.unmount(mount_point)
+ except vmdb.NotMounted as e:
+ logging.warning(str(e))
+
if not step.get('mount-on'):
os.rmdir(mount_point)
diff --git a/vmdb/plugins/virtuals_plugin.py b/vmdb/plugins/virtuals_plugin.py
index 60639ac..5ae5490 100644
--- a/vmdb/plugins/virtuals_plugin.py
+++ b/vmdb/plugins/virtuals_plugin.py
@@ -70,6 +70,8 @@ class VirtualFilesystemMountStepRunner(vmdb.StepRunnerInterface):
logging.debug('unmounting virtuals: %r', state.virtuals)
for mount_point in reversed(state.virtuals):
try:
- vmdb.runcmd(['umount', mount_point])
- except cliapp.AppException:
- vmdb.error('Something went wrong while unmounting. Ignoring.')
+ vmdb.unmount(mount_point)
+ except vmdb.NotFound as e:
+ logging.warning(str(e))
+ except cliapp.AppException:
+ vmdb.warning('Something went wrong while unmounting. Ignoring.')