Modify and document new AHCI multi-device support

Get rid of ahci_multi_device="yes" and replace with
ahci_device_limit="X", where X is between 2-32. This allows
users to control the number of devices that will be put on
a single controller. If set to 1 (the default), we use the
original bhyve syntax.
This commit is contained in:
Matt Churchyard
2016-07-12 10:34:06 +01:00
parent 59fa02d6bc
commit 0da99953c0
4 changed files with 40 additions and 15 deletions

View File

@@ -333,23 +333,28 @@ vm::bhyve_device_basic(){
# step through all functions and just keep going # step through all functions and just keep going
# #
# since r302459 the ahci controller supports # since r302459 the ahci controller supports
# up to 32 devices per controller. if ahci_multi_device="yes" # up to 32 devices per controller. by default we set
# we make use of this rather than having one controller per disk # the device limit to 1 and use the original syntax, but
# # this can be overridden by setting the ahci_device_limit
# at the moment we only put 8 devices per controller # guest option to an integer between 2 and 32.
# #
# @modifies _devices _slot # @modifies _devices _slot
# #
vm::bhyve_device_disks(){ vm::bhyve_device_disks(){
local _disk _type _dev _path _opts _ahci _atype local _disk _type _dev _path _opts _ahci _atype
local _ahci_num=0 _num=0 _add _ahci_multi local _ahci_num=0 _num=0 _add _ahci_multi
local _ahci_limit=8 local _ahci_limit=1
# check if we want multiple ahci devices per controller # check if user has set a per-controller device limit
config::get "_ahci_multi" "ahci_multi_device" config::get "_ahci_multi" "ahci_device_limit"
if ! util::checkyesno "${_ahci_multi}" || [ ${VERSION_BSD} -lt 1200000 ]; then if [ -n "${_ahci_multi}" -a ${VERSION_BSD} -ge 1200000 ]; then
_ahci_multi=""
# see if it's numeric
echo "${_ahci_multi}" | egrep -iqs '^[0-9]+$'
[ $? -eq 0 -a ${_ahci_multi} -gt 1 -a ${_ahci_multi} -le 32 ] && \
_ahci_limit="${_ahci_multi}"
fi fi
# get all disks # get all disks
@@ -369,7 +374,7 @@ vm::bhyve_device_disks(){
vm::get_disk_path "_path" "${_name}" "${_disk}" "${_dev}" vm::get_disk_path "_path" "${_name}" "${_disk}" "${_dev}"
# ahci device and multi mode? # ahci device and multi mode?
if [ -n "${_ahci_multi}" -a "${_type%%-*}" = "ahci" ]; then if [ ${_ahci_limit} -gt 1 -a "${_type%%-*}" = "ahci" ]; then
# check device type # check device type
case "${_type}" in case "${_type}" in

View File

@@ -102,11 +102,22 @@ debug=""
# #
uuid="" uuid=""
# ahci_device_limit
# By default all ahci devices (ahci-hd/ahci-cd) are configured on independent
# slots with their own controller. In FreeBSD 12 it's possible to put up
# to 32 devices on each controller. This setting allows you to configure
# the number of devices vm-bhyve will allocate on each controller.
#
# Valid Options: 2-32
# Default: 1
#
ahci_device_limit="8"
# disk0_type (required) # disk0_type (required)
# This specifies the emulation type for disk0. Please note that each disk requires # This specifies the emulation type for disk0. Please note that each disk requires
# at least a type and name. # at least a type and name.
# #
# Valid Options: virtio-blk,ahci-hd # Valid Options: virtio-blk,ahci-hd,ahci-cd
# #
disk0_type="virtio-blk" disk0_type="virtio-blk"

2
vm
View File

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

15
vm.8
View File

@@ -1,4 +1,4 @@
.Dd July 8, 2016 .Dd July 12, 2016
.Dt VM-BHYVE 8 .Dt VM-BHYVE 8
.Os .Os
.Sh NAME .Sh NAME
@@ -873,9 +873,10 @@ will generate a mac address.
.It disk0_type .It disk0_type
The emulation type for the first virtual disk. At least one virtual disk is required. The emulation type for the first virtual disk. At least one virtual disk is required.
Valid options for this are currently Valid options for this are currently
.Sy virtio-blk .Sy virtio-blk ,
.Sy ahci-hd
and and
.Sy ahci-hd . .Sy ahci-cd .
Additional disks can be added by adding additional Additional disks can be added by adding additional
.Sy diskX_type .Sy diskX_type
and and
@@ -929,6 +930,14 @@ command line option.
.Pp .Pp
NOTE: This setting is only supported in templates. It has no function in NOTE: This setting is only supported in templates. It has no function in
real guest configuration, and is not copied over when a new machine is provisioned real guest configuration, and is not copied over when a new machine is provisioned
.It ahci_device_limit
By default, all AHCI devices are added on their own controller in a unqiue slot/function.
In FreeBSD 12 it is possible to put up to 32 devices on one controller. This setting
allows you to control the number of devices (ahci-hd/ahci-cd) that vm-bhyve will
put on a single controller. The default is
.Sy 1
and allowed values are
.Sy 2-32 .
.It uuid .It uuid
This option allows you to specify a fixed UUID for the guests SMBIOS. Normally, the This option allows you to specify a fixed UUID for the guests SMBIOS. Normally, the
UUID is generated by UUID is generated by