Hello,

two years elapsed since I last deployed a FreeBSD machine that utilizd bhyve(8), which already had bhyve_config(5) support back then.

I was astonished that I still couldn't find bhyve in /etc/rc.d in 14.1-stable as of last week. Since I utilize ng_bridge(8) and do some more things differently than vm-bhyve / iocage and the like, I wanted to have something straight forward, capable of making use of the wonderful bhyve_config(5) feature, for use cases where /usr/share/examples/bhyve/vmrun.sh isn't suitable.

Please find attached my first approch, which currently covers the following features:

- auto-preload FreeBSD guest using bhyveload(8) in case config file doesn't define lpc.bootrom - Allows referencing %(youname_somevar) in config file if defined as bhyve_youname_somevar in rc.conf(5).
  (For example:
    bhyve_vmdisk_default_pool="myppol2"
    bhyve_vmdisk_default_dataset="bhyveVOL/sys"
    and
pci.0.3.0.path=/dev/zvol/%(vmdisk_default_pool)/%(vmdisk_default_dataset)/%(name) in bhyve_config(5) file
  )
- Adaptive handling of start/stop requests depending on 'AUTO' 'ALL' or specific list of VM names, depending on the non-bhyve_cfg(5) 'autostart' option. - Hopefully balanced amount of messages about what's going on, to be user friendly but not spamming.

There's a lot of room for improvements (selectable pre-jail/post-jail order, bootdisk detection, priority handling, a useful 'status' implementation, style) and for sure some bugs, but this version works well for my current setup.
Happy to contribute if useful for others, feedback welcome.

-harry


Attachment: rc.d_bhyve.shar.xz
Description: application/xz

Reply via email to