From owner-svn-src-stable@freebsd.org Mon Feb 12 19:08:17 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9D5BF13692; Mon, 12 Feb 2018 19:08:17 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 652FC87CA6; Mon, 12 Feb 2018 19:08:17 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B44A15FB1; Mon, 12 Feb 2018 19:08:17 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1CJ8Hbu017827; Mon, 12 Feb 2018 19:08:17 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1CJ8H5i017826; Mon, 12 Feb 2018 19:08:17 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201802121908.w1CJ8H5i017826@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Mon, 12 Feb 2018 19:08:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329179 - stable/11/share/examples/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: stable/11/share/examples/bhyve X-SVN-Commit-Revision: 329179 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 19:08:18 -0000 Author: rgrimes Date: Mon Feb 12 19:08:17 2018 New Revision: 329179 URL: https://svnweb.freebsd.org/changeset/base/329179 Log: MFC: r328695,r328720,r328784,r328795 share/examples/bhyve/vmrun.sh additions and cleanups r328695: Add option '-n' network device emulation type which has a default of virtio-net PR: 225558 Submitted by: Johannes Lundberg r328720: Add -n to usage synopsis forgotten in r328695. Fix long lines in usage. Consistently use "default:" rather than "default is" r328784: Clean up long lines. r328795: Fold constants and unify vnc variable names. Approved by: grehan (mentor) PR: 225558 Modified: stable/11/share/examples/bhyve/vmrun.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/share/examples/bhyve/vmrun.sh ============================================================================== --- stable/11/share/examples/bhyve/vmrun.sh Mon Feb 12 18:52:59 2018 (r329178) +++ stable/11/share/examples/bhyve/vmrun.sh Mon Feb 12 19:08:17 2018 (r329179) @@ -36,9 +36,15 @@ DEFAULT_CPUS=2 DEFAULT_TAPDEV=tap0 DEFAULT_CONSOLE=stdio +DEFAULT_NIC=virtio-net +DEFAULT_DISK=virtio-blk DEFAULT_VIRTIO_DISK="./diskdev" DEFAULT_ISOFILE="./release.iso" +DEFAULT_VNCHOST="127.0.0.1" +DEFAULT_VNCPORT=5900 +DEFAULT_VNCSIZE="w=1024,h=768" + errmsg() { echo "*** $1" } @@ -46,33 +52,43 @@ errmsg() { usage() { local msg=$1 - echo "Usage: vmrun.sh [-aAEhiTv] [-c ] [-C ] [-d ]" - echo " [-e ] [-f ] [-F ]" + echo "Usage: vmrun.sh [-aAEhiTv] [-c ] [-C ]" \ + "[-d ]" + echo " [-e ] [-f ]" \ + "[-F ]" echo " [-g ] [-H ]" echo " [-I ] [-l ]" echo " [-L ]" - echo " [-m ] [-P ] [-t ] " + echo " [-m ]" \ + "[-n ]" + echo " [-P ] [-t ] " echo "" echo " -h: display this help message" echo " -a: force memory mapped local APIC access" - echo " -A: use AHCI disk emulation instead of virtio" - echo " -c: number of virtual cpus (default is ${DEFAULT_CPUS})" - echo " -C: console device (default is ${DEFAULT_CONSOLE})" - echo " -d: virtio diskdev file (default is ${DEFAULT_VIRTIO_DISK})" + echo " -A: use AHCI disk emulation instead of ${DEFAULT_DISK}" + echo " -c: number of virtual cpus (default: ${DEFAULT_CPUS})" + echo " -C: console device (default: ${DEFAULT_CONSOLE})" + echo " -d: virtio diskdev file (default: ${DEFAULT_VIRTIO_DISK})" echo " -e: set FreeBSD loader environment variable" echo " -E: Use UEFI mode" echo " -f: Use a specific UEFI firmware" - echo " -F: Use a custom UEFI GOP framebuffer size (default: w=1024,h=768)" + echo " -F: Use a custom UEFI GOP framebuffer size" \ + "(default: ${DEFAULT_VNCSIZE}" echo " -g: listen for connection from kgdb at " echo " -H: host filesystem to export to the loader" echo " -i: force boot of the Installation CDROM image" - echo " -I: Installation CDROM image location (default is ${DEFAULT_ISOFILE})" - echo " -l: the OS loader to use (default is /boot/userboot.so)" - echo " -L: IP address for UEFI GOP VNC server (default: 127.0.0.1)" - echo " -m: memory size (default is ${DEFAULT_MEMSIZE})" - echo " -p: pass-through a host PCI device at bus/slot/func (e.g. 10/0/0)" - echo " -P: UEFI GOP VNC port (default: 5900)" - echo " -t: tap device for virtio-net (default is $DEFAULT_TAPDEV)" + echo " -I: Installation CDROM image location" \ + "(default: ${DEFAULT_ISOFILE})" + echo " -l: the OS loader to use (default: /boot/userboot.so)" + echo " -L: IP address for UEFI GOP VNC server" \ + "(default: ${DEFAULT_VNCHOST}" + echo " -m: memory size (default: ${DEFAULT_MEMSIZE})" + echo " -n: network adapter emulation type" \ + "(default: ${DEFAULT_NIC})" + echo " -p: pass-through a host PCI device at bus/slot/func" \ + "(e.g. 10/0/0)" + echo " -P: UEFI GOP VNC port (default: ${DEFAULT_VNCPORT})" + echo " -t: tap device for virtio-net (default: $DEFAULT_TAPDEV)" echo " -T: Enable tablet device (for UEFI GOP)" echo " -u: RTC keeps UTC time" echo " -v: Wait for VNC client connection before booting VM" @@ -98,9 +114,10 @@ isofile=${DEFAULT_ISOFILE} memsize=${DEFAULT_MEMSIZE} console=${DEFAULT_CONSOLE} cpus=${DEFAULT_CPUS} +nic=${DEFAULT_NIC} tap_total=0 disk_total=0 -disk_emulation="virtio-blk" +disk_emulation=${DEFAULT_DISK} gdbport=0 loader_opt="" bhyverun_opt="-H -A -P" @@ -110,12 +127,12 @@ pass_total=0 efi_mode=0 efi_firmware="/usr/local/share/uefi-firmware/BHYVE_UEFI.fd" vncwait="" -vnchost="127.0.0.1" -vncport=5900 -fbsize="w=1024,h=768" +vnchost=${DEFAULT_VNCHOST} +vncport=${DEFAULT_VNCPORT} +vncsize=${DEFAULT_VNCSIZE} tablet="" -while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:m:p:P:t:Tuvw c ; do +while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:m:n:p:P:t:Tuvw c ; do case $c in a) bhyverun_opt="${bhyverun_opt} -a" @@ -146,7 +163,7 @@ while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:m:p:P:t:Tuvw c efi_firmware="${OPTARG}" ;; F) - fbsize="${OPTARG}" + vncsize="${OPTARG}" ;; g) gdbport=${OPTARG} @@ -169,6 +186,9 @@ while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:m:p:P:t:Tuvw c m) memsize=${OPTARG} ;; + n) + nic=${OPTARG} + ;; p) eval "pass_dev${pass_total}=\"${OPTARG}\"" pass_total=$(($pass_total + 1)) @@ -227,7 +247,8 @@ fi if [ ${efi_mode} -gt 0 ]; then if [ ! -f ${efi_firmware} ]; then - echo "Error: EFI Firmware ${efi_firmware} doesn't exist. Try: pkg install uefi-edk2-bhyve" + echo "Error: EFI Firmware ${efi_firmware} doesn't exist." \ + "Try: pkg install uefi-edk2-bhyve" exit 1 fi fi @@ -264,7 +285,8 @@ while [ 1 ]; do file -s ${first_diskdev} | grep "boot sector" > /dev/null rc=$? if [ $rc -ne 0 ]; then - file -s ${first_diskdev} | grep ": Unix Fast File sys" > /dev/null + file -s ${first_diskdev} | \ + grep ": Unix Fast File sys" > /dev/null rc=$? fi if [ $rc -ne 0 ]; then @@ -295,8 +317,8 @@ while [ 1 ]; do fi if [ ${efi_mode} -eq 0 ]; then - ${LOADER} -c ${console} -m ${memsize} ${BOOTDISKS} ${loader_opt} \ - ${vmname} + ${LOADER} -c ${console} -m ${memsize} ${BOOTDISKS} \ + ${loader_opt} ${vmname} bhyve_exit=$? if [ $bhyve_exit -ne 0 ]; then break @@ -311,7 +333,7 @@ while [ 1 ]; do i=0 while [ $i -lt $tap_total ] ; do eval "tapname=\$tap_dev${i}" - devargs="$devargs -s $nextslot:0,virtio-net,${tapname} " + devargs="$devargs -s $nextslot:0,${nic},${tapname} " nextslot=$(($nextslot + 1)) i=$(($i + 1)) done @@ -336,7 +358,8 @@ while [ 1 ]; do efiargs="" if [ ${efi_mode} -gt 0 ]; then - efiargs="-s 29,fbuf,tcp=${vnchost}:${vncport},${fbsize}${vncwait}" + efiargs="-s 29,fbuf,tcp=${vnchost}:${vncport}," + efiargs="${efiargs}${vncsize}${vncwait}" efiargs="${efiargs} -l bootrom,${efi_firmware}" efiargs="${efiargs} ${tablet}" fi