From: Richard W.M. Jones Date: Wed, 23 Oct 2013 10:30:36 +0000 (+0100) Subject: Add 2013 KVM Forum talk. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=0f9f01302256ad0b1bca1ab000211c3cc795dab9;p=libguestfs-talks.git Add 2013 KVM Forum talk. --- diff --git a/2013-kvm-forum/.gitignore b/2013-kvm-forum/.gitignore new file mode 100644 index 0000000..b3e8227 --- /dev/null +++ b/2013-kvm-forum/.gitignore @@ -0,0 +1,3 @@ +*.d/disk.img +bindings +history diff --git a/2013-kvm-forum/0000-introduction.html b/2013-kvm-forum/0000-introduction.html new file mode 100644 index 0000000..a1db4bc --- /dev/null +++ b/2013-kvm-forum/0000-introduction.html @@ -0,0 +1,15 @@ + + + +
+

+ libguestfs
+
+ tools for viewing and modifying
+ virtual machine disk images +

+

+ Richard W.M. Jones
+ rjones @ redhat.com +

+
diff --git a/2013-kvm-forum/1000-overview.html b/2013-kvm-forum/1000-overview.html new file mode 100644 index 0000000..3204ae4 --- /dev/null +++ b/2013-kvm-forum/1000-overview.html @@ -0,0 +1,37 @@ + + + + + +

Libguestfs is ...

+ +
+#include <guestfs.h>
+
+main () {
+  guestfs_h *g =
+      guestfs_create ();
+  guestfs_add_drive_ro (g,
+          "fedora-19.img");
+  guestfs_launch (g);
+  guestfs_mount (g,
+          "/dev/fedora/root");
+  guestfs_download (g,
+          "/etc/fedora-release",
+          "/dev/stdout");
+  guestfs_close (g);
+}
+
+/* link with -lguestfs */
+
diff --git a/2013-kvm-forum/1100-overview.d/create.py b/2013-kvm-forum/1100-overview.d/create.py new file mode 100755 index 0000000..e68dded --- /dev/null +++ b/2013-kvm-forum/1100-overview.d/create.py @@ -0,0 +1,20 @@ +#!/usr/bin/python +import os +import guestfs + +output = "disk.img" +f = open (output, "w") +f.truncate (512 * 1024 * 1024) +f.close () + +g = guestfs.GuestFS () +g.add_drive (output) +g.launch () +devices = g.list_devices () +g.part_disk (devices[0], "mbr") +parts = g.list_partitions () +g.mkfs ("ext4", parts[0]) +g.mount (parts[0], "/") +g.tgz_in ("data.tar.gz", "/") +g.shutdown () +g.close () diff --git a/2013-kvm-forum/1100-overview.d/data.tar.gz b/2013-kvm-forum/1100-overview.d/data.tar.gz new file mode 100644 index 0000000..ed35e76 Binary files /dev/null and b/2013-kvm-forum/1100-overview.d/data.tar.gz differ diff --git a/2013-kvm-forum/1100-overview.term b/2013-kvm-forum/1100-overview.term new file mode 100755 index 0000000..d7f3490 --- /dev/null +++ b/2013-kvm-forum/1100-overview.term @@ -0,0 +1,15 @@ +#!/bin/bash - + +source functions + +# History. +remember 'emacs -nw create.py' +remember './create.py' +remember 'virt-filesystems -a disk.img --all --long -h' +remember 'virt-df -a disk.img -h' +remember 'guestfish --ro -a disk.img -m /dev/sda1' + +echo "Example: Create a disk image" + +cd 1100-overview.d +terminal diff --git a/2013-kvm-forum/2000-tools.html b/2013-kvm-forum/2000-tools.html new file mode 100644 index 0000000..6a8751c --- /dev/null +++ b/2013-kvm-forum/2000-tools.html @@ -0,0 +1,22 @@ + + + + + +
+$ virt-
+virt-alignment-scan virt-image            virt-sparsify
+virt-builder        virt-inspector        virt-sysprep
+virt-cat            virt-install          virt-tar
+virt-clone          virt-list-filesystems virt-tar-in
+virt-convert        virt-list-partitions  virt-tar-out
+virt-copy-in        virt-login-shell      virt-top
+virt-copy-out       virt-ls               virt-viewer
+virt-df             virt-make-fs          virt-what
+virt-edit           virt-pki-validate     virt-win-reg
+virt-filesystems    virt-rescue           virt-xml-validate
+virt-format         virt-resize            
+virt-host-validate  virt-sanlock-cleanup
+
diff --git a/2013-kvm-forum/2100-tools.d/.gitignore b/2013-kvm-forum/2100-tools.d/.gitignore new file mode 100644 index 0000000..06e0920 --- /dev/null +++ b/2013-kvm-forum/2100-tools.d/.gitignore @@ -0,0 +1 @@ +fedora-19.img diff --git a/2013-kvm-forum/2100-tools.term b/2013-kvm-forum/2100-tools.term new file mode 100755 index 0000000..e6a4cda --- /dev/null +++ b/2013-kvm-forum/2100-tools.term @@ -0,0 +1,12 @@ +#!/bin/bash - + +source functions + +# History. +remember 'virt-builder -l' +remember "virt-builder fedora-19 --hostname f19.example.com --firstboot-install nmap --edit '/etc/yum.conf: s/gpgcheck=1/gpgcheck=0/'" + +echo "Tools: virt-builder" + +cd 2100-tools.d +terminal diff --git a/2013-kvm-forum/4000-libvirt.html b/2013-kvm-forum/4000-libvirt.html new file mode 100644 index 0000000..646fc24 --- /dev/null +++ b/2013-kvm-forum/4000-libvirt.html @@ -0,0 +1,5 @@ + + + +

