Cost (including tax and delivery) was $54 (£33).
New in nbdkit ≥ 1.1.6, you can run nbdkit as a “captive process” under external programs like qemu or guestfish. This means that nbdkit runs for as long as qemu/guestfish is running, and when they exit it cleans up and exits too.
Here is a rather involved way to boot a Fedora 20 guest:
$ virt-builder fedora-20 $ nbdkit file file=fedora-20.img \ --run 'qemu-kvm -m 1024 -drive file=$nbd,if=virtio'
--run parameter is what tells nbdkit to run as a captive under
$nbd on the qemu command line is substituted automatically with the right
nbd: URL for the port or socket that nbdkit listens on. As soon as qemu-kvm exits, nbdkit is killed and cleaned up.
Here is another example using guestfish:
$ nbdkit file file=fedora-20.img \ --run 'guestfish --format=raw -a $nbd -i' Welcome to guestfish, the guest filesystem shell for editing virtual machine filesystems and disk images. Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell Operating system: Fedora release 20 (Heisenbug) /dev/sda3 mounted on / /dev/sda1 mounted on /boot ><fs>
The main use for this is not to run the nbdkit file plugin like this, but in conjunction with perl and python plugins, to let people easily open and edit OpenStack Glance/Cinder and other unconventional disk images.
The virt-builder templates that we ship just have core packages from each Linux distro. You can install more packages yourself using the
--install option or by writing scripts.
Debian 7 doesn’t have
cloud-init in the base distro, but it is in
wheezy-backports so we have to write a short script that enables wheezy-backports and installs cloud-init from there:
#!/bin/sh set -e # Install wheezy backports. echo 'deb http://ftp.uk.debian.org/debian wheezy-backports main' \ >> /etc/apt/sources.list apt-get -y update # Install cloud-init. apt-get -y install cloud-init
Then we can run virt-builder, telling it to run the script during the build so that cloud-init will be available in the final image:
virt-builder debian-7 \ --edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,' \ --run install-cloud-init.sh
If you boot this guest, you will see cloud-init messages as it downloads the metadata and continues the customization.
--edit option there is necessary to enable virtual consoles, so you can actually see messages being printed during boot. It will work without that option, but you won’t be able to see any messages.)
I’ll be at devconf.cz this weekend in Brno (7th-9th Feb 2014).
I’m going to submit a lightning talk (10 mins) about virt-builder.
However lightning talks don’t happen unless you vote for me to speak! On Friday and Saturday there will be a board in the foyer where you see the talks listed and can vote for the talk(s) you want to hear. The talks themselves happen from 5.30pm on the same days.