Bug 183604

Summary: New port: sysutils/bhyve-rc
Product: Ports & Packages Reporter: Michael Gmelin <freebsd>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: adamw, marino
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.shar none

Description Michael Gmelin 2013-11-03 03:10:00 UTC
Allows starting of one or multiple bhyve instances within tmux on boot.
See also:
http://lists.freebsd.org/pipermail/freebsd-virtualization/2013-November/001694.html.

pkg-message:

Configuration is done completely though rc.conf.
The rc script won't touch any devices for you (neither disk, nor tap)
so you need to make sure all of those have been initialized properly.

General setup:
kldload vmm
net.link.tap.up_on_open=1

Make it persistent:
echo "net.link.tap.up_on_open=1" >> /etc/sysctl.conf
cat >> /boot/loader.conf << EOF
vmm_load="YES"
EOF

Minimal example:
cat >> /etc/rc.conf << EOF
cloned_interfaces="tap0 bridge0"
bhyve_enable="YES"
bhyve_diskdev="/dev/zvol/tank/bhyve/virt"
EOF

ifconfig tap0 create
ifconfig bridge0 create

service bhyve start
tmux list-sessions
tmux attach -t bhyve
service bhyve status
service bhyve stop

Multi profile configuration example:
cat >> /etc/rc.conf << EOF
cloned_interfaces="tap0 tap1 bridge0"
bhyve_enable="YES"
bhyve_profiles="virt1 virt2"
bhyve_virt1_diskdev="/dev/zvol/tank/bhyve/virt1"

bhyve_virt2_tapdev="tap1"
bhyve_virt2_diskdev="/dev/zvol/tank/bhyve/virt2"
bhyve_virt2_memsize="8192"
bhyve_virt2_ncpu="4"
EOF

ifconfig tap0 create
ifconfig tap1 create
ifconfig bridge0 create

service bhyve start # start all
service bhyve start virt2 # start individual
tmux attach -t bhyve_virt1
tmux attach -t bhyve_virt1
service bhyve stop virt2 # stop individual
service bhyve stop # stop all

(by default ctrl-b d detaches from tmux).

Fix: Patch attached with submission follows:
Comment 1 John Marino freebsd_committer freebsd_triage 2014-08-07 14:08:53 UTC
Hi, if you are still interested in having this port in FreeBSD, it needs to be reworked to support stage.  
See http://lists.freebsd.org/pipermail/freebsd-ports-announce/2014-May/000080.html


Additionally, you need to provide some sort of quality assurance.    
In order of preference, we are looking for:

1) "poudriere testport" or "poudriere bulk -t" logs
2) Redports or tinderbox logs

Please provide an updated shar file and attach a test log.  Alternatively, please indicate if you are no longer interested in having this software in the Ports Collection and that we can close the PR.

Thanks!
Comment 2 commit-hook freebsd_committer freebsd_triage 2014-08-21 15:07:08 UTC
A commit references this bug:

Author: adamw
Date: Thu Aug 21 15:06:17 UTC 2014
New revision: 365563
URL: http://svnweb.freebsd.org/changeset/ports/365563

Log:
  Add sysutils/bhyve-rc: FreeBSD RC script to start bhyve guests in tmux.

  PR:		183604
  Submitted by:	Michael Gmelin

Changes:
  head/sysutils/Makefile
  head/sysutils/bhyve-rc/
  head/sysutils/bhyve-rc/Makefile
  head/sysutils/bhyve-rc/files/
  head/sysutils/bhyve-rc/files/bhyve.in
  head/sysutils/bhyve-rc/pkg-descr
  head/sysutils/bhyve-rc/pkg-message
Comment 3 Adam Weinberger freebsd_committer freebsd_triage 2014-08-21 15:08:48 UTC
Committed, thanks. Is there any way you can give a more detailed pkg-descr? It's pretty thin.

Maybe something describing what exactly the relationship between tmux and bhyve is here?