Libguestfs uses libvirt

+ diff --git a/2013-kvm-forum/4050-appliance1.html b/2013-kvm-forum/4050-appliance1.html new file mode 100644 index 0000000..f42ec76 --- /dev/null +++ b/2013-kvm-forum/4050-appliance1.html @@ -0,0 +1,14 @@ + + + + + +

Don't do this ...

+ + diff --git a/2013-kvm-forum/4100-appliance2.html b/2013-kvm-forum/4100-appliance2.html new file mode 100644 index 0000000..b9ad5e7 --- /dev/null +++ b/2013-kvm-forum/4100-appliance2.html @@ -0,0 +1,14 @@ + + + + + +

Do do this (with libvirt)

+ + diff --git a/2013-kvm-forum/4200-libvirt-apis.html b/2013-kvm-forum/4200-libvirt-apis.html new file mode 100644 index 0000000..50f18ab --- /dev/null +++ b/2013-kvm-forum/4200-libvirt-apis.html @@ -0,0 +1,13 @@ + + + +

We use ...

+ + + diff --git a/2013-kvm-forum/4300-libvirt-dont-care.html b/2013-kvm-forum/4300-libvirt-dont-care.html new file mode 100644 index 0000000..0c5dadc --- /dev/null +++ b/2013-kvm-forum/4300-libvirt-dont-care.html @@ -0,0 +1,24 @@ + + + +

We use ...

+ + +
+
    +
  • virConnect* +
  • "lifecycle APIs"
    like virDomainCreateXML +
  • libvirt XML +
  • hotplugging APIs +
  • capabilities +
+
+.. but we don't care about: +
    +
  • live migration +
  • stable guest ABI +
  • storage APIs +
  • snapshots +
  • NUMA +
+
diff --git a/2013-kvm-forum/4400-libvirt-bugs.html b/2013-kvm-forum/4400-libvirt-bugs.html new file mode 100644 index 0000000..f14f95b --- /dev/null +++ b/2013-kvm-forum/4400-libvirt-bugs.html @@ -0,0 +1,23 @@ + + + +

Libvirt bugs

