2. Who am I?
Yuichiro Naito
– Master's degree of computer science from UEC, 1998
– Software Engineer worked for PFU, 1998-2009
– Software Engineer working for SOUM, 2009-
– FreeBSD user, since 2.1.6-R
– FreeBSD port maintainer, 2016-
3. What’s the bmd?
●
Management of bhyve processes.
●
Invokes bhyve and boot loaders according to the configuration files.
●
Wait for them and reboot if necessary.
bmd bhyveload
grub-bhyve
bhyve
fork & exec & wait
4. What’s the bmd?
●
A command line tool: bmdctl
– boot/shutdown the VM.
– console access to the VM. (emulate ‘cu -l’)
bmdctl bmd
Unix domain socket
bhyve
nmdm device
5. Why do I develop the bmd?
●
There are many bhyve management tools.
– vm-bhyve
– cbsd
– vmstated
– bhyvemgr
– ...
➔
Fun of programming.
➔
Focusing my use case.
6. Why do I develop the bmd?
●
Delegating VM operations to users.
– Root privilege is too big to boot/shutdown the VMs.
– I want to boot/shutdown my VMs casually.
– Allow to access the VM console which I booted.
➔
The bmd identifies the VM owner and allows the VM operations.
7. Why do I develop the bmd?
●
Dynamic tap interface assignment.
– The tap interfaces can be created/destroyed dynamically.
– No need static assignment.
– Describe network interfaces in which bridge to be included.
➔
The bmd creates a tap interface and adds to a bridge.
8. Why do I develop the bmd?
●
Don't repeat myself by copying the same configurations.
– After many configurations are copied, I find my mistake!
➔
The template feature for the VM configuration.
– I need to find unused VNC port for the new VM.
➔
Unique ID number and arithmetic calculations.
➔
e.g. $(( 5900 + $ID ))
9. Why do I develop the bmd?
●
How do I know the VNC port?
– publish via mDNS. (avahi-publish)
– Bvnc (gtk), Finder (MacOS) show the list.
➔
I have no idea for Windows users.
10. Why do I develop the bmd?
●
Auto inspection for grub-bhyve boot command.
– Looking for the OpenBSD kernel.
●
/bsd.upgrade or /bsd or /7.5/amd64/bsd
– Looking for the NetBSD kernel.
●
/netbsd
– Generate the boot command.
●
‘kopenbsd …’ or ‘knetbsd …’.
12. VM configuration examples
vm freebsd {
.apply mydefault(4, 4G);
loader=bhyveload;
}
vm netbsd {
.apply mydefault, grubloader;
}
vm openbsd {
.apply mydefaulft, grubloader;
}
13. VM owner
●
VM owner is as same as the file owner of the VM configurations.
●
The ‘.include’ macro loads the other configuration files.
– e.g. .include /home/yuichiro/bmd.conf;
– The parser runs under the file owner priviledge.
●
Use ‘owner’ keyword to change the owner.
– e.g. owner=yuichiro;
16. bmdctl
●
The same binary file as bmd.
●
Internal protocol is passing nvlist structure.
●
The bmdctl can run the same parser as the bmd.
– It’s useful to check if the configuration files are correct.
– Independent check of the running bmd.
17. Plugins
●
avahi
– publish the VNC port.
●
hookcmd
– invoke a command when VM state is chaned. (for reporting tasks)
– invoke a command before VM starts. (for setup tasks)
– invoke a command after VM stops. (for cleanup tasks)
●
qemu
– Use qemu instead of bhyve. (experimental)
18. The bmd doesn’t
●
create bridge interfaces.
– to avoid double management of rc scripts.
●
create disk images.
– Users can create a file or a zvol if the administrator allows.
– Users must follow the system administration policy.
20. Future works
●
Wake on LAN support
– monitoring WoL packets on the specific bridges.
– requires MAC address configuration.
●
support bhyve migration
– Work in progress
●
AsiaBSDCon 2023
●
BSDCan 2019