From 33d56f35e39d0d3872d06400456d5f99f7986dc1 Mon Sep 17 00:00:00 2001 From: rtkapiper Date: Tue, 11 Jul 2023 18:24:18 +0000 Subject: 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 --- vmdb/plugins/virtualfs_plugin.py | 18 +++++++++--------- 1 file 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) -- cgit v1.2.1