summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrtkapiper <andy.piper@arcticwolf.com>2023-07-11 18:24:18 +0000
committerLars Wirzenius <liw@liw.fi>2023-07-14 15:30:39 +0000
commit33d56f35e39d0d3872d06400456d5f99f7986dc1 (patch)
treea14358953fc30de7d9fd3997d40d765455e891bd
parente74b33172b7298ec08177af4d1ee9fba147e7845 (diff)
downloadvmdb2-33d56f35e39d0d3872d06400456d5f99f7986dc1.tar.gz
virtualfs_plugin: bind-mount build host's /dev to support rootfs in LVM
virtualfs_plugin.py now bind-mounts `/dev` from the build host into the chroot to allow grub_plugin to support grub_install when the root filesystem is inside an LVM volume
-rw-r--r--vmdb/plugins/virtualfs_plugin.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/vmdb/plugins/virtualfs_plugin.py b/vmdb/plugins/virtualfs_plugin.py
index 925e10b..0e9bff8 100644
--- a/vmdb/plugins/virtualfs_plugin.py
+++ b/vmdb/plugins/virtualfs_plugin.py
@@ -30,13 +30,13 @@ class VirtualFilesystemMountPlugin(vmdb.Plugin):
class VirtualFilesystemMountStepRunner(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"],
+ ["none", "/proc", ["-t", "proc"]],
+ ["/dev", "/dev", ["--bind"]],
+ ["none", "/dev/pts", ["-t","devpts"]],
+ ["none", "/dev/shm", ["-t","tmpfs"]],
+ ["none", "/run", ["-t","tmpfs"]],
+ ["none", "/run/lock", ["-t","tmpfs"]],
+ ["none", "/sys", ["-t","sysfs"]],
]
def get_key_spec(self):
@@ -54,14 +54,14 @@ class VirtualFilesystemMountStepRunner(vmdb.StepRunnerInterface):
if not hasattr(state, "virtuals"):
state.virtuals = []
- for device, mount_point, fstype in self.virtuals:
+ for device, mount_point, opts in self.virtuals:
path = os.path.normpath(os.path.join(rootfs, "./" + mount_point))
if os.path.ismount(path):
logging.debug("already mounted: %s", path)
continue
if not os.path.exists(path):
os.mkdir(path)
- vmdb.runcmd(["mount", "-t", fstype, device, path])
+ vmdb.runcmd(["mount", device, path] + opts)
state.virtuals.append(path)
logging.debug("mounted virtuals: %r", state.virtuals)