From: Richard W.M. Jones Date: Thu, 2 Feb 2012 12:44:35 +0000 (+0000) Subject: Add FOSDEM 2012 talk. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=5bc9ae236b09d7d42c09dc2dd818cd8e9ddde7bb;p=libguestfs-talks.git Add FOSDEM 2012 talk. --- diff --git a/2012-fosdem/.gitignore b/2012-fosdem/.gitignore new file mode 100644 index 0000000..226f62f --- /dev/null +++ b/2012-fosdem/.gitignore @@ -0,0 +1,7 @@ +bindings +history +300.d/disk.img +400.d/disk.img +500.d/rhel6.img +500.d/win7.img +600.d/libguestfs-1.16.2.tar.gz diff --git a/2012-fosdem/100-introduction.html b/2012-fosdem/100-introduction.html new file mode 100644 index 0000000..f9ecd30 --- /dev/null +++ b/2012-fosdem/100-introduction.html @@ -0,0 +1,13 @@ + + + +
+

+ libguestfs

+ tools for viewing and modifying
virtual machine disk images +

+

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

+
diff --git a/2012-fosdem/200-overview.html b/2012-fosdem/200-overview.html new file mode 100644 index 0000000..596e2eb --- /dev/null +++ b/2012-fosdem/200-overview.html @@ -0,0 +1,33 @@ + + + + +

Library, API, tools

+ + + + + + + +

libguestfs.so

+ + + +

C

+ +

Python

+ +

Ruby

+ +

shell

+ +

· · ·

+ +

virt-resize

+ +

virt-df

+ +

guestfish

+ +

· · ·

diff --git a/2012-fosdem/300-guestfish.term b/2012-fosdem/300-guestfish.term new file mode 100755 index 0000000..438550d --- /dev/null +++ b/2012-fosdem/300-guestfish.term @@ -0,0 +1,12 @@ +#!/bin/bash - + +source functions + +remember 'ls -l -h' +remember 'file disk.img' +remember 'guestfish --ro -i -a disk.img' + +echo "Example: Modify a disk image" + +cd 300.d +terminal diff --git a/2012-fosdem/300.d/.exists b/2012-fosdem/300.d/.exists new file mode 100644 index 0000000..e69de29 diff --git a/2012-fosdem/400-inspection.term b/2012-fosdem/400-inspection.term new file mode 100755 index 0000000..d22a24e --- /dev/null +++ b/2012-fosdem/400-inspection.term @@ -0,0 +1,14 @@ +#!/bin/bash - + +source functions + +echo "Example: Inspection" + +remember 'ls -l -h' +remember 'file disk.img' +remember 'virt-df -h -a disk.img' +remember 'virt-filesystems -a disk.img --all --long -h' +remember 'virt-inspector -a disk.img | highlight | less -r' + +cd 400.d +terminal diff --git a/2012-fosdem/400.d/.exists b/2012-fosdem/400.d/.exists new file mode 100644 index 0000000..e69de29 diff --git a/2012-fosdem/500-auditing.term b/2012-fosdem/500-auditing.term new file mode 100755 index 0000000..94c0df1 --- /dev/null +++ b/2012-fosdem/500-auditing.term @@ -0,0 +1,13 @@ +#!/bin/bash - + +source functions + +echo "Example: Auditing" + +remember 'ls -l -h' +remember 'emacs -nw audit.py' +remember './audit.py win7.img' +remember './audit.py rhel6.img' + +cd 500.d +terminal diff --git a/2012-fosdem/500.d/.exists b/2012-fosdem/500.d/.exists new file mode 100644 index 0000000..e69de29 diff --git a/2012-fosdem/500.d/audit.py b/2012-fosdem/500.d/audit.py new file mode 100755 index 0000000..8cdaec5 --- /dev/null +++ b/2012-fosdem/500.d/audit.py @@ -0,0 +1,44 @@ +#!/usr/bin/python + +import re +import sys +import guestfs + +def mount_disk (g, root): + mps = g.inspect_get_mountpoints (root) + def compare (a, b): + if len(a[0]) > len(b[0]): + return 1 + elif len(a[0]) == len(b[0]): + return 0 + else: + return -1 + mps.sort (compare) + for mp_dev in mps: + try: + g.mount_ro (mp_dev[1], mp_dev[0]) + except RuntimeError as msg: + print "%s (ignored)" % msg + +if len (sys.argv) != 2: + raise (Error ("disk [image]")) +disk = sys.argv[1] + +g = guestfs.GuestFS () +g.add_drive_opts (disk, readonly=1) + +g.launch () + +roots = g.inspect_os () +if len (roots) == 0: + raise (Error ("inspect_vm: no operating systems found")) + +for root in roots: + mount_disk (g, root) + + apps = g.inspect_list_applications (root) + for app in apps: + if re.search ('firefox', app['app_name'], re.IGNORECASE): + print ("%s: Firefox version %s" % (disk, app['app_version'])) + + g.umount_all () diff --git a/2012-fosdem/600-prepopulate.term b/2012-fosdem/600-prepopulate.term new file mode 100755 index 0000000..392d8dc --- /dev/null +++ b/2012-fosdem/600-prepopulate.term @@ -0,0 +1,17 @@ +#!/bin/bash - + +source functions + +echo "Example: Prepopulate a disk image" + +remember 'emacs -nw prepopulate.py' +remember './prepopulate.py' +remember 'ls -l -h' +remember 'virt-df -h -a disk.img' +remember 'guestfish -a disk.img -m /dev/sda1 --ro' + +cd 600.d + +rm -f disk.img + +terminal diff --git a/2012-fosdem/600.d/.exists b/2012-fosdem/600.d/.exists new file mode 100644 index 0000000..e69de29 diff --git a/2012-fosdem/600.d/prepopulate.py b/2012-fosdem/600.d/prepopulate.py new file mode 100755 index 0000000..9e528e8 --- /dev/null +++ b/2012-fosdem/600.d/prepopulate.py @@ -0,0 +1,24 @@ +#!/usr/bin/python + +import os +import guestfs + +input = "libguestfs-1.16.2.tar.gz" +output = "disk.img" + +g = guestfs.GuestFS () + +f = open (output, "w") +f.truncate (512 * 1024 * 1024) +f.close () + +g.add_drive_opts (output, format = "raw", readonly = 0) + +g.launch () + +g.part_disk ("/dev/sda", "mbr") +g.mkfs ("ext4", "/dev/sda1") +g.mount ("/dev/sda1", "/") +g.tgz_in (input, "/") + +g.close () diff --git a/2012-fosdem/900-summary.html b/2012-fosdem/900-summary.html new file mode 100644 index 0000000..8c6ed16 --- /dev/null +++ b/2012-fosdem/900-summary.html @@ -0,0 +1,46 @@ + + + + +

