vmrun.sh: add option for sharing directory via p9fs to bhyve
Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D55100
This commit is contained in:
committed by
Mark Johnston
parent
f3e9c94bc5
commit
525d00dcf4
@@ -53,8 +53,8 @@ errmsg() {
|
|||||||
usage() {
|
usage() {
|
||||||
local msg=$1
|
local msg=$1
|
||||||
|
|
||||||
echo "Usage: vmrun.sh [-aAEhiTuvw] [-c <CPUs>] [-C <console>]" \
|
echo "Usage: vmrun.sh [-aAEhiTuvw] [-9 <9p share>=<path>[,<opts>]]"
|
||||||
"[-d <disk file>]"
|
echo " [-c <CPUs>] [-C <console>] [-d <disk file>]"
|
||||||
echo " [-e <name=value>] [-f <path of firmware>]" \
|
echo " [-e <name=value>] [-f <path of firmware>]" \
|
||||||
"[-F <size>]"
|
"[-F <size>]"
|
||||||
echo " [-G [w][address:]port] [-H <directory>]"
|
echo " [-G [w][address:]port] [-H <directory>]"
|
||||||
@@ -66,6 +66,7 @@ usage() {
|
|||||||
echo " [-P <port>] [-t <tapdev>] <vmname>"
|
echo " [-P <port>] [-t <tapdev>] <vmname>"
|
||||||
echo ""
|
echo ""
|
||||||
echo " -h: display this help message"
|
echo " -h: display this help message"
|
||||||
|
echo " -9: virtio 9p (VirtFS) device to share directory"
|
||||||
echo " -a: force memory mapped local APIC access"
|
echo " -a: force memory mapped local APIC access"
|
||||||
echo " -A: use AHCI disk emulation instead of ${DEFAULT_DISK}"
|
echo " -A: use AHCI disk emulation instead of ${DEFAULT_DISK}"
|
||||||
echo " -c: number of virtual cpus (default: ${DEFAULT_CPUS})"
|
echo " -c: number of virtual cpus (default: ${DEFAULT_CPUS})"
|
||||||
@@ -128,6 +129,7 @@ disk_total=0
|
|||||||
disk_emulation=${DEFAULT_DISK}
|
disk_emulation=${DEFAULT_DISK}
|
||||||
loader_opt=""
|
loader_opt=""
|
||||||
pass_total=0
|
pass_total=0
|
||||||
|
plan9_total=0
|
||||||
|
|
||||||
# EFI-specific options
|
# EFI-specific options
|
||||||
efi_mode=0
|
efi_mode=0
|
||||||
@@ -144,16 +146,26 @@ uboot_firmware="/usr/local/share/u-boot/u-boot-bhyve-arm64/u-boot.bin"
|
|||||||
case ${platform} in
|
case ${platform} in
|
||||||
amd64)
|
amd64)
|
||||||
bhyverun_opt="-H -P"
|
bhyverun_opt="-H -P"
|
||||||
opts="aAc:C:d:e:Ef:F:G:hH:iI:l:L:m:n:p:P:t:Tuvw"
|
opts="9:aAc:C:d:e:Ef:F:G:hH:iI:l:L:m:n:p:P:t:Tuvw"
|
||||||
;;
|
;;
|
||||||
arm64)
|
arm64)
|
||||||
bhyverun_opt=""
|
bhyverun_opt=""
|
||||||
opts="aAc:C:d:e:f:F:G:hH:iI:L:m:n:P:t:uv"
|
opts="9:aAc:C:d:e:f:F:G:hH:iI:L:m:n:P:t:uv"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
while getopts $opts c ; do
|
while getopts $opts c ; do
|
||||||
case $c in
|
case $c in
|
||||||
|
9)
|
||||||
|
plan9_share=${OPTARG%%=*}
|
||||||
|
plan9_rest=${OPTARG#${plan9_share}=}
|
||||||
|
plan9_path=${plan9_rest%%,*}
|
||||||
|
plan9_opts=${plan9_rest#${plan9_path}}
|
||||||
|
eval "plan9_share${plan9_total}=\"${plan9_share}\""
|
||||||
|
eval "plan9_path${plan9_total}=\"${plan9_path}\""
|
||||||
|
eval "plan9_opts${plan9_total}=\"${plan9_opts}\""
|
||||||
|
plan9_total=$(($plan9_total + 1))
|
||||||
|
;;
|
||||||
a)
|
a)
|
||||||
bhyverun_opt="${bhyverun_opt} -a"
|
bhyverun_opt="${bhyverun_opt} -a"
|
||||||
;;
|
;;
|
||||||
@@ -387,6 +399,20 @@ while [ 1 ]; do
|
|||||||
i=$(($i + 1))
|
i=$(($i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
i=0
|
||||||
|
while [ $i -lt $plan9_total ] ; do
|
||||||
|
eval "share=\$plan9_share${i}"
|
||||||
|
eval "path=\$plan9_path${i}"
|
||||||
|
eval "opts=\$plan9_opts${i}"
|
||||||
|
if [ ! -d ${path} ]; then
|
||||||
|
echo "virtio-9p \"${path}\" is not a directory"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
devargs="$devargs -s $nextslot,virtio-9p,${share}=${path}${opts} "
|
||||||
|
nextslot=$(($nextslot + 1))
|
||||||
|
i=$(($i + 1))
|
||||||
|
done
|
||||||
|
|
||||||
i=0
|
i=0
|
||||||
while [ $i -lt $tap_total ] ; do
|
while [ $i -lt $tap_total ] ; do
|
||||||
eval "tapname=\$tap_dev${i}"
|
eval "tapname=\$tap_dev${i}"
|
||||||
|
|||||||
Reference in New Issue
Block a user