summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-03-28 22:34:16 +0300
committerLars Wirzenius <liw@liw.fi>2017-03-28 22:34:16 +0300
commitccfd03d3a396f7d81b973b2dbe1ab4ed047d6c91 (patch)
treee86750f9d8178a6da87347ccd81991f238061e17
parent5fd629805e645ad63fa5f5185312a57db6e0dcb0 (diff)
downloadvmdb2-ccfd03d3a396f7d81b973b2dbe1ab4ed047d6c91.tar.gz
Use partition and filesystem tags
-rw-r--r--vmdb/plugins/mount_plugin.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/vmdb/plugins/mount_plugin.py b/vmdb/plugins/mount_plugin.py
index 4d8b6c1..a872dc7 100644
--- a/vmdb/plugins/mount_plugin.py
+++ b/vmdb/plugins/mount_plugin.py
@@ -36,29 +36,32 @@ class MountPlugin(cliapp.Plugin):
class MountStepRunner(vmdb.StepRunnerInterface):
def get_required_keys(self):
- return ['mount', 'tag']
+ return ['mount', 'fs-tag']
def run(self, step_spec, settings, state):
if not hasattr(state, 'mounts'):
state.mounts = {}
- device = step_spec['mount']
- tag = step_spec['tag']
- if tag in state.mounts:
- raise Exception('mount tag {} already used'.format(tag))
+ part_tag = step_spec['mount']
+ fs_tag = step_spec['fs-tag']
+ if fs_tag in state.mounts:
+ raise Exception('fs-tag {} already used'.format(fs_tag))
+ device = state.parts[part_tag]
mount_point = tempfile.mkdtemp()
+
sys.stdout.write(
- 'Mounting {} ({}) on {}\n'.format(device, tag, mount_point))
+ 'Mounting {} ({}) on {}\n'.format(device, fs_tag, mount_point))
cliapp.runcmd(['mount', device, mount_point])
- state.mounts[tag] = mount_point
+ state.mounts[fs_tag] = mount_point
def teardown(self, step_spec, settings, state):
- device = step_spec['mount']
- tag = step_spec['tag']
- mount_point = state.mounts[tag]
+ part_tag = step_spec['mount']
+ device = state.parts[part_tag]
+ fs_tag = step_spec['fs-tag']
+ mount_point = state.mounts[fs_tag]
sys.stdout.write(
- 'Unmounting {} ({}) from {}\n'.format(mount_point, tag, device))
+ 'Unmounting {} ({}) from {}\n'.format(mount_point, fs_tag, device))
cliapp.runcmd(['umount', mount_point])
os.rmdir(mount_point)