From: Richard W.M. Jones Date: Mon, 8 Jul 2013 10:51:01 +0000 (+0100) Subject: Add 2013 CentOS Dojo Aldershot talk. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=eed15533b6550973262caa78e91d8f6e6a3bfb4d;p=libguestfs-talks.git Add 2013 CentOS Dojo Aldershot talk. --- diff --git a/2013-centos-dojo/.gitignore b/2013-centos-dojo/.gitignore new file mode 100644 index 0000000..ceb0adb --- /dev/null +++ b/2013-centos-dojo/.gitignore @@ -0,0 +1,2 @@ +bindings +history diff --git a/2013-centos-dojo/0000-introduction.html b/2013-centos-dojo/0000-introduction.html new file mode 100644 index 0000000..dd27dcb --- /dev/null +++ b/2013-centos-dojo/0000-introduction.html @@ -0,0 +1,21 @@ + + + +
+

+ Programming libvirt & the virt tools
+

+

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

+

+ After the short talk, we have 20 minutes for Q&A.
+ Ask me anything about:
+ virtualization with KVM in CentOS,
+ libvirt, libguestfs, virt-* tools, virsh,
+ OpenStack, oVirt, RHEV-M, RHEL 7 … +

+
+ + diff --git a/2013-centos-dojo/0500-definitions-libvirt.html b/2013-centos-dojo/0500-definitions-libvirt.html new file mode 100644 index 0000000..48592d3 --- /dev/null +++ b/2013-centos-dojo/0500-definitions-libvirt.html @@ -0,0 +1,11 @@ + + + + +

Some definitions

+ + diff --git a/2013-centos-dojo/0501-definitions-cloud.html b/2013-centos-dojo/0501-definitions-cloud.html new file mode 100644 index 0000000..2ceaec5 --- /dev/null +++ b/2013-centos-dojo/0501-definitions-cloud.html @@ -0,0 +1,11 @@ + + + + +

Some definitions

+ + diff --git a/2013-centos-dojo/0502-definitions-disk-image.html b/2013-centos-dojo/0502-definitions-disk-image.html new file mode 100644 index 0000000..a08b319 --- /dev/null +++ b/2013-centos-dojo/0502-definitions-disk-image.html @@ -0,0 +1,10 @@ + + + + +

Some definitions

+ + diff --git a/2013-centos-dojo/1000-laptop-guests.term b/2013-centos-dojo/1000-laptop-guests.term new file mode 100755 index 0000000..523b5b5 --- /dev/null +++ b/2013-centos-dojo/1000-laptop-guests.term @@ -0,0 +1,12 @@ +#!/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 diff --git a/2013-centos-dojo/1000.d/.gitignore b/2013-centos-dojo/1000.d/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/2013-centos-dojo/2000-overlay-disk.html b/2013-centos-dojo/2000-overlay-disk.html new file mode 100644 index 0000000..cecc8b0 --- /dev/null +++ b/2013-centos-dojo/2000-overlay-disk.html @@ -0,0 +1,7 @@ + + + + +

Creating an overlay disk

+ + diff --git a/2013-centos-dojo/2000-overlay-disk.svg b/2013-centos-dojo/2000-overlay-disk.svg new file mode 100644 index 0000000..5ae09b5 --- /dev/null +++ b/2013-centos-dojo/2000-overlay-disk.svg @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + 20 GBrawbacking diskreadonly + + 20 GBqcow2overlay + + + + hypervisor(KVM) + + diff --git a/2013-centos-dojo/2100-overlay-disk.term b/2013-centos-dojo/2100-overlay-disk.term new file mode 100755 index 0000000..af83345 --- /dev/null +++ b/2013-centos-dojo/2100-overlay-disk.term @@ -0,0 +1,17 @@ +#!/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 diff --git a/2013-centos-dojo/2100.d/.gitignore b/2013-centos-dojo/2100.d/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/2013-centos-dojo/2200-differences.term b/2013-centos-dojo/2200-differences.term new file mode 100755 index 0000000..1ff2f9f --- /dev/null +++ b/2013-centos-dojo/2200-differences.term @@ -0,0 +1,13 @@ +#!/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 diff --git a/2013-centos-dojo/2200.d/.gitignore b/2013-centos-dojo/2200.d/.gitignore new file mode 100644 index 0000000..9ff65df --- /dev/null +++ b/2013-centos-dojo/2200.d/.gitignore @@ -0,0 +1,2 @@ +new-files +old-files diff --git a/2013-centos-dojo/2300-sysprep.term b/2013-centos-dojo/2300-sysprep.term new file mode 100755 index 0000000..a72929a --- /dev/null +++ b/2013-centos-dojo/2300-sysprep.term @@ -0,0 +1,11 @@ +#!/bin/bash - + +source functions + +# History. +remember 'virt-sysprep --hostname dojo.example.com -d dojo' + +echo "Sysprep the guest" + +cd 2300.d +terminal diff --git a/2013-centos-dojo/2300.d/.gitignore b/2013-centos-dojo/2300.d/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/2013-centos-dojo/2400-set-root-password.term b/2013-centos-dojo/2400-set-root-password.term new file mode 100755 index 0000000..270d9a8 --- /dev/null +++ b/2013-centos-dojo/2400-set-root-password.term @@ -0,0 +1,15 @@ +#!/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 diff --git a/2013-centos-dojo/2400.d/set-root-password.pl b/2013-centos-dojo/2400.d/set-root-password.pl new file mode 100755 index 0000000..6511cfb --- /dev/null +++ b/2013-centos-dojo/2400.d/set-root-password.pl @@ -0,0 +1,27 @@ +#!/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"); diff --git a/2013-centos-dojo/6000-libvirt.html b/2013-centos-dojo/6000-libvirt.html new file mode 100644 index 0000000..6357886 --- /dev/null +++ b/2013-centos-dojo/6000-libvirt.html @@ -0,0 +1,16 @@ + + + + +

