--- /dev/null
+#!/bin/bash -
+
+VIRT_BUILDER_SOURCE=file://$HOME/d/libguestfs/builder/website/index.asc
+export VIRT_BUILDER_SOURCE
+
+guests=( $(virt-builder -l | awk '{print $1}') )
+formats=( raw qcow2 )
+count=0
+
+while true; do
+ guest=${guests[$(($RANDOM % ${#guests[*]}))]}
+ format=${formats[$(($RANDOM % ${#formats[*]}))]}
+
+ ((count++)); echo -e "\n*** Building guest # $count\n"
+
+ virt-builder $guest --output $guest.img \
+ --format $format \
+ --no-sync \
+ --hostname test$count.example.com \
+ --timezone Europe/Brussels \
+ --write '/etc/motd:Welcome to FOSDEM 2014'
+
+ rm $guest.img; # Save space!
+done
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="493.5625"
+ height="363.59375"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.4 r9939"
+ sodipodi:docname="cheese0.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="255.24097"
+ inkscape:cy="183.53842"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1366"
+ inkscape:window-height="715"
+ inkscape:window-x="0"
+ inkscape:window-y="31"
+ inkscape:window-maximized="1"
+ fit-margin-top="10"
+ fit-margin-left="10"
+ fit-margin-right="10"
+ fit-margin-bottom="10" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(-131.78125,-91.28125)">
+ <rect
+ style="fill:none;stroke:#404040;stroke-width:5;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+ id="rect2986"
+ width="473.57144"
+ height="340"
+ x="11.428572"
+ y="12.165178"
+ transform="translate(131.78125,91.28125)"
+ rx="0" />
+ </g>
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="493.5625"
+ height="363.59375"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.4 r9939"
+ sodipodi:docname="cheese.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.7"
+ inkscape:cx="258.18547"
+ inkscape:cy="183.53842"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1366"
+ inkscape:window-height="715"
+ inkscape:window-x="0"
+ inkscape:window-y="31"
+ inkscape:window-maximized="1"
+ fit-margin-top="10"
+ fit-margin-left="10"
+ fit-margin-right="10"
+ fit-margin-bottom="10" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(-131.78125,-91.28125)">
+ <g
+ id="g3776"
+ style="stroke:#404040;stroke-width:5;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none">
+ <path
+ id="rect2985"
+ d="m 144.28125,103.78125 0,148.59375 c 6.59985,-2.75416 13.83928,-4.3125 21.4375,-4.3125 30.77015,0 55.71875,24.9486 55.71875,55.71875 0,30.77015 -24.9486,55.71875 -55.71875,55.71875 -7.59822,0 -14.83765,-1.52709 -21.4375,-4.28125 l 0,87.15625 112.15625,0 c -6.743,-9.21395 -10.71875,-20.58253 -10.71875,-32.875 0,-30.77015 24.9486,-55.71875 55.71875,-55.71875 30.77015,0 55.71875,24.9486 55.71875,55.71875 0,12.29247 -4.007,23.66105 -10.75,32.875 l 187.1875,0 c -6.743,-9.21395 -10.75,-20.58253 -10.75,-32.875 0,-30.77015 24.9486,-55.71875 55.71875,-55.71875 12.9328,0 24.82633,4.41898 34.28125,11.8125 l 0,-136.5 c -23.84271,-6.31212 -41.40625,-28.04729 -41.40625,-53.875 0,-25.82771 17.56354,-47.56288 41.40625,-53.875 l 0,-17.5625 -228.78125,0 c 5.55139,8.66352 8.78125,18.94669 8.78125,30 0,30.77015 -24.91735,55.71875 -55.6875,55.71875 -30.77015,0 -55.71875,-24.9486 -55.71875,-55.71875 0,-11.05331 3.22986,-21.33648 8.78125,-30 l -145.9375,0 z"
+ style="fill:none;stroke:#404040;stroke-width:5;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+ inkscape:connector-curvature="0" />
+ <path
+ transform="translate(97.142859,138.57143)"
+ sodipodi:type="arc"
+ style="fill:none;stroke:#404040;stroke-width:5;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+ id="path3769"
+ sodipodi:cx="337.14285"
+ sodipodi:cy="133.79076"
+ sodipodi:rx="55.714287"
+ sodipodi:ry="55.714287"
+ d="m 392.85714,133.79076 c 0,30.77015 -24.94414,55.71428 -55.71429,55.71428 -30.77015,0 -55.71428,-24.94413 -55.71428,-55.71428 0,-30.77015 24.94413,-55.714291 55.71428,-55.714291 30.77015,0 55.71429,24.944141 55.71429,55.714291 z" />
+ </g>
+ </g>
+</svg>
--- /dev/null
+FOSDEM lightning talk
+Sunday 2nd Feb 2014, 16:00, H.2215 Ferrer
+https://fosdem.org/2014/schedule/event/libguestfs/
+
+Advanced disk image management with libguestfs
+libguestfs, virt-builder, virt-sparsify, virt-sysprep
+
+----------------------------------------------------------------------
+
+
+Good afternoon. Today I'm going to talk about libguestfs
+with is a suite of tools for looking inside and modifying
+virtual machine disk images.
+
+
+virt-builder
+------------
+
+First off, a new tool that we've written to create virtual machines.
+
+[ Show the builder.sh script ]
+[ Run the builder.sh script ]
+
+I'll come back to this script at the end of the talk.
+
+virt-builder can:
+
+ - output raw, qcow2 and other formats
+ - resize using [virt-resize]
+ - write a random seed
+ - set a hostname
+ - edit configuration files
+ - install packages
+ - run custom scripts
+ * at build time
+ * or at first boot
+
+Libguestfs can safely and securely inspect and modify disk
+images without needing root.
+
+Virt-builder doesn't install guests from scratch. Instead it
+takes clean, cryptographically signed, compressed templates and uses
+libguestfs to customize them.
+
+
+
+Preparing the templates
+-----------------------
+
+virt-builder comes with a handful of templates.
+
+You can also prepare your own.
+
+Over the years we have come up with a good way
+to prepare and distribute reasonably small templates
+
+ virt-install (or Oz)
+ v
+ virt-sysprep
+ v
+ virt-sparsify
+ v
+ xz
+
+virt-install runs a regular OS install, using anaconda,
+debian-installer, etc. You can automate this completely
+using kickstart or preseed.
+
+virt-sysprep unconfigures the guest. Using libguestfs it
+removes SSH host keys, log files, network configuration,
+user accounts and so on.
+
+virt-sparsify
+-------------
+
+virt-sparsify uses libguestfs to make guests sparse a.k.a.
+thin-provisioned.
+
+It looks for unused space:
+
+ - in filesystems
+
+ - in LVM physical volumes
+
+ - swap partitions
+
+Including non-zeroed, but unused blocks.
+
+It converts that to sparseness in the host file.
+
+
+xz
+--
+
+Finally xz compresses the template. We like xz for several reasons:
+
+ - nearly best in class compression
+
+ - preserves sparseness
+
+ - compressed files can be random accessed [nbdkit]
+
+ - virt-builder includes parallel uncompress
+
+
+Results
+-------
+
+ disk apparent final
+CirrOS 0.3.1 39 18 11 MB
+Debian 7 4096 719 142 MB
+Fedora 20 6144 826 174 MB
+Ubuntu 13.10 4096 1019 187 MB
+
+
+[At the end of the talk, show the progress of the builder script.]
+
+
+* libguestfs resources and other tools