From e98b49eaf6fb08de3136fa36474d7a702c16abe0 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 29 Jul 2017 16:39:16 +0300 Subject: Add: mount can set mount points in mounted filesystems --- vmdb/plugins/mount_plugin.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1