SlideShare a Scribd company logo
Development of
Bhyve Management Daemon
Yuichiro Naito
Mar. 22, 2025
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-
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
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
Why do I develop the bmd?
●
There are many bhyve management tools.
– vm-bhyve
– cbsd
– vmstated
– bhyvemgr
– ...
➔
Fun of programming.
➔
Focusing my use case.
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.
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.
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 ))
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.
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 …’.
VM configuration examples
template mydefault(n = 2, m = 2G) {
ncpu = ${n};
memory = ${m};
disk = /dev/zvol/zpool/images/${NAME};
network=bridge0;
console=auto;
}
template grubloader {
loader=grub;
loadcmd=auto;
installcmd=auto;
}
VM configuration examples
vm freebsd {
.apply mydefault(4, 4G);
loader=bhyveload;
}
vm netbsd {
.apply mydefault, grubloader;
}
vm openbsd {
.apply mydefaulft, grubloader;
}
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;
Console access
bmdctl bmd nmdm
access request
check cred.
open & flock
file descriptor
file descriptor
Console access
bmdctl bmd nmdm
SIGTERM
bhyve
read
write
close
read
read
exit
write
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.
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)
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.
Repositories
●
https://github.com/yuichiro-naito/bmd
●
https://github.com/yuichiro-naito/bmd-plugin-avahi
●
https://github.com/yuichiro-naito/bmd-plugin-hookcmd
●
https://github.com/yuichiro-naito/bmd-plugin-qemu
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
Any Questions?
●
Please ask me slowly.

More Related Content

PDF
AsiaBSDCon2023 - Hardening Emulated Devices in OpenBSD’s vmd(8) Hypervisor
PDF
”Bare-Metal Container" presented at HPCC2016
PDF
Implements BIOS emulation support for BHyVe: A BSD Hypervisor
PPTX
2 Boot To Vhd
PPTX
Introduction to Virtualization, Virsh and Virt-Manager
ODP
S4 xen hypervisor_20080622
PDF
BMC: Bare Metal Container @Open Source Summit Japan 2017
PDF
Virtualization VM VirtualBox + Oracle Enterprise Linux With Oracle 11GR2
AsiaBSDCon2023 - Hardening Emulated Devices in OpenBSD’s vmd(8) Hypervisor
”Bare-Metal Container" presented at HPCC2016
Implements BIOS emulation support for BHyVe: A BSD Hypervisor
2 Boot To Vhd
Introduction to Virtualization, Virsh and Virt-Manager
S4 xen hypervisor_20080622
BMC: Bare Metal Container @Open Source Summit Japan 2017
Virtualization VM VirtualBox + Oracle Enterprise Linux With Oracle 11GR2

Similar to Development of Bhyve Management Daemon on FreeBSD (20)

PPT
VMware Studio & vAPP-s
PDF
Asiabsdcon2013
PDF
Snapshots, Replication, and Boot-Environments by Kris Moore
PDF
Lpreservereurobsd2014
DOC
Manual 70-410 _Yves
PDF
Vmwareserver tips-tricks-110218231744-phpapp01
PDF
Vm ware server-tips-tricks
PDF
KVM tools and enterprise usage
PDF
Esx.sc.quickref
PDF
Texas 2013
PDF
commands v2.3.1
PPT
FreeNAS 10: Challenges of Building a Modern Storage Appliance based on FreeBS...
PPTX
Virtual Machines - Virtual Box
PDF
BSDCan2013
PDF
Extending bhyve beyond FreeBSD guests - EuroBSDCon 2013
PPTX
VirtualOS-using-Qemu
PDF
Aplura virtualization slides
PDF
Life Preserver - AsiaBSDCon2014
PDF
Self 2013
VMware Studio & vAPP-s
Asiabsdcon2013
Snapshots, Replication, and Boot-Environments by Kris Moore
Lpreservereurobsd2014
Manual 70-410 _Yves
Vmwareserver tips-tricks-110218231744-phpapp01
Vm ware server-tips-tricks
KVM tools and enterprise usage
Esx.sc.quickref
Texas 2013
commands v2.3.1
FreeNAS 10: Challenges of Building a Modern Storage Appliance based on FreeBS...
Virtual Machines - Virtual Box
BSDCan2013
Extending bhyve beyond FreeBSD guests - EuroBSDCon 2013
VirtualOS-using-Qemu
Aplura virtualization slides
Life Preserver - AsiaBSDCon2014
Self 2013
Ad

