Re: RFC: rc(8) script for bhyve(8) on FreeBSD

From: Harry Schmalzbauer <freebsd_at_omnilan.de>
Date: Mon, 05 Aug 2024 17:19:58 UTC
On 2024-08-05 19:04, Mario Marietto wrote:
> Hello.
> 
> I'm also interested in writing a script to manage the bhyve vms. Even if 
> I suspect that my approach will be different. My idea is to ask the user 
> what he wants to do and then the script will configure the vm getting 
> the information provided by the user.
> I will give a look at /etc/rc.d/bhyve,but I don't think I will study 
> cirrina,it seems very complicated.

To avoid misunderstandings:

/etc/rc.d/bhyve is not meant to 'manage' bhyve(8) VMs in the sense of 
configuring bhyve(8) or the host which runs the guest operating system.
It's just to start/stop already defined VMs at boot time.
Managing VM's means utlizing $EDITOR /etc/bhyve.d/yourvm.cfg to me.

bhyve_config(5) is what /etc/rc.d/bhyve relies on and where the VM 
config happens.

cirrina seems to be a completely different tool.
 From the page:
»Only UEFI boot is supported, no bhyveload.«
Another showstopper for me:
»./cirrinactl switch set-uplink -n bridge0 -u em0«
(I never use if_bridge(4) for HyperVisor networking)

All you can do with /etc/rc.d/bhyve is
   service bhyve start [vmname] [...]
   service bhyve stop [vmname] [...]
and expect to have all VMs running after rebooting, which you wrote a 
config file for and placed it into /etc/bhyve.d/

Best,
-harry