mirror of
https://github.com/churchers/vm-bhyve.git
synced 2025-12-12 01:40:40 +01:00
Rewrite virtio-console support
Guest "virt_consoleX" option now supports both numbered & named ports. Up to 16 can be added to a guest.
This commit is contained in:
@@ -162,8 +162,6 @@ config::core::set(){
|
||||
else
|
||||
sysrc -inqf "${vm_dir}/.config/system.conf" "${_var}"="${_value}" >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
# remove a value from core configuration
|
||||
@@ -181,6 +179,4 @@ config::core::remove(){
|
||||
else
|
||||
sysrc -inxqf "${vm_dir}/.config/system.conf" ${_var} >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
@@ -123,7 +123,6 @@ guest::load(){
|
||||
# run the command
|
||||
util::log "guest" "${_name}" "${_command} ${_args} ${_name}"
|
||||
${_command} ${_args} ${_name}
|
||||
return $?
|
||||
}
|
||||
|
||||
# See if the user has configured grub commands.
|
||||
|
||||
31
lib/vm-run
31
lib/vm-run
@@ -253,7 +253,7 @@ vm::run(){
|
||||
util::log "guest" "${_name}" "bhyve exited with status ${_exit}"
|
||||
|
||||
# remove any console sockets
|
||||
rm ${VM_DS_PATH}/${_name}/vconsole*.sock >/dev/null 2>&1
|
||||
rm ${VM_DS_PATH}/${_name}/vtcon.* >/dev/null 2>&1
|
||||
|
||||
# if 0, guest rebooted so continue loop
|
||||
# anything else we break and shutdown
|
||||
@@ -685,22 +685,27 @@ vm::bhyve_device_mouse(){
|
||||
# @modifies _devices _slot
|
||||
#
|
||||
vm::bhyve_device_console(){
|
||||
local _console_count _curr=1
|
||||
local _console _curr=0
|
||||
local _dev_str
|
||||
|
||||
[ ${VERSION_BSD} -lt 1200000 ] && return 0
|
||||
config::get "_console_count" "virt_consoles"
|
||||
[ -z "${_console_count}" ] && return 0
|
||||
[ ${VERSION_BSD} -lt 1102000 ] && return 0
|
||||
config::get "_console" "virt_console0"
|
||||
[ -z "${_console}" ] && return 0
|
||||
|
||||
# make sure it's 1-16
|
||||
echo "${_console_count}" | egrep -qs '^[0-9]{1,2}$'
|
||||
[ $? -ne 0 ] && return 1
|
||||
[ ${_console_count} -gt 16 ] && return 1
|
||||
# add ports
|
||||
while [ -n "${_console}" ]; 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}" ;;
|
||||
esac
|
||||
|
||||
# add each console port to the device string
|
||||
while [ ${_curr} -le ${_console_count} ]; do
|
||||
_dev_str="${_dev_str},port${_curr}=${VM_DS_PATH}/${_name}/vconsole${_curr}.sock"
|
||||
_curr=$((_curr + 1))
|
||||
_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
|
||||
|
||||
_devices="${_devices} -s ${_slot}:0,virtio-console${_dev_str}"
|
||||
|
||||
@@ -323,12 +323,18 @@ graphics_wait="auto"
|
||||
#
|
||||
xhci_mouse="yes"
|
||||
|
||||
# virt_consoles
|
||||
# specify a number between 1-16 to create virtio_console ports
|
||||
# for the guest. Each port will correspond to a vconsoleX.sock
|
||||
# unix socket on the host, which is created inside the guest directory.
|
||||
# virt_console0
|
||||
# create up to 16 virtual console devices
|
||||
#
|
||||
virt_consoles="2"
|
||||
# the value can be yes|on|1 to create a numbered port. FreeBSD < 12
|
||||
# only supports virtio consoles configured in this way
|
||||
#
|
||||
# For guests with named console support (FreeBSD 12+, Linux?), the
|
||||
# value can be the name of the port to create. The name "org.freenas.byhve-agent"
|
||||
# can be useful as it ties in with tools written to make use of the
|
||||
# FreeNAS bhyve-agent interface.
|
||||
#
|
||||
virt_console0="org.freenas.byhve-agent"
|
||||
|
||||
# grub_install0
|
||||
# use this to specify grub commands that should be run inside the
|
||||
|
||||
2
vm
2
vm
@@ -25,7 +25,7 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
VERSION=1.2
|
||||
VERSION_INT=102049
|
||||
VERSION_INT=102050
|
||||
VERSION_BSD=$(uname -K)
|
||||
PATH=${PATH}:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
|
||||
|
||||
|
||||
21
vm.8
21
vm.8
@@ -1375,18 +1375,17 @@ Set this option to
|
||||
in order to provide an XHCI mouse device to the guest.
|
||||
This tracks much better than the default PS2 mouse in VNC settings, although
|
||||
this mouse may not supported by older guests.
|
||||
.It virt_consoles
|
||||
This can be used to specify a number of
|
||||
.Sy virtio_console
|
||||
ports to provide to the guest.
|
||||
This should be a number between 1 and 16, which is the maximum number of ports
|
||||
supported by the current virtio_console device.
|
||||
.It virt_consoleX
|
||||
Allows the creation of up to 16 virtio-console devices in the guest. The value
|
||||
to this option can be
|
||||
.Sy yes|on|1
|
||||
to create a numbered port. This is the only method supported by some guests.
|
||||
.Pp
|
||||
If enabled, each port will correspond to a unix socket named
|
||||
.Sy vconsoleX.sock
|
||||
in the guest's data/configuration directory, where
|
||||
.Sy X
|
||||
is the port number (1-16).
|
||||
If any other value is provided, this will be used as the name of the port. The
|
||||
name
|
||||
.Sy org.freenas.byhve-agent
|
||||
can be useful, as it ties in with utilities written for the FreeNAS
|
||||
bhyve-agent interface.
|
||||
.It zfs_dataset_opts
|
||||
This allows you to specify one or more ZFS properties to set on the dataset
|
||||
when a guest is created.
|
||||
|
||||
Reference in New Issue
Block a user