More from Yuichiro Naito (20)

PDF
Install FreeBSD 14.3-RELEASE to HP Envy x360
PDF
Bhyve Management Daemon: Wake on LAN support
PDF
Bhyve Management Daemon Version 3.0 on FreeBSD
PDF
Reporting AsiaBSDCon 2024 in Taipei for FreeBSD NetBSD
PDF
WireGurad in the FreeBSD kernel
PDF
FreeBSD Capsicum
PDF
Bhyve debug-server
PDF
Tramp mode
PDF
HandBrake with QSV
PDF
FreeBSD 12.1 RELESE
PPTX
Modern fonts
ODP
FreeBSD 12.0 RELEASE!
ODP
Psql & proctitle
ODP
ODP
FreeBSD 11.2 RELEASE!
ODP
How to use PTI & IBRS patch
ODP
FreeBSD Desktop
ODP
FreeBSD Ports Flavors
Install FreeBSD 14.3-RELEASE to HP Envy x360
Bhyve Management Daemon: Wake on LAN support
Bhyve Management Daemon Version 3.0 on FreeBSD
Reporting AsiaBSDCon 2024 in Taipei for FreeBSD NetBSD
WireGurad in the FreeBSD kernel
FreeBSD Capsicum
Bhyve debug-server
Tramp mode
HandBrake with QSV
FreeBSD 12.1 RELESE
Modern fonts
FreeBSD 12.0 RELEASE!
Psql & proctitle
FreeBSD 11.2 RELEASE!
How to use PTI & IBRS patch
FreeBSD Desktop
FreeBSD Ports Flavors
Ad

Recently uploaded (20)

PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PDF
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
PDF
Salesforce Agentforce AI Implementation.pdf
PDF
Autodesk AutoCAD Crack Free Download 2025
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PPTX
Patient Appointment Booking in Odoo with online payment
PDF
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
PDF
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
PPTX
assetexplorer- product-overview - presentation
PDF
Website Design Services for Small Businesses.pdf
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PDF
17 Powerful Integrations Your Next-Gen MLM Software Needs
PDF
CapCut Video Editor 6.8.1 Crack for PC Latest Download (Fully Activated) 2025
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Cost to Outsource Software Development in 2025
PPTX
history of c programming in notes for students .pptx
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
Salesforce Agentforce AI Implementation.pdf
Autodesk AutoCAD Crack Free Download 2025
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Designing Intelligence for the Shop Floor.pdf
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Patient Appointment Booking in Odoo with online payment
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
assetexplorer- product-overview - presentation
Website Design Services for Small Businesses.pdf
Weekly report ppt - harsh dattuprasad patel.pptx
17 Powerful Integrations Your Next-Gen MLM Software Needs
CapCut Video Editor 6.8.1 Crack for PC Latest Download (Fully Activated) 2025
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
CHAPTER 2 - PM Management and IT Context
Wondershare Filmora 15 Crack With Activation Key [2025
Cost to Outsource Software Development in 2025
history of c programming in notes for students .pptx

Development of Bhyve Management Daemon on FreeBSD

  • 1. Development of Bhyve Management Daemon Yuichiro Naito Mar. 22, 2025
  • 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 …’.
  • 11. VM configuration examples template mydefault(n = 2, m = 2G) { ncpu = ${n}; memory = ${m}; disk = /dev/zvol/zpool/images/${NAME}; network=bridge0; console=auto; } template grubloader { loader=grub; loadcmd=auto; installcmd=auto; }
  • 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;
  • 14. Console access bmdctl bmd nmdm access request check cred. open & flock file descriptor file descriptor
  • 15. Console access bmdctl bmd nmdm SIGTERM bhyve read write close read read exit write
  • 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