summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-07-29 16:39:16 +0300
committerLars Wirzenius <liw@liw.fi>2017-07-29 16:39:16 +0300
commite98b49eaf6fb08de3136fa36474d7a702c16abe0 (patch)
tree27e86a26cb734b882104c63c88815a21e17d7354
parented246d7f61486be6bf902a2da2b419fda56e74cc (diff)
downloadvmdb2-e98b49eaf6fb08de3136fa36474d7a702c16abe0.tar.gz
Add: mount can set mount points in mounted filesystems
-rw-r--r--vmdb/plugins/mount_plugin.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/vmdb/plugins/mount_plugin.py b/vmdb/plugins/mount_plugin.py
index 0b06401..47a0466 100644
--- a/vmdb/plugins/mount_plugin.py
+++ b/vmdb/plugins/mount_plugin.py
@@ -48,11 +48,28 @@ class MountStepRunner(vmdb.StepRunnerInterface):
part_tag = step['mount']
fs_tag = step['fs-tag']
+ dirname = step.get('dirname')
+ mount_on = step.get('mount-on')
+
if fs_tag in state.mounts:
raise Exception('fs-tag {} already used'.format(fs_tag))
+ if dirname:
+ if not mount_on:
+ raise Exception('no mount-on tag given')
+
+ if mount_on not in state.mounts:
+ raise Exception('cannot find tag {}'.format(mount_on))
+
+ mount_point = os.path.join(
+ state.mounts[mount_on], './' + step['dirname'])
+
+ if not os.path.exists(mount_point):
+ os.makedirs(mount_point)
+ else:
+ mount_point = tempfile.mkdtemp()
+
device = state.parts[part_tag]
- mount_point = tempfile.mkdtemp()
vmdb.runcmd(['mount', device, mount_point])
state.mounts[fs_tag] = mount_point