diff options
author | Lars Wirzenius <liw@liw.fi> | 2017-06-17 21:54:49 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2017-06-18 15:55:14 +0300 |
commit | 6bfab5d29937989deca5a2c4eed5d98ab2690849 (patch) | |
tree | b1a22acb02cfb859ceec1716e389414e72f3b76b /vmdb/plugins/mount_plugin.py | |
parent | 0d7a471bb90436f05fa06fd886b37f211ece5d4c (diff) | |
download | vmdb2-6bfab5d29937989deca5a2c4eed5d98ab2690849.tar.gz |
Fix: move virtual fs mounting to its own step
Can't mount them until after debootstrap is finished or things break.
Diffstat (limited to 'vmdb/plugins/mount_plugin.py')
-rw-r--r-- | vmdb/plugins/mount_plugin.py | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/vmdb/plugins/mount_plugin.py b/vmdb/plugins/mount_plugin.py index da038ad..0b06401 100644 --- a/vmdb/plugins/mount_plugin.py +++ b/vmdb/plugins/mount_plugin.py @@ -17,7 +17,6 @@ -import logging import os import tempfile @@ -34,25 +33,13 @@ class MountPlugin(cliapp.Plugin): class MountStepRunner(vmdb.StepRunnerInterface): - virtuals = [ - ['none', '/proc', 'proc'], - ['none', '/dev', 'devtmpfs'], - ['none', '/dev/pts', 'devpts'], - ['none', '/dev/shm', 'tmpfs'], - ['none', '/run', 'tmpfs'], - ['none', '/run/lock', 'tmpfs'], - ['none', '/sys', 'sysfs'], - ] - def get_required_keys(self): return ['mount', 'fs-tag'] def run(self, step, settings, state): - rootfs = self.mount_rootfs(step, settings, state) - self.mount_virtuals(rootfs, state) + self.mount_rootfs(step, settings, state) def teardown(self, step, settings, state): - self.unmount_virtuals(state) self.unmount_rootfs(step, settings, state) def mount_rootfs(self, step, settings, state): @@ -78,23 +65,3 @@ class MountStepRunner(vmdb.StepRunnerInterface): vmdb.runcmd(['umount', mount_point]) os.rmdir(mount_point) - - def mount_virtuals(self, rootfs, state): - if not hasattr(state, 'virtuals'): - state.virtuals = [] - - for device, mount_point, fstype in self.virtuals: - path = os.path.join(rootfs, './' + mount_point) - if not os.path.exists(path): - os.mkdir(path) - vmdb.runcmd(['mount', '-t', fstype, device, path]) - state.virtuals.append(path) - logging.debug('mounted virtuals: %r', state.virtuals) - - def unmount_virtuals(self, state): - 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.') |