+ +Tracker bug: 910269 + + + + diff --git a/2013-kvm-forum/4500-libvirt-missing.html b/2013-kvm-forum/4500-libvirt-missing.html new file mode 100644 index 0000000..1d53f81 --- /dev/null +++ b/2013-kvm-forum/4500-libvirt-missing.html @@ -0,0 +1,11 @@ + + + +

Libvirt missing features

+ + diff --git a/2013-kvm-forum/4600-libvirt-dont-like.html b/2013-kvm-forum/4600-libvirt-dont-like.html new file mode 100644 index 0000000..5c1cedf --- /dev/null +++ b/2013-kvm-forum/4600-libvirt-dont-like.html @@ -0,0 +1,17 @@ + + + +

Things we don't like about libvirt ...

+ +
+1172 src/launch-direct.c
+1910 src/launch-libvirt.c
+ 619 src/launch-uml.c
+
+ + diff --git a/2013-kvm-forum/4700-libvirt-like.html b/2013-kvm-forum/4700-libvirt-like.html new file mode 100644 index 0000000..e0f327f --- /dev/null +++ b/2013-kvm-forum/4700-libvirt-like.html @@ -0,0 +1,12 @@ + + + +

On a positive note ...

+ +What we like about libvirt: + + diff --git a/2013-kvm-forum/9000-final.html b/2013-kvm-forum/9000-final.html new file mode 100644 index 0000000..081ca7c --- /dev/null +++ b/2013-kvm-forum/9000-final.html @@ -0,0 +1,14 @@ + + + +
+

+ libguestfs
+
+ libguestfs.org +

+

+ Richard W.M. Jones
+ rjones @ redhat.com +

