Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/openshell-driver-vm/runtime/kernel/openshell.kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ CONFIG_VIRTIO_BLK=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_USE_FOR_EXT2=y

# Host-directory sharing via virtiofs (used for VM driver bind mounts).
CONFIG_FUSE_FS=y
CONFIG_VIRTIO_FS=y

# Cgroups used for process supervision and resource limits.
CONFIG_CGROUPS=y
CONFIG_CGROUP_DEVICE=y
Expand Down
31 changes: 31 additions & 0 deletions crates/openshell-driver-vm/scripts/openshell-vm-sandbox-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,35 @@ run_openshell_init_dropins() {
done < <(LC_ALL=C sort -u "$manifest")
}

mount_virtiofs_shares() {
local manifest
manifest="$(root_path /.openshell/mounts.manifest)"
[ -f "$manifest" ] || return 0

ts "mounting virtiofs shares"
local tag target mode mount_opts guest_target
while IFS=$'\t' read -r tag target mode; do
[ -n "$tag" ] || continue
case "$mode" in
ro) mount_opts="-o ro" ;;
rw) mount_opts="" ;;
*)
ts "FATAL: unknown virtiofs mount mode '${mode}' for tag ${tag}"
exit 1
;;
esac
guest_target="$(root_path "$target")"
mkdir -p "$guest_target" 2>/dev/null || true
# shellcheck disable=SC2086
if mount -t virtiofs $mount_opts "$tag" "$guest_target"; then
ts " mounted virtiofs ${tag} -> ${target} (${mode})"
else
ts "FATAL: failed to mount virtiofs ${tag} at ${target}"
exit 1
fi
done < "$manifest"
}

run_post_overlay_setup() {
# Source QEMU-injected environment variables if present. The file lives in
# the overlay upperdir so the cached bootstrap rootfs remains immutable.
Expand All @@ -563,6 +592,8 @@ run_post_overlay_setup() {
mount -t cgroup2 cgroup2 "$(root_path /sys/fs/cgroup)" 2>/dev/null &
wait

mount_virtiofs_shares

reconcile_sandbox_account
setup_sandbox_workdir

Expand Down
Loading
Loading