libguestfs.org

+ +

+ Languages: + C/C++, Perl, Python, Ruby, OCaml, Java, PHP, Erlang, shell script +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

guestfish

virt-copy-out

virt-inspector

virt-sparsify

guestmount

virt-df

virt-ls

virt-tar-in

virt-alignment-scan

virt-edit

virt-make-fs

virt-tar-out

virt-cat

virt-filesystems

virt-rescue

virt-win-reg

virt-copy-in

virt-format

virt-resize

+ +

+ Aeolus, OpenStack Essex, Boxgrinder, Oz, virt-manager, virt-v2v, virt-p2v +

diff --git a/2012-fosdem/arrows1.svg b/2012-fosdem/arrows1.svg new file mode 100644 index 0000000..7582b01 --- /dev/null +++ b/2012-fosdem/arrows1.svg @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/2012-fosdem/arrows2.svg b/2012-fosdem/arrows2.svg new file mode 100644 index 0000000..d73e054 --- /dev/null +++ b/2012-fosdem/arrows2.svg @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/2012-fosdem/bashrc b/2012-fosdem/bashrc new file mode 100644 index 0000000..e8fcde3 --- /dev/null +++ b/2012-fosdem/bashrc @@ -0,0 +1,14 @@ +# -*- shell-script -*- + +# 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/2012-fosdem/cdrom.png b/2012-fosdem/cdrom.png new file mode 100644 index 0000000..9c241cd Binary files /dev/null and b/2012-fosdem/cdrom.png differ diff --git a/2012-fosdem/code.js b/2012-fosdem/code.js new file mode 100644 index 0000000..e69de29 diff --git a/2012-fosdem/disk.png b/2012-fosdem/disk.png new file mode 100644 index 0000000..087810c Binary files /dev/null and b/2012-fosdem/disk.png differ diff --git a/2012-fosdem/file.png b/2012-fosdem/file.png new file mode 100644 index 0000000..beff2d4 Binary files /dev/null and b/2012-fosdem/file.png differ diff --git a/2012-fosdem/flash.png b/2012-fosdem/flash.png new file mode 100644 index 0000000..8e625cc Binary files /dev/null and b/2012-fosdem/flash.png differ diff --git a/2012-fosdem/floppy.png b/2012-fosdem/floppy.png new file mode 100644 index 0000000..8bfd718 Binary files /dev/null and b/2012-fosdem/floppy.png differ diff --git a/2012-fosdem/functions b/2012-fosdem/functions new file mode 100644 index 0000000..1e2cd55 --- /dev/null +++ b/2012-fosdem/functions @@ -0,0 +1,41 @@ +# -*- 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 LIBVIRT_DEFAULT_URI=qemu:///system +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/2012-fosdem/highlight b/2012-fosdem/highlight new file mode 100755 index 0000000..e36a1ec --- /dev/null +++ b/2012-fosdem/highlight @@ -0,0 +1,2 @@ +#!/bin/sh - +source-highlight -s xml -o STDOUT -f esc diff --git a/2012-fosdem/notes.txt b/2012-fosdem/notes.txt new file mode 100644 index 0000000..21a3c59 --- /dev/null +++ b/2012-fosdem/notes.txt @@ -0,0 +1,77 @@ +[20 minutes + 5 for questions] + +!!!!! DISPLAY RESOLUTION !!!!! + +[BEFORE: + guestfish -a /dev/null run + ~/d/techtalk-pse/techtalk-pse +] + +[Audience is: + - cloud developers + - general interest + + What do they want to do with images: + - file injection + - inspection for auditing + - creation of blank / prepopulated + - resizing + - use it from languages like Python, C, Ruby, Perl, Java + + Adoption / find out more: + - website +] + +[website: + +libguestfs is a set of tools for accessing and modifying virtual +machine (VM) disk images. You can use this to inject files, resize, +rescue, create, view or audit disks. libguestfs is also a library that +you can link to management programs written in C, Perl, Python, Ruby, +Java and other languages. In this talk, Richard Jones will introduce +the tools and give live demonstrations. He also talks about how they +work behind the scenes. +] + + +100 INTRODUCTION + + - website + - my email address + +200 OVERVIEW + +C library, API and a set of tools + +(just a few are shown here) + +full time development for 3 years, > 300,000 lines of code + +using kernel + qemu code, so can handle qcow2, all sorts of filesystems + +300 GUESTFISH + + + +400 INSPECTION + + + +500 AUDITING + + + +600 PREPOPULATED DISK IMAGE + + + +900 SUMMARY + + - summary page + tools (all of them here) + used in OpenStack + used in Aeolus + used in Boxgrinder + used in Oz + used in virt-manager + used in virt-v2v, virt-p2v diff --git a/2012-fosdem/redhat.jpg b/2012-fosdem/redhat.jpg new file mode 100644 index 0000000..36016a3 Binary files /dev/null and b/2012-fosdem/redhat.jpg differ diff --git a/2012-fosdem/style.css b/2012-fosdem/style.css new file mode 100644 index 0000000..165fd3b --- /dev/null +++ b/2012-fosdem/style.css @@ -0,0 +1,84 @@ +/* Red Hat red is rgb(204,0,0). */ + +body { + background: url(redhat.jpg) no-repeat; + background-position: 98% 0; + font-size: 24pt; + font-family: liberation, helvetica; +} + +body td { /* why?? */ + font-size: 28pt; +} + +h1 { + color: rgb(204,0,0); + font-size: 48px; + 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; +} + +/* In-page controls. */ +p#pagecontrols { + font-size: small; + position: absolute; + right: 340px; + top: 1em; +} + +p#pagecontrols a { + background: #fee; + text-decoration: none; + padding-left: 1.5em; + padding-right: 1.5em; + padding-top: 1em; + padding-bottom: 1em; +} + +p#pagecontrols a:hover { + background: #f33; +} + +/* Bubble around names of virt-tools. */ +p.bubble { + font-weight: bold; + color: white; + width: 6em; + text-align: center; + background-color: rgb(204,0,0); + -moz-border-radius: 0.2em; + border-radius: 0.2em; +} + +p.bubbleinverse { + font-weight: bold; + color: rgb(204,0,0); + width: 6em; + text-align: center; + background-color: white; +} + +table.tools td { + padding-bottom: 0.5em; + padding-right: 0.5em; +} \ No newline at end of file