Rhyzome Libvirt
This is a Rhyzome component for provisioning VMs using libvirt
.
there are two binaries: rhyzome-libvirt-server, which runs in the cloud,
and rhyzome-libvirt, which runs Linux Hypervisor with libvirt.
It facilates the creation of virtual machines, and unikernels.
Build
requires
Go >=1.19
libvirt-headers >=5.0.0
Build with make
Architecture
A REST server (rhyzome-libvirt-server
) accepts JWT-authenticated requests, stores the expected state in a sqlite database. It also creates a gRPC listener.
On or more nodes, the client (rhyzome-libvirt
) runs and connects to the gRPC listener, registering the node with the server. The client then listens for events
from the server. The server initially sends all expected state (ie. all volumes and VMs that are supposed to be on the host) to the client, then sends new updates
as they come in.
Installing
rhyzome-libvirt
needs a libvirt hook installed. This requires several things:
- the
rhyzome-libvirt
binary should be available in the $PATH. I put it in /usr/local/bin/rhyzome-libvirt
- the actual hook, at
/etc/libvirt/hooks/qemu.d/rhyzome
must be a shell script (per libvirt docs). Here's mine:
#!/bin/bash
rhyzome-libvirt hook $@
- apparmor should allow libvirt to update it. I added this line to
/etc/apparmor.d/local/usr.sbin.libvirtd
:
/usr/local/bin/rhyzome-libvirt ix,
/var/run/rhyzome-libvirt
must exist and be accessible by the user rhyzome-libvirt
is running as
Bootstrapping
TODO: rewrite this, everything's changed. See ../rhyzome-installer.git for the start (first stage) of the bootstrapping process. Second and third stage
are handled in bootstrapping/
in this repo.
Dev setup
The server component can be tested locally with containers just like most of the other parts of rhyzome.
The client component must run on a system with libvirt and openvswitch, both of which I installed on my dev machine. To develop on the client, bring
up the server with the rest of the services like normal (use start-services.sh
in the local dev repo), copy rhyzome-libvirt.localdev.json
to
rhyzome-libvirt.json
and run the client with go run ./cmd/rhyzome-libvirt
.