feat(rego-tunnel): optional second VM NIC + robust QCOW2 patch
Some checks failed
Test / test (push) Has been cancelled
Some checks failed
Test / test (push) Has been cancelled
This commit is contained in:
@@ -45,6 +45,23 @@ if [ "$AUTO_MOUNT_9P" = "1" ]; then
|
||||
qemu-nbd --connect "$NBD_DEV" "$QCOW2_PATH"
|
||||
sleep 1
|
||||
|
||||
# In containers, the kernel may create sysfs partition entries but not
|
||||
# auto-create the corresponding /dev/nbd0p* nodes. Create them if missing.
|
||||
base_dev="$(basename "$NBD_DEV")"
|
||||
for sysfs_dev in /sys/class/block/${base_dev}p*; do
|
||||
[ -e "$sysfs_dev" ] || continue
|
||||
part_name="$(basename "$sysfs_dev")"
|
||||
devnode="/dev/$part_name"
|
||||
[ -e "$devnode" ] && continue
|
||||
if [ -r "$sysfs_dev/dev" ]; then
|
||||
IFS=: read -r major minor < "$sysfs_dev/dev" || true
|
||||
if [ -n "${major:-}" ] && [ -n "${minor:-}" ]; then
|
||||
mknod "$devnode" b "$major" "$minor" 2>/dev/null || true
|
||||
chmod 660 "$devnode" 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
mkdir -p "$VMROOT_MNT"
|
||||
ROOT_PART=""
|
||||
for part in "${NBD_DEV}"p*; do
|
||||
@@ -71,6 +88,8 @@ if [ "$AUTO_MOUNT_9P" = "1" ]; then
|
||||
umount "$VMROOT_MNT" >/dev/null 2>&1 || true
|
||||
else
|
||||
echo "[rego-tunnel] WARN: could not locate guest root partition; skipping auto-mount setup"
|
||||
lsblk -fp "$NBD_DEV" 2>/dev/null || true
|
||||
blkid "$NBD_DEV"* 2>/dev/null || true
|
||||
fi
|
||||
|
||||
qemu-nbd --disconnect "$NBD_DEV" >/dev/null 2>&1 || true
|
||||
|
||||
Reference in New Issue
Block a user