Virt Maker is a command line tool for automating the creation of disk images heavily centered around libguestfs and quick turnaround.
It utilizes a straight-forward template system to define a specification for how an image needs to be built and uses snapshotting and rolling hashes to fast-forward over known good completed steps.
The thesis of this project is to provide a tool that can support rapid appliance image creation for virtualization environments where the boot volume is considered ephemeral and can be replaced quickly.
Template files will generate specs that define where an initial image comes from, what offline (or online in certain scenarios) steps need to run in order to configure the image, and once complete; how to store the resulting image.
$ virt-maker build -f examples/10-basic/template.yml
Since the template has already been built, the second run will be instant. This is because all the steps have been cached and the final image is already complete.
[ FILE ] examples/10-basic/template.yml: Starting
[IMPORT] examples/10-basic/template.yml: {'image': 'centos-7.8', 'size': '6G'}
[ RUN ] examples/10-basic/template.yml: yum clean all
[FIRSTB] examples/10-basic/template.yml: yum update -y
[HOSTNA] examples/10-basic/template.yml: 10-basic
[EXPORT] examples/10-basic/template.yml: {'path': 'images/10-basic.qcow2'}
usage: virt-maker [-h] [-v] [-V] {build,cache,runners} ...
positional arguments:
{build,cache,runners}
Actions
optional arguments:
-h, --help show this help message and exit
-v, --verbose
-V, --version Show virt-maker version
usage: virt-maker build [-h] -f BUILD_FILES [BUILD_FILES ...] [-p BUILD_PARAMS [BUILD_PARAMS ...]] [-F] [-X]
optional arguments:
-h, --help show this help message and exit
-f BUILD_FILES [BUILD_FILES ...], --file BUILD_FILES [BUILD_FILES ...]
Path to template file(s)
-p BUILD_PARAMS [BUILD_PARAMS ...], --param BUILD_PARAMS [BUILD_PARAMS ...]
Set or override template parameter
-F, --force Force build from scratch
-X, --force-export Force export to re-run
usage: virt-maker cache [-h] [-H] {clean,usage}
positional arguments:
{clean,usage}
options:
-h, --help show this help message and exit
-H, --human-readable Output as human-readable values
usage: virt-maker runners [-h] {steps,importers,exporters}
positional arguments:
{steps,importers,exporters}
Show the types of runners
optional arguments:
-h, --help show this help message and exit
Virt Maker uses a YAML file to define a template generating a build spec that consists of input parameters
and the build specification template itself. The params section is used to define the input parameters
and the spec section is used to define the build steps.
params:
foo: bar
spec:
import:
some-import-runner:
runner:
args:
steps:
- some-step-runner:
runner:
args:
- another-step-runner:
more:
args:
export:
some-export-runner:
some-arg: '{{ foo }}'See the Examples directory.
- scp
- virt-customize
- qemu-system-x86_64 or /usr/libexec/qemu-kvm
- virt-sysprep
- wget
- virt-resize
- truncate
- virt-builder
- cp or pv
- mv
- virt-sparsify
- words
- tesseract
- libguestfs-xfs
- libguestfs-zfs
- libguestfs-ufs
- libguestfs-rsync
- libguestfs-winsupport
- virt-win-reg
- virt-v2v
- xz
- gzip
- lz4c
pip install .
dnf install -y python-pip epel-release
pip install .
export LIBGUESTFS_BACKEND=direct
dnf install -y words qemu-kvm guestfs-tools wget xz lz4 pv tesseract
virt-maker build -f examples/10-basic/template.yml