Some things you can do with libvirt ...

+ + diff --git a/2013-centos-dojo/7000-libguestfs.html b/2013-centos-dojo/7000-libguestfs.html new file mode 100644 index 0000000..22be535 --- /dev/null +++ b/2013-centos-dojo/7000-libguestfs.html @@ -0,0 +1,27 @@ + + + + +

Some things you can do with libguestfs ...

+ +
+ +
diff --git a/2013-centos-dojo/8000-openstack.html b/2013-centos-dojo/8000-openstack.html new file mode 100644 index 0000000..f7dab04 --- /dev/null +++ b/2013-centos-dojo/8000-openstack.html @@ -0,0 +1,13 @@ + + + + +

Some things you can do with OpenStack ...

+ + diff --git a/2013-centos-dojo/9000-ovirt.html b/2013-centos-dojo/9000-ovirt.html new file mode 100644 index 0000000..09abaee --- /dev/null +++ b/2013-centos-dojo/9000-ovirt.html @@ -0,0 +1,14 @@ + + + + +

Some things you can do with oVirt ...

+ + diff --git a/2013-centos-dojo/9900-qanda.html b/2013-centos-dojo/9900-qanda.html new file mode 100644 index 0000000..e5f1da5 --- /dev/null +++ b/2013-centos-dojo/9900-qanda.html @@ -0,0 +1,44 @@ + + + + +

Q & A

+ + + + + + +
+ + +

+Presentation software: Tech Talk PSE +

+

+Download the presentation and/or the presentation software from +git.annexia.org +

+ +
+

+Ask me anything about: +

+
    +
  • virtualization with KVM in CentOS +
  • libvirt +
  • libguestfs +
  • virt-* tools +
  • virsh +
  • OpenStack +
  • oVirt/RHEV-M +
  • RHEL 7 +
  • … +
+
diff --git a/2013-centos-dojo/README b/2013-centos-dojo/README new file mode 100644 index 0000000..b2f6332 --- /dev/null +++ b/2013-centos-dojo/README @@ -0,0 +1,12 @@ +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'. diff --git a/2013-centos-dojo/bashrc b/2013-centos-dojo/bashrc new file mode 100644 index 0000000..4c6a3c6 --- /dev/null +++ b/2013-centos-dojo/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-centos-dojo/centos-bg.png b/2013-centos-dojo/centos-bg.png new file mode 100644 index 0000000..afee2f1 Binary files /dev/null and b/2013-centos-dojo/centos-bg.png differ diff --git a/2013-centos-dojo/centos-logo.png b/2013-centos-dojo/centos-logo.png new file mode 100644 index 0000000..90b0b11 Binary files /dev/null and b/2013-centos-dojo/centos-logo.png differ diff --git a/2013-centos-dojo/cleanup b/2013-centos-dojo/cleanup new file mode 100755 index 0000000..6b7ab33 --- /dev/null +++ b/2013-centos-dojo/cleanup @@ -0,0 +1,6 @@ +#!/bin/bash - + +virsh destroy dojo +virsh undefine dojo + +rm /tmp/overlay.qcow2 diff --git a/2013-centos-dojo/code.js b/2013-centos-dojo/code.js new file mode 100644 index 0000000..e69de29 diff --git a/2013-centos-dojo/functions b/2013-centos-dojo/functions new file mode 100644 index 0000000..7baaed0 --- /dev/null +++ b/2013-centos-dojo/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-centos-dojo/highlight b/2013-centos-dojo/highlight new file mode 100755 index 0000000..e36a1ec --- /dev/null +++ b/2013-centos-dojo/highlight @@ -0,0 +1,2 @@ +#!/bin/sh - +source-highlight -s xml -o STDOUT -f esc diff --git a/2013-centos-dojo/notes.txt b/2013-centos-dojo/notes.txt new file mode 100644 index 0000000..d2d4163 --- /dev/null +++ b/2013-centos-dojo/notes.txt @@ -0,0 +1,82 @@ +*** 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? diff --git a/2013-centos-dojo/redhat.png b/2013-centos-dojo/redhat.png new file mode 100644 index 0000000..f50076a Binary files /dev/null and b/2013-centos-dojo/redhat.png differ diff --git a/2013-centos-dojo/run b/2013-centos-dojo/run new file mode 100755 index 0000000..666ad7e --- /dev/null +++ b/2013-centos-dojo/run @@ -0,0 +1,23 @@ +#!/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 diff --git a/2013-centos-dojo/style.css b/2013-centos-dojo/style.css new file mode 100644 index 0000000..19f6aa9 --- /dev/null +++ b/2013-centos-dojo/style.css @@ -0,0 +1,97 @@ +/* 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