+
diff --git a/2013-kvm-forum/README b/2013-kvm-forum/README new file mode 100644 index 0000000..b540975 --- /dev/null +++ b/2013-kvm-forum/README @@ -0,0 +1,11 @@ +This is a talk given at the 2012 KVM Forum in Barcelona. + +https://events.linuxfoundation.org/events/kvm-forum + +The whole talk is designed to take around 15-20 minutes, with lots of +time at the end for open discussion. + +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'. diff --git a/2013-kvm-forum/bashrc b/2013-kvm-forum/bashrc new file mode 100644 index 0000000..4c6a3c6 --- /dev/null +++ b/2013-kvm-forum/bashrc @@ -0,0 +1,17 @@ +# -*- 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 diff --git a/2013-kvm-forum/code.js b/2013-kvm-forum/code.js new file mode 100644 index 0000000..e69de29 diff --git a/2013-kvm-forum/fs-safe.svg b/2013-kvm-forum/fs-safe.svg new file mode 100644 index 0000000..e15a275 --- /dev/null +++ b/2013-kvm-forum/fs-safe.svg @@ -0,0 +1,286 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + kernel + + ☠ + fs + + qemu + sVirt + + + libguestfs + virt-* tool or yourprogram + + + guestfsd + + diff --git a/2013-kvm-forum/fs-unsafe.svg b/2013-kvm-forum/fs-unsafe.svg new file mode 100644 index 0000000..b295cb7 --- /dev/null +++ b/2013-kvm-forum/fs-unsafe.svg @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + kernel + + ☠ + fs + + + diff --git a/2013-kvm-forum/functions b/2013-kvm-forum/functions new file mode 100644 index 0000000..7baaed0 --- /dev/null +++ b/2013-kvm-forum/functions @@ -0,0 +1,40 @@ +# -*- 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 +# +# 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 "$@" +} diff --git a/2013-kvm-forum/notes.txt b/2013-kvm-forum/notes.txt new file mode 100644 index 0000000..c09313c --- /dev/null +++ b/2013-kvm-forum/notes.txt @@ -0,0 +1,113 @@ +Audience: + - libvirt developers + +Interested in: + - what it is + - new developments + +[---- OVERVIEW ----] + +Libguestfs is a C library for accessing and creating +disk images. It has been in development for four and a half +years, is very mature, and is used in many large projects +such as: virt-v2v, OpenStack, + +Like libvirt, the C API is long term stable so a program +written against the API four years ago will still work today. + +There are bindings in lots of programming languages. +Here is an example of a Python program using the API to create a +partitioned disk image with some content from a tar file. + +Show create.py + +Run create.py + +virt-filesystems -a disk.img --all --long -h + +virt-df -a disk.img -h + +guestfish --ro -a disk.img -m /dev/sda1 find / + + + + + + +[---- TOOLS ----] + + +We have a lot of tools associated with libguestfs: + +virt- + +Pick a few. + +Today I want to just mention virt-builder which is a tool +for rapidly and safely customizing templates of virtual +machines. + +virt-builder -l + +virt-builder fedora-19 \ + --hostname f19.example.com \ + --firstboot-install nmap \ + --edit '/etc/yum.conf: s/gpgcheck=1/gpgcheck=0/' + + +[---- LIBVIRT INTEGRATION ---] + +How libguestfs uses libvirt: + +Behind the scenes we create a captive appliance. Since Fedora 18 & +RHEL 7, we use libvirt to manage the appliance and sVirt to protect +the host from rogue filesystems. + + +Our use of libvirt APIs is very simple: + - virConnect* + - "lifecycle APIs" like virDomainCreateXML + - libvirt XML + - hotplugging APIs + - capabilities + +What we DON'T care about: + + - live migration + - stable guest ABI + - storage APIs + - snapshots + - NUMA + +Bugs in libvirt: + + - Tracker: 910269 + - (WORKAROUND) + - qemu: could not load kernel ... Permission denied + - libvirt doesn't label backing sockets, eg. qcow2 using NBD backing + - could not destroy libvirt domain: Requested operation is not valid: domain is not running + - libvirt chown's file to root, but doesn't restore ownership + - XML error: No PCI buses available (FIXED) + - This QEMU doesn't support virtio scsi controller (qemu bug: FIXED) + (example of non-obvious error message) + - TMPDIR / environment variable handling is broken (WORKAROUND) + +Missing features in libvirt: + + - labelling backing sockets + - no way to specify net= parameter to qemu + - unnamed guests + +Things we don't like: + + - error messages are confusing, real information is hidden + - logging/debugging is hard + - fragile + - regressions + - essentially impossible to use libvirt/sVirt on anything except Fedora/RHEL + +Things we like: + + - sVirt + - having someone else deal with qemu + - hotplugging diff --git a/2013-kvm-forum/run b/2013-kvm-forum/run new file mode 100755 index 0000000..3e4fb31 --- /dev/null +++ b/2013-kvm-forum/run @@ -0,0 +1,39 @@ +#!/bin/bash - +# Run the talk. + +# Avoid GNOME keyring stupidity +export GNOME_KEYRING_CONTROL= +export GNOME_KEYRING_PID= + +# Clean up everything. +find -name '*~' -delete + +# No proxy. +unset http_proxy +unset https_proxy +unset ftp_proxy + +# Run everything using libguestfs.git. +d=$HOME/d/libguestfs +export PATH=\ +$d/align:\ +$d/builder:\ +$d/cat:\ +$d/df:\ +$d/edit:\ +$d/fish:\ +$d/format:\ +$d/fuse:\ +$d/rescue:\ +$d/resize:\ +$d/sparsify:\ +$d/sysprep:\ +$d/test-tool:\ +$d/tools:\ +$d/$PATH + +# Get everything into the cache. +$d/run guestfish -a /dev/null run > /dev/null + +# Run techtalk. +$d/run techtalk-pse diff --git a/2013-kvm-forum/style.css b/2013-kvm-forum/style.css new file mode 100644 index 0000000..f11ec9a --- /dev/null +++ b/2013-kvm-forum/style.css @@ -0,0 +1,67 @@ +/* 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); +} + +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 author { + font-size: 36px; +} + +/* 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