QEMU VM management scripts
- Shell 76.8%
- Makefile 23.2%
| vm | microvm: add default virtiofs boot share | |
| LICENSE | epoch | |
| Makefile | refactor stuff, add makefile and systemd unit, stop relying on tmux | |
| README.md | refactor stuff, add makefile and systemd unit, stop relying on tmux | |
| vm.rc | openrc: add needed checkpaths and logs | |
| vm@.service | refactor stuff, add makefile and systemd unit, stop relying on tmux | |
vm-utils
Scripts to manage QEMU-based VMs.
Why?
I didn't like libvirt.
Installation
Copy the vm folder to your /etc, or elsewhere and adjust the rootdir= statements in the scripts/ files.
Optionally, make symlinks for vm-<script> to /etc/vm/scripts/<script> in your /usr/local/sbin,
and copy init.rc to /etc/init.d/vm for an OpenRC init script. It can be copied as vm.<name> as well to only start a specific VM.
You're gonna want to have socat and qemu-system-x86_64 installed, as well as KVM (CONFIG_KVM) and macvtap (CONFIG_MACVLAN) support in your kernel.
Setup
These scripts presume a setup like Hetzner, where IPv4s and IPv6 ranges are directly routed to your machine and a macvtap interface can accept them.
Overview
machines.d: Main VM configurations for QEMU;conf: VM configurations forvm-utils;include: Include files for VM configurations;scripts: Various scripts to automate VM management:start: Start a VM named bymachines.d/<name>.conf;stop: Stop a VM named bymachines.d/<name>conf;attach: Attach to management console of VM named bymachines.d/<name.conf>;launch: Launch VM in current terminal session and attach to management console; used bystartifup/ifdown: Network interface management scripts;
Adding a new VM
- Add an entry in
machines.d, seeexample.conffor format; - Add an entry in
conf, seeexample.conffor format; - Create a new disk:
qemu-img create -f qcow2 /var/vm/disks/<name>qcow2 <size>G; - Start the VM:
scripts/start <name>.
License
WTFPL; see LICENSE for details.