VirtPilot is a CLI wrapper over libvirt that provides fast shortcuts for common VM workflows.
It helps you avoid repetitive virsh + manual disk/metadata steps by supporting:
- VM creation from QCOW2/raw base images (using
qemu-img) - Attach additional disks (
qemu-img+ libvirt device hotplug) - Basic VM lifecycle management (start/stop/delete/list/show)
- SSH convenience helper
- Optional cloud-init + first-boot customization
- libvirt (daemon + a usable system/session connection)
- qemu-img
- libguestfs-tools
$ make
$ sudo make installAfter installing:
$ virtpilot -hMost commands use the libvirt connection URI.
- Default:
qemu:///system - Flag:
-c, --connect <uri>
Example:
$ virtpilot -c qemu:///system list$ virtpilot create -i cirros.qcow2 simpleVM$ virtpilot create \
-i fedora-30-x86_64-kvm.qcow2 \
--pool=vms \
--first-boot=update.sh \
--size=20 \
--password='t0pS3cr3t' \
--public-key=/home/me/.ssh/id_rsa.pub \
--cpu=2 \
--memory=4096 \
rhel8-virtpilotupdate.sh can be a simple script, for example:
#!/bin/bash
dnf clean all
dnf update -y
dnf install httpd
systemctl enable --now httpd$ virtpilot add-disk <vm-name> <disk-size>
# Example:
$ virtpilot add-disk test-vm 10GBRun virtpilot <command> --help for full flag details.
Creates a new libvirt domain.
Required:
-i, --image <path-or-url>(backing image, required)
Common flags:
--format, -f <qcow2|raw>(default:qcow2)--size, -s <GiB>(default:10)--pool, -p <pool-name>(default:default)--cpu, -c <n>(default:1)--memory, -m <MiB>(default:1024)--nets <net1,net2,...>(default:default)--cloud-init(enable cloud-init)--password <root-password>--ssh-user <user>(default:root)--public-key <path>(default:$HOME/.ssh/id_rsa.pub)--first-boot <script-path>
Example:
$ virtpilot create -i ubuntu.qcow2 --pool=vms --size=20 vm1Adds and attaches a disk to a VM.
--format, -f <qcow2|raw>(default:qcow2)--bus, -b <virtio|...>(default:virtio)
Example:
$ virtpilot add-disk vm1 25GB --bus=virtioLists libvirt domains.
Supports -o/--output:
yamljsontemplate(render a provided template)
Example:
$ virtpilot list
$ virtpilot list -o jsonShows basic VM info (vCPUs, memory, and NIC IPs when available).
$ virtpilot show vm1Runs an SSH connection to a VM (helper around ssh).
Example:
$ virtpilot ssh root@vm1
$ virtpilot ssh vm1 # user part can be omitted
$ virtpilot ssh root@vm1 -o IdentitiesOnly=yesStarts one or more VMs.
$ virtpilot start vm1 vm2Stops one or more VMs.
-f, --forceuses a shutdown-style stop.
$ virtpilot stop vm1
$ virtpilot stop -f vm1Deletes one or more VMs.
$ virtpilot delete vm1 vm2Generates shell completion.
Bash:
. <(virtpilot completion bash)ZSH:
. <(virtpilot completion zsh)$ make test