Add bhyveload_loader and also vtcon list to "vm info"

This commit is contained in:
Matt Churchyard
2018-06-21 12:22:35 +00:00
parent ea58aaf6d7
commit 9a908b95fc
6 changed files with 50 additions and 7 deletions

View File

@@ -49,7 +49,7 @@
#
guest::load(){
local _iso="$1"
local _args _command _timeout _grub_opt
local _args _command _timeout _grub_opt _bsd_loader
# all loaders have same console and wired memory options
[ -z "${VM_OPT_FOREGROUND}" ] && _args="-c ${_com}"
@@ -63,6 +63,10 @@ guest::load(){
_command="bhyveload"
_args="${_args}${_args:+ }-m ${_memory} -e autoboot_delay=${_timeout}"
# have a custom guest loader specified?
config::get "_bsd_loader" "bhyveload_loader"
[ -n "${_bsd_loader}" ] && _args="${_args} -l ${_bsd_loader}"
if [ -n "${_iso}" ]; then
_args="${_args} -d ${_iso}"
else

View File

@@ -208,6 +208,9 @@ info::guest_show(){
while read _port; do
echo "${_INDENT}${_INDENT}${_port%%=*}: ${_port##*=}"
done
# virtio-console devices
info::guest_vtcon
fi
fi
@@ -223,6 +226,30 @@ info::guest_show(){
echo ""
}
# display any virtio consoles
#
info::guest_vtcon(){
local _INDENT=" "
local _console _num=0
config::get "_console" "virt_console0"
[ -z "${_console}" ] && return 0
echo ""
while [ -n "${_console}" -a ${_num} -lt 16 ]; do
# if set to "yes/on/1", just use the console number as port name
case "${_console}" in
[Yy][Ee][Ss]|[Oo][Nn]|1) _console="${_num}" ;;
esac
echo "${_INDENT}vtcon${_num}: ${VM_DS_PATH}/${_name}/vtcon.${_console}"
_num=$((_num + 1))
config::get "_console" "virt_console${_num}"
done
}
# display zfs snapshot/origin data
#
info::guest_zfs(){

View File

@@ -693,7 +693,7 @@ vm::bhyve_device_console(){
[ -z "${_console}" ] && return 0
# add ports
while [ -n "${_console}" ]; do
while [ -n "${_console}" -a ${_curr} -lt 16 ]; do
# if set to "yes/on/1", just use the console number as port name
case "${_console}" in
[Yy][Ee][Ss]|[Oo][Nn]|1) _console="${_curr}" ;;
@@ -701,9 +701,6 @@ vm::bhyve_device_console(){
_dev_str="${_dev_str},${_console}=${VM_DS_PATH}/${_name}/vtcon.${_console}"
# stop at 16
[ ${_curr} -ge 16 ] && break;
_curr=$((_curr + 1))
config::get "_console" "virt_console${_curr}"
done

View File

@@ -18,8 +18,16 @@
#
loader=""
# bhyveload_loader
# If using bhyveload, this option can be used to specify the path
# to the loader inside the guest to use
#
# the default is /boot/userboot.so
#
bhyveload_loader=""
# loader_timeout
# By default grub-bhyve will wait 3 seconds before booting the default
# By default bhyveload & grub-bhyve will wait 3 seconds before booting the default
# option. This setting allows you to either reduce the timeout to
# make boot faster, or increase it so that it's easier to access
# the grub console before it starts booting

2
vm
View File

@@ -25,7 +25,7 @@
# POSSIBILITY OF SUCH DAMAGE.
VERSION=1.2
VERSION_INT=102050
VERSION_INT=102051
VERSION_BSD=$(uname -K)
PATH=${PATH}:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin

7
vm.8
View File

@@ -1027,6 +1027,13 @@ can be supported by using the
guest type, and specifying the
.Sy grub
loader.
.It bhyveload_loader
This option allows a custom path to be used for the loader inside the guest.
Passed to
.Sy bhyveload
using the
.Sy -l
argument.
.It loader_timeout
By default the
.Sy bhyveload