Skip to content
/ vm Public

vm -- Manage KVM/QEMU virtual machines

License

Notifications You must be signed in to change notification settings

robur-coop/vm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vm -- Manage KVM/QEMU virtual machines

There are many KVM management tools out there. This one is mine.

It is primarily intended to support the use case of running throwaway KVM/QEMU VMs (not unikernels) for a CI system (see examples/). An eventual secondary use case is to provide a comfortable CLI for throwaway VM management on a development machine.

Therefore, it:

  • is strictly opinionated and minimalist,
  • only tested on Debian GNU/Linux 10.x as a host system,
  • only supports LVM with thin provisioning for storage,
  • only supports macvtap or bridged networking,
  • assumes that the underlying network is an isolated VLAN with DHCP and DNS service provided elsewhere.

Installation

Dependencies

  • Debian GNU/Linux 10.x x86_64 as a host system.
  • LVM, thin-provisioning-tools, socat, qemu-system-x86.
  • rng-tools5 (recommended, see below).
  • ssvnc (optional).

Rough steps

This is for an install from scratch, as root:

make
sudo make install
# READ and edit the script to suit (at least changing the volume group name)
sudo ./install.sh
# READ and edit /etc/vm/config.sh (at least changing the volume group name)

The defaults are to use bridge mode for networking, using vmbr0. For an example of how to set up vmbr0, see examples/vmbr0.

For vm console to work directly on the host, install ssvnc. If you only need to access consoles via the SSH forwarding functionality, copy src/vm-console.sh to your client host and install ssvnc there. In either case, you do not need the JRE dependency of ssvnc.

Known issues/caveats

  • Not much documentation, but the vm commands should be self-explanatory.
  • Due to the need to manipulate LVM volumes, most vm commands must be run as root.
  • vm create and vm clone should be safe to execute in parallel, but this has not (yet) been extensively tested under load. All other VM-specific operations on the same VM should not be called in parallel.
  • The current network setup relies on an undocumented external dnsmasq configuration, I'd like to replace this with a MirageOS unikernel.
  • Running VMs regularly will quickly exhaust the host system kernel's entropy pool, leading to unexpected hangs of user processes trying to read /dev/random. Install rng-tools5 to start an rngd service feeding entropy from hardware sources into the host kernel's entropy pool. The guest VM is configured with a virtio-rng device which the guest OS should use as an entropy source.

Releases

No releases published

Packages

No packages published