--- /dev/null
+bindings
+history
--- /dev/null
+<link rel="stylesheet" href="style.css" type="text/css"/>
+<script src="code.js" type="text/javascript"></script>
+
+<div id="titlepage">
+<p class="title">
+ Programming libvirt & the virt tools <br/>
+</p>
+<p><author>
+ Richard W.M. Jones <br/>
+ <small>rjones @ redhat.com</small>
+</author></p>
+<p class="subtitle">
+ <b>After the short talk, we have 20 minutes for Q&A.</b> <br/>
+ Ask me anything about: <br/>
+ virtualization with KVM in CentOS, <br/>
+ libvirt, libguestfs, virt-* tools, virsh, <br/>
+ OpenStack, oVirt, RHEV-M, RHEL 7 …
+</p>
+</div>
+
+<img id="centoslogo" src="centos-logo.png" />
--- /dev/null
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<link rel="stylesheet" href="style.css" type="text/css"/>
+<script src="code.js" type="text/javascript"></script>
+
+<h1>Some definitions</h1>
+
+<ul>
+<li> virtualization
+<li> hypervisor
+<li> libvirt
+</ul>
--- /dev/null
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<link rel="stylesheet" href="style.css" type="text/css"/>
+<script src="code.js" type="text/javascript"></script>
+
+<h1>Some definitions</h1>
+
+<ul>
+<li> cloud
+<li> self-service vs managed
+<li> public vs private
+</ul>
--- /dev/null
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<link rel="stylesheet" href="style.css" type="text/css"/>
+<script src="code.js" type="text/javascript"></script>
+
+<h1>Some definitions</h1>
+
+<ul>
+<li> disk image
+<li> libguestfs
+</ul>
--- /dev/null
+#!/bin/bash -
+
+source functions
+
+# History.
+remember 'sudo virsh list --all'
+remember 'sudo virsh dumpxml f18x64 | highlight | less -r'
+
+echo "Locally installed guests"
+
+cd 1000.d
+terminal
--- /dev/null
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<link rel="stylesheet" href="style.css" type="text/css"/>
+<script src="code.js" type="text/javascript"></script>
+
+<h1>Creating an overlay disk</h1>
+
+<img src="2000-overlay-disk.svg" height="800"/>
--- /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="744.09448819"
+ height="1052.3622047"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.4 r9939"
+ sodipodi:docname="New document 1">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow1Lstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lstart"
+ style="overflow:visible">
+ <path
+ id="path3785"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"
+ transform="scale(0.8) translate(12.5,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lend"
+ style="overflow:visible;">
+ <path
+ id="path3788"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;"
+ transform="scale(0.8) rotate(180) translate(12.5,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.70710678"
+ inkscape:cx="198.5"
+ inkscape:cy="753.10156"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1285"
+ inkscape:window-height="720"
+ inkscape:window-x="0"
+ inkscape:window-y="31"
+ inkscape:window-maximized="0" />
+ <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></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="fill:#999c99;fill-opacity:1;stroke:#000000;stroke-width:0.99921262;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+ id="rect2985"
+ width="441.42856"
+ height="213.57143"
+ x="100"
+ y="51.647896" />
+ <text
+ xml:space="preserve"
+ style="font-size:28px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+ x="134"
+ y="120.36218"
+ id="text2987"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan2989"
+ x="134"
+ y="120.36218">20 GB</tspan><tspan
+ sodipodi:role="line"
+ x="134"
+ y="155.36218"
+ id="tspan2991">raw</tspan><tspan
+ sodipodi:role="line"
+ x="134"
+ y="190.36218"
+ id="tspan2993">backing disk</tspan><tspan
+ sodipodi:role="line"
+ x="134"
+ y="225.36218"
+ id="tspan2995">readonly</tspan></text>
+ <rect
+ y="319.64789"
+ x="190"
+ height="149.57141"
+ width="180.42859"
+ id="rect2997"
+ style="fill:#999c99;fill-opacity:1;stroke:#000000;stroke-width:0.99921262;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+ <text
+ sodipodi:linespacing="125%"
+ id="text2999"
+ y="369.36218"
+ x="224"
+ style="font-size:28px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+ xml:space="preserve"><tspan
+ y="369.36218"
+ x="224"
+ id="tspan3001"
+ sodipodi:role="line">20 GB</tspan><tspan
+ id="tspan3003"
+ y="404.36218"
+ x="224"
+ sodipodi:role="line">qcow2</tspan><tspan
+ id="tspan3007"
+ y="439.36218"
+ x="224"
+ sodipodi:role="line">overlay</tspan></text>
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;marker-end:none;marker-start:url(#Arrow1Lstart)"
+ d="m 278,318.36218 -1,-53"
+ id="path3011"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4225"
+ d="m 278,524.36218 -1,-53"
+ style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:none;marker-start:url(#Arrow1Lstart)" />
+ <rect
+ style="fill:#dc9c99;fill-opacity:1;stroke:#000000;stroke-width:0.99921262000000000;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+ id="rect4227"
+ width="180.42859"
+ height="149.57141"
+ x="190"
+ y="525.64789"
+ ry="19" />
+ <text
+ xml:space="preserve"
+ style="font-size:28px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+ x="206"
+ y="583.36218"
+ id="text4229"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ x="206"
+ y="583.36218"
+ id="tspan4235">hypervisor</tspan><tspan
+ sodipodi:role="line"
+ x="206"
+ y="618.36218"
+ id="tspan4241">(KVM)</tspan></text>
+ </g>
+</svg>
--- /dev/null
+#!/bin/bash -
+
+source functions
+
+# History.
+remember 'qemu-img create -f qcow2 -b /dev/fedora/f18x64 /tmp/overlay.qcow2'
+remember 'qemu-img info /tmp/overlay.qcow2'
+remember 'virt-install --import --disk path=/tmp/overlay.qcow2,bus=virtio,format=qcow2 -n dojo -r 2048'
+remember 'virt-viewer dojo'
+remember 'virsh list'
+remember 'virsh dumpxml dojo | highlight | less -r'
+remember 'qemu-img info /tmp/overlay.qcow2'
+
+echo "Set up an overlay disk"
+
+cd 2100.d
+terminal
--- /dev/null
+#!/bin/bash -
+
+source functions
+
+# History.
+remember 'virt-ls -lR /dev/fedora/f18x64 / | sort -k4 > old-files'
+remember 'virt-ls -lR /tmp/overlay.qcow2 / | sort -k4 > new-files'
+remember 'diff -ur old-files new-files | less'
+
+echo "Differences"
+
+cd 2200.d
+terminal
--- /dev/null
+new-files
+old-files
--- /dev/null
+#!/bin/bash -
+
+source functions
+
+# History.
+remember 'virt-sysprep --hostname dojo.example.com -d dojo'
+
+echo "Sysprep the guest"
+
+cd 2300.d
+terminal
--- /dev/null
+#!/bin/bash -
+
+source functions
+
+# History.
+remember 'ls -l'
+remember 'emacs -nw set-root-password.pl'
+remember './set-root-password.pl'
+remember 'virsh start dojo'
+remember 'virt-viewer dojo'
+
+echo "Set root password"
+
+cd 2400.d
+terminal
--- /dev/null
+#!/usr/bin/perl -w
+
+use strict;
+#use Sys::Virt;
+use Sys::Guestfs;
+
+my $vm = "dojo";
+my $newpw = "1234567";
+
+my $salt;
+my @chars = ("A".."Z", "a".."z", "0".."9", ".", "/");
+$salt .= $chars[rand @chars] for 1..16;
+my $crypted = crypt ($newpw, '$5$' . $salt . '$');
+
+my $g = Sys::Guestfs->new ();
+$g->set_trace (1);
+$g->add_domain ($vm, libvirturi => "qemu:///session");
+$g->launch ();
+$g->mount ("/dev/fedora/root", "/");
+
+my @shadow = $g->read_lines ("/etc/shadow");
+s/^root:.*?:/root:$crypted:/ foreach @shadow;
+
+$g->write ("/etc/shadow", join ("\n", @shadow) . "\n");
+$g->chmod (0, "/etc/shadow");
+
+$g->touch ("/.autorelabel");
--- /dev/null
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<link rel="stylesheet" href="style.css" type="text/css"/>
+<script src="code.js" type="text/javascript"></script>
+
+<h1>Some things you can do with libvirt ...</h1>
+
+<ul>
+<li> cross-hypervisor control of VMs including containers
+<li> remote management
+<li> migration
+<li> storage and network management
+<li> snapshots
+<li> secrets
+<li> handle SANs, iSCSI, gluster
+<li> multiple language bindings
+</ul>
--- /dev/null
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<link rel="stylesheet" href="style.css" type="text/css"/>
+<script src="code.js" type="text/javascript"></script>
+
+<h1>Some things you can do with libguestfs ...</h1>
+
+<div id="twocolumns">
+<ul>
+<li> differences between guests
+<li> sysprep
+<li> add users, change passwords
+<li> security audits
+<li> resize disk images
+<li> creating templates & clone
+<li> sparsify
+<li> monitor
+<li> dump filesystem contents (eg to tar)
+<li> injecting files
+<li> edit single files
+<li> what's in a disk image?
+<li> run stuff at next boot
+<li> edit Windows registry
+<li> edit Linux configuration
+<li> multiple language bindings
+<li> see: <a href="http://libguestfs.org/guestfs-recipes.1.html">guestfs-recipes(1)</a>
+</ul>
+</div>
--- /dev/null
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<link rel="stylesheet" href="style.css" type="text/css"/>
+<script src="code.js" type="text/javascript"></script>
+
+<h1>Some things you can do with OpenStack ...</h1>
+
+<ul>
+<li> public or private cloud
+<li> self-service
+<li> import from VMware (RHEL 7)
+<li> import from physical machines (RHEL 7)
+<li> heavily backed by Red Hat (~20 developers, top contributor)
+</ul>
--- /dev/null
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<link rel="stylesheet" href="style.css" type="text/css"/>
+<script src="code.js" type="text/javascript"></script>
+
+<h1>Some things you can do with oVirt ...</h1>
+
+<ul>
+<li> centralized management
+<li> high availability
+<li> load balancing
+<li> Virtual Desktops (VDI)
+<li> import from VMware (RHEL 6)
+<li> import from physical machines (RHEL 6)
+</ul>
--- /dev/null
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<link rel="stylesheet" href="style.css" type="text/css"/>
+<script src="code.js" type="text/javascript"></script>
+
+<h1>Q & A</h1>
+
+<table width="95%">
+<tr>
+<td valign="top" width="50%">
+<ul>
+<li> <a href="http://libvirt.org">libvirt.org</a>
+<li> <a href="http://libguestfs.org">libguestfs.org</a>
+<li> <a href="http://openstack.org">openstack.org</a>
+<li> <a href="http://openstack.redhat.com">openstack.redhat.com</a>
+<li> <a href="http://ovirt.org">ovirt.org</a>
+</ul>
+
+<p>
+<small>Presentation software:</small> <b>Tech Talk PSE</b>
+</p>
+<p>
+<small>Download the presentation and/or the presentation software from</small>
+<a href="http://git.annexia.org">git.annexia.org</a>
+</p>
+
+</td>
+<td valign="top" width="50%">
+<p>
+Ask me anything about:
+</p>
+<ul>
+<li> virtualization with KVM in CentOS
+<li> libvirt
+<li> libguestfs
+<li> virt-* tools
+<li> virsh
+<li> OpenStack
+<li> oVirt/RHEV-M
+<li> RHEL 7
+<li> …
+</ul>
+</td>
+</tr>
+</table>
--- /dev/null
+This is a general libvirt/virtualization/libguestfs talk given at the
+2013 CentOS Dojo in Aldershot.
+
+http://wiki.centos.org/Events/Dojo/Aldershot2013
+
+The whole talk is designed to take around 15-20 minutes, with an open
+Q&A about virtualization at the end lasting another 20 minutes.
+
+To run the talk you'll need Tech Talk PSE >= 1.1.0. If you don't have
+Tech Talk then just open up the HTML slides in a web browser.
+
+To start the talk, use `./run'.
--- /dev/null
+# -*- shell-script -*-
+
+# Colour ls.
+if [ -f /etc/profile.d/colorls.sh ]; then . /etc/profile.d/colorls.sh; fi
+
+# Fancy prompt colours (see
+# https://wiki.archlinux.org/index.php/Color_Bash_Prompt)
+promptcol='\e[0;32m' ;# colour for the prompt
+commandcol='\e[1;31m' ;# colour for the typed command
+outputcol='\e[0m' ;# colour for command output
+
+export PS1="\n\[$promptcol\]\$ \[$commandcol\]"
+
+trap 'echo -ne "$outputcol"' DEBUG
+
+# Load key bindings (if any).
+bind -f $talkdir/bindings
--- /dev/null
+#!/bin/bash -
+
+virsh destroy dojo
+virsh undefine dojo
+
+rm /tmp/overlay.qcow2
--- /dev/null
+# -*- shell-script -*-
+# This creates some standard functions. See also $talkdir/bashrc
+# which runs in the same bash context as the terminal.
+
+# Place any local environment variables and settings in "local".
+if [ -f local ]; then source local; fi
+
+# Environment variables.
+export HISTFILE=$talkdir/history
+export PATH=$talkdir:$PATH
+export EDITOR="emacs -nw"
+
+# remember <command> <args ...>
+#
+# This function does two things: (1) It adds the command and arguments
+# to the shell history, so that commands can be recalled using up
+# arrow or reverse search. (2) It makes a function key recall the
+# command. The first command is assigned to F2, the second to F3 and
+# so forth.
+
+rm -f $HISTFILE
+touch $HISTFILE
+rm -f $talkdir/bindings
+touch bindings
+
+fnum=2
+keys=(- OP OQ OR OS '[15~' '[17~' '[18~' '[19~' '[20~' '[21~')
+
+remember ()
+{
+ echo "$@" >> $HISTFILE
+ echo \"\\e${keys[$fnum]}\":\"\\C-k \\C-u"$@"\" >> $talkdir/bindings
+ ((fnum++))
+}
+
+terminal ()
+{
+ chmod -w $HISTFILE
+ /bin/bash --rcfile $talkdir/bashrc "$@"
+}
--- /dev/null
+#!/bin/sh -
+source-highlight -s xml -o STDOUT -f esc
--- /dev/null
+*** BEFORE THE TALK ***
+
+./cleanup
+./run
+
+*** 1000 guests installed on my laptop for testing ***
+
+virsh list .. showing guests
+
+virsh dumpxml ... showing individual guests
+
+XML vs the world?
+
+*** 2000 create an overlay disk ***
+
+Because I don't want to change my test guests ...
+
+Create overlay disk
+ diagram
+
+ qemu-img create -f qcow2 -b /dev/fedora/f18x64 /tmp/f18.qcow2
+ qemu-img info /tmp/f18.qcow2
+ virt-install --import --disk path=/tmp/f18.qcow2,bus=virtio,format=qcow2 -n temp -r 2048
+ virt-viewer --connect qemu:///session temp
+ virsh list
+ virsh dumpxml temp
+
+Run 'shutdown' inside the guest.
+
+ qemu-img info /tmp/f18.qcow2
+# virsh undefine temp
+
+*** 2200 differences between backing and overlay disk ***
+
+ differences between guests
+
+*** 2300 sysprep overlay disk ***
+
+ sysprep it
+
+*** 2400 set root password ***
+
+ set root password using some perl
+
+*** 6000 Mention some other things we can do with libvirt ... ***
+
+*** 7000 with libguestfs ... ***
+
+*** 8000 with Open Stack ... ***
+
+ mostly equivalent in features to Amazon EC2
+
+*** 9000 with oVirt ... ***
+
+ comparable to Virtual Center
+
+*** 9900 Q&A ***
+
+--- If there are no immediate questions, then:
+
+* How many people are using virtualization at all?
+
+* How many people have virtualized some of their servers?
+
+* How many people are using Amazon EC2 or another public cloud?
+
+* How many people are running a public VPS or public cloud?
+
+* How many people are running a private cloud or cloud-like service
+ within their company?
+
+* How many people are running VMware?
+
+* How many people are running Xen?
+
+* How many people are running KVM?
+
+* What would stop you from moving away from VMware?
+
+* What would stop you from moving to libvirt?
+
+* What would stop you from moving to Open Stack or oVirt?
--- /dev/null
+#!/bin/bash -
+# Run the talk.
+
+# Avoid GNOME keyring stupidity
+export GNOME_KEYRING_CONTROL=
+export GNOME_KEYRING_PID=
+
+# Clean up everything.
+find -name '*~' -delete
+
+# Get everything into the cache.
+guestfish -a /dev/null run > /dev/null
+
+if [ "`hostname`" = "choo.home.annexia.org" ]; then
+ # SELinux permissive(!) This is because of a libvirt bug.
+ sudo setenforce Permissive
+
+ # Make sure the disk images are owned by root.disk.
+ sudo chown root.disk /dev/fedora/{archlinux20121201x64,f18*,f20*,ubuntu*,win*}
+fi
+
+# Run techtalk.
+techtalk-pse
--- /dev/null
+/* Red Hat red is rgb(204,0,0). */
+
+body {
+ background: url(redhat.png) no-repeat;
+ background-position: 98% 0;
+ font-size: 24pt; /* For max */
+ /* font-size: 20pt; */ /* For 1024x768 */
+ /* font-family: liberation, helvetica; */
+ font-family: helvetica;
+}
+
+body td { /* why?? */
+ /*font-size: 28pt;*/
+ font-size: 20pt;
+}
+
+h1 {
+ color: rgb(204,0,0);
+ /*font-size: 48px;*/
+ font-size: 40px;
+ top: 8;
+ left: 0;
+ border-bottom: 2px solid rgb(204,0,0);
+}
+
+b {
+ color: rgb(204,0,0);
+}
+
+/* Title page */
+div#titlepage {
+ margin-top: 100px;
+ text-align: center;
+}
+
+div#titlepage p.title {
+ color: rgb(204,0,0);
+ font-weight: bold;
+ font-size: 48px;
+}
+
+div#titlepage p.subtitle {
+ color: black;
+ font-weight: bold;
+ font-size: 36px;
+}
+
+div#titlepage p.subtitle b {
+ color: rgb(204,0,0);
+ font-weight: bold;
+ font-size: 36px;
+}
+
+div#titlepage author {
+ font-size: 36px;
+}
+
+/* CentOS logo on title page. */
+img#centoslogo {
+ position: absolute;
+ bottom: 25px;
+ left: 76px;
+ background-image: url('centos-bg.png');
+ padding-left: 20px;
+ padding-right: 100px;
+}
+
+/* Multi-column */
+div#twocolumns {
+ -moz-column-count: 2;
+ -webkit-column-count: 2;
+ column-count: 2;
+}
+
+/* Code */
+pre.code {
+ margin-left: 1em;
+ background: #eee;
+}
+
+code {
+ color: rgb(204,0,0);
+}
+
+/* Bullet points */
+li {
+ padding-bottom: 16px;
+}
+
+/* Logo */
+img#fish {
+ position: absolute;
+ top: 128px;
+ right: 32px;
+ width: 200px;
+ /*height: 256px;*/
+}
\ No newline at end of file