2015 virt tools talk.
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 10 Dec 2015 14:36:30 +0000 (14:36 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Sat, 12 Dec 2015 13:21:24 +0000 (13:21 +0000)
28 files changed:
2015-virt-tools/.gitignore [new file with mode: 0644]
2015-virt-tools/0000-introduction.html [new file with mode: 0644]
2015-virt-tools/1000-virt-resize.d/.gitignore [new file with mode: 0644]
2015-virt-tools/1000-virt-resize.term [new file with mode: 0755]
2015-virt-tools/2000-thin-provisioning.svg [new file with mode: 0644]
2015-virt-tools/2000-virt-sparsify.d/.gitignore [new file with mode: 0644]
2015-virt-tools/2000-virt-sparsify.html [new file with mode: 0644]
2015-virt-tools/2100-virt-sparsify.term [new file with mode: 0755]
2015-virt-tools/3000-virt-customize.d/.gitignore [new file with mode: 0644]
2015-virt-tools/3000-virt-customize.html [new file with mode: 0644]
2015-virt-tools/3100-virt-customize.term [new file with mode: 0755]
2015-virt-tools/4000-virt-sysprep.d/.gitignore [new file with mode: 0644]
2015-virt-tools/4000-virt-sysprep.term [new file with mode: 0755]
2015-virt-tools/5000-prepare-templates.html [new file with mode: 0644]
2015-virt-tools/5000-virt-builder.d/.gitignore [new file with mode: 0644]
2015-virt-tools/5100-virt-builder-list.term [new file with mode: 0755]
2015-virt-tools/5200-run-virt-builder.html [new file with mode: 0644]
2015-virt-tools/5300-run-virt-builder.term [new file with mode: 0755]
2015-virt-tools/5400-distro-metadata.html [new file with mode: 0644]
2015-virt-tools/9000-final.html [new file with mode: 0644]
2015-virt-tools/NOTES [new file with mode: 0644]
2015-virt-tools/README [new file with mode: 0644]
2015-virt-tools/bashrc [new file with mode: 0644]
2015-virt-tools/code.js [new file with mode: 0644]
2015-virt-tools/functions [new file with mode: 0644]
2015-virt-tools/redhat.png [new file with mode: 0644]
2015-virt-tools/run [new file with mode: 0755]
2015-virt-tools/style.css [new file with mode: 0644]

diff --git a/2015-virt-tools/.gitignore b/2015-virt-tools/.gitignore
new file mode 100644 (file)
index 0000000..d678620
--- /dev/null
@@ -0,0 +1,2 @@
+/bindings
+/history
diff --git a/2015-virt-tools/0000-introduction.html b/2015-virt-tools/0000-introduction.html
new file mode 100644 (file)
index 0000000..35916b1
--- /dev/null
@@ -0,0 +1,21 @@
+<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>
+
+<div id="titlepage">
+  <p class="title">
+    virt-resize, virt-sparsify, virt-customize, virt-sysprep, virt-builder
+  </p>
+  <p><author>
+      Richard W.M. Jones <br/>
+      <small>rjones @ redhat.com</small>
+  </author></p>
+  <p>
+    <b>libguestfs</b> is a library and set of tools for manipulating
+    virtual machine disk images.
+  </p>
+  <p>
+    This talk is about the <b>virt-tools</b> which build on this
+    library to provide many useful abstractions.
+  </p>
+</div>
diff --git a/2015-virt-tools/1000-virt-resize.d/.gitignore b/2015-virt-tools/1000-virt-resize.d/.gitignore
new file mode 100644 (file)
index 0000000..c96a04f
--- /dev/null
@@ -0,0 +1,2 @@
+*
+!.gitignore
\ No newline at end of file
diff --git a/2015-virt-tools/1000-virt-resize.term b/2015-virt-tools/1000-virt-resize.term
new file mode 100755 (executable)
index 0000000..adffc85
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash -
+
+source functions
+
+# History.
+remember 'qemu-img info fedora-22.qcow2'
+remember 'virt-df -a fedora-22.qcow2 -h'
+remember 'qemu-img create -f qcow2 fedora-22-bigger.qcow2 10G'
+remember 'virt-resize fedora-22.qcow2 fedora-22-bigger.qcow2 --expand sda3'
+remember 'virt-df -a fedora-22-bigger.qcow2 -h'
+
+echo "Running virt-resize"
+
+cd 1000-virt-resize.d
+terminal
diff --git a/2015-virt-tools/2000-thin-provisioning.svg b/2015-virt-tools/2000-thin-provisioning.svg
new file mode 100644 (file)
index 0000000..c7cc146
--- /dev/null
@@ -0,0 +1,275 @@
+<?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:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="179.73778mm"
+   height="100.51683mm"
+   viewBox="0 0 636.86614 356.162"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="2000-thin-provisioning.svg">
+  <defs
+     id="defs4">
+    <marker
+       inkscape:isstock="true"
+       style="overflow:visible"
+       id="marker7071"
+       refX="0"
+       refY="0"
+       orient="auto"
+       inkscape:stockid="Arrow1Lend">
+      <path
+         transform="matrix(-0.8,0,0,-0.8,-10,0)"
+         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z"
+         id="path7073"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker6345"
+       style="overflow:visible"
+       inkscape:isstock="true"
+       inkscape:collect="always">
+      <path
+         id="path6347"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z"
+         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+         transform="matrix(-0.8,0,0,-0.8,-10,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:isstock="true"
+       style="overflow:visible"
+       id="marker5925"
+       refX="0"
+       refY="0"
+       orient="auto"
+       inkscape:stockid="Arrow1Lend"
+       inkscape:collect="always">
+      <path
+         transform="matrix(-0.8,0,0,-0.8,-10,0)"
+         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z"
+         id="path5927"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Lend"
+       style="overflow:visible"
+       inkscape:isstock="true"
+       inkscape:collect="always">
+      <path
+         id="path5650"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z"
+         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+         transform="matrix(-0.8,0,0,-0.8,-10,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <pattern
+       inkscape:collect="always"
+       xlink:href="#pattern5619"
+       id="pattern5623"
+       patternTransform="matrix(7.3066963,-6.827312,6.827312,7.3066963,324,0)" />
+    <pattern
+       inkscape:collect="always"
+       xlink:href="#pattern5615"
+       id="pattern5619"
+       patternTransform="matrix(7.3066963,-6.827312,6.827312,7.3066963,160,0)" />
+    <pattern
+       inkscape:collect="always"
+       xlink:href="#Strips1_1"
+       id="pattern5615"
+       patternTransform="matrix(7.3066963,-6.827312,6.827312,7.3066963,0,0)" />
+    <pattern
+       inkscape:isstock="true"
+       inkscape:stockid="Stripes 1:1"
+       id="Strips1_1"
+       patternTransform="translate(0,0) scale(10,10)"
+       height="1"
+       width="2"
+       patternUnits="userSpaceOnUse"
+       inkscape:collect="always">
+      <rect
+         id="rect4865"
+         height="2"
+         width="1"
+         y="-0.5"
+         x="0"
+         style="fill:black;stroke:none" />
+    </pattern>
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1.4"
+     inkscape:cx="246.38868"
+     inkscape:cy="176.73124"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     inkscape:window-width="1920"
+     inkscape:window-height="1027"
+     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">
+    <inkscape:grid
+       type="xygrid"
+       id="grid4138"
+       originx="-49.066928"
+       originy="-625.06694" />
+  </sodipodi:namedview>
+  <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"
+     transform="translate(-49.066929,-71.133282)">
+    <g
+       id="g5625">
+      <rect
+         y="107.36221"
+         x="85"
+         height="109.99999"
+         width="565"
+         id="rect4136"
+         style="fill:#ffffff;stroke:#000000" />
+      <rect
+         ry="0"
+         y="107.06635"
+         x="197.90207"
+         height="110.29585"
+         width="122.09793"
+         id="rect5609"
+         style="opacity:0.2;fill:url(#pattern5615);fill-opacity:1;stroke:#000000" />
+      <rect
+         style="opacity:0.2;fill:url(#pattern5619);fill-opacity:1;stroke:#000000"
+         id="rect5617"
+         width="62.097931"
+         height="110.29585"
+         x="357.90207"
+         y="107.06635"
+         ry="0" />
+      <rect
+         ry="0"
+         y="107.36221"
+         x="595"
+         height="110.00001"
+         width="49"
+         id="rect5621"
+         style="opacity:0.2;fill:url(#pattern5623);fill-opacity:1;stroke:#000000" />
+    </g>
+    <g
+       id="g5631"
+       transform="translate(0,174)">
+      <rect
+         style="fill:#ffffff;stroke:#000000"
+         id="rect5633"
+         width="565"
+         height="109.99999"
+         x="85"
+         y="107.36221" />
+      <rect
+         style="opacity:0.2;fill:url(#pattern5615);fill-opacity:1;stroke:#000000"
+         id="rect5635"
+         width="122.09793"
+         height="110.29585"
+         x="197.90207"
+         y="107.06635"
+         ry="0" />
+      <rect
+         ry="0"
+         y="107.06635"
+         x="357.90207"
+         height="110.29585"
+         width="62.097931"
+         id="rect5637"
+         style="opacity:0.2;fill:url(#pattern5619);fill-opacity:1;stroke:#000000" />
+      <rect
+         style="opacity:0.2;fill:url(#pattern5623);fill-opacity:1;stroke:#000000"
+         id="rect5639"
+         width="49"
+         height="110.00001"
+         x="595"
+         y="107.36221"
+         ry="0" />
+    </g>
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
+       d="m 260,222.3622 0,50"
+       id="path5641"
+       inkscape:connector-curvature="0" />
+    <path
+       inkscape:connector-curvature="0"
+       id="path5923"
+       d="m 390,222.3622 0,50"
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker5925)" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker6345)"
+       d="m 620,222.3622 0,50"
+       id="path6343"
+       inkscape:connector-curvature="0" />
+    <path
+       inkscape:connector-curvature="0"
+       id="path7069"
+       d="m 620,222.3622 0,50"
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker7071)" />
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       x="144"
+       y="164.36221"
+       id="text7111"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan7113"
+         x="144"
+         y="164.36221">deleted/unused space in the guest</tspan></text>
+    <text
+       sodipodi:linespacing="125%"
+       id="text7115"
+       y="337.21936"
+       x="144.71428"
+       style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       xml:space="preserve"><tspan
+         y="337.21936"
+         x="144.71428"
+         id="tspan7117"
+         sodipodi:role="line">unallocated disk blocks on the host</tspan></text>
+  </g>
+</svg>
diff --git a/2015-virt-tools/2000-virt-sparsify.d/.gitignore b/2015-virt-tools/2000-virt-sparsify.d/.gitignore
new file mode 100644 (file)
index 0000000..d6b7ef3
--- /dev/null
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/2015-virt-tools/2000-virt-sparsify.html b/2015-virt-tools/2000-virt-sparsify.html
new file mode 100644 (file)
index 0000000..320c2e9
--- /dev/null
@@ -0,0 +1,11 @@
+<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>Thin provisioning</h1>
+
+<object height="80%" width="99%"
+        data="2000-thin-provisioning.svg"
+        type="image/svg+xml">
+  <img src="2000-thin-provisioning.svg">
+</object>
diff --git a/2015-virt-tools/2100-virt-sparsify.term b/2015-virt-tools/2100-virt-sparsify.term
new file mode 100755 (executable)
index 0000000..1f74a75
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash -
+
+source functions
+
+# History.
+
+remember 'qemu-img info fedora-22.img'
+remember 'du -sh fedora-22.img'
+remember 'virt-df -a fedora-22.img -h'
+remember 'virt-sparsify --inplace fedora-22.img'
+remember 'qemu-img info fedora-22.img'
+remember 'du -sh fedora-22.img'
+
+echo "Running virt-sparsify"
+
+cd 2000-virt-sparsify.d
+terminal
diff --git a/2015-virt-tools/3000-virt-customize.d/.gitignore b/2015-virt-tools/3000-virt-customize.d/.gitignore
new file mode 100644 (file)
index 0000000..c96a04f
--- /dev/null
@@ -0,0 +1,2 @@
+*
+!.gitignore
\ No newline at end of file
diff --git a/2015-virt-tools/3000-virt-customize.html b/2015-virt-tools/3000-virt-customize.html
new file mode 100644 (file)
index 0000000..4011c94
--- /dev/null
@@ -0,0 +1,17 @@
+<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>virt-customize</h1>
+
+<ul>
+<li> Install, upgrade packages.
+<li> Inject files, directories, SSH keys.
+<li> Set root, user passwords.
+<li> Edit files.
+<li> Run scripts.
+<li> Add firstboot (RunOnce) scripts.
+<li> Set hostname, timezone.
+<li> File operations (delete, link, chmod, mkdir, etc.)
+<li> Attach to RHN.
+</ul>
diff --git a/2015-virt-tools/3100-virt-customize.term b/2015-virt-tools/3100-virt-customize.term
new file mode 100755 (executable)
index 0000000..070ccc9
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash -
+
+source functions
+
+# History.
+
+remember 'virt-customize -a fedora-22.img --install gcc,gdb --root-password password:123456 --edit /etc/selinux/config:s/^SELINUX=.*/SELINUX=permissive/'
+remember 'virt-cat -a fedora-22.img /etc/selinux/config'
+
+echo "Running virt-customize"
+
+cd 3000-virt-customize.d
+terminal
diff --git a/2015-virt-tools/4000-virt-sysprep.d/.gitignore b/2015-virt-tools/4000-virt-sysprep.d/.gitignore
new file mode 100644 (file)
index 0000000..c96a04f
--- /dev/null
@@ -0,0 +1,2 @@
+*
+!.gitignore
\ No newline at end of file
diff --git a/2015-virt-tools/4000-virt-sysprep.term b/2015-virt-tools/4000-virt-sysprep.term
new file mode 100755 (executable)
index 0000000..0b90a4c
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash -
+
+source functions
+
+# History.
+
+remember 'virt-sysprep -a fedora-22.img'
+remember 'virt-sysprep --list-operations'
+
+echo "Running virt-sysprep"
+
+cd 4000-virt-sysprep.d
+terminal
diff --git a/2015-virt-tools/5000-prepare-templates.html b/2015-virt-tools/5000-prepare-templates.html
new file mode 100644 (file)
index 0000000..8d480fa
--- /dev/null
@@ -0,0 +1,18 @@
+<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>virt-builder: Preparing templates</h1>
+
+<p style="text-align: center">
+virt-install <br/>
+↓ <br/>
+virt-sysprep <br/>
+↓ <br/>
+virt-sparsify <br/>
+↓ <br/>
+xz compress <br/>
+↓ <br/>
+Online template repository <br/>
+<small>(<a href="http://libguestfs.org/download/builder/">http://libguestfs.org/download/builder</a>)</small>
+</p>
diff --git a/2015-virt-tools/5000-virt-builder.d/.gitignore b/2015-virt-tools/5000-virt-builder.d/.gitignore
new file mode 100644 (file)
index 0000000..c96a04f
--- /dev/null
@@ -0,0 +1,2 @@
+*
+!.gitignore
\ No newline at end of file
diff --git a/2015-virt-tools/5100-virt-builder-list.term b/2015-virt-tools/5100-virt-builder-list.term
new file mode 100755 (executable)
index 0000000..97dc6f5
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash -
+
+source functions
+
+# History.
+
+remember 'virt-builder -l'
+remember 'virt-builder --notes rhel-7.1'
+
+echo "virt-builder"
+
+cd 5000-virt-builder.d
+terminal
diff --git a/2015-virt-tools/5200-run-virt-builder.html b/2015-virt-tools/5200-run-virt-builder.html
new file mode 100644 (file)
index 0000000..677f810
--- /dev/null
@@ -0,0 +1,17 @@
+<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>virt-builder: Running</h1>
+
+<p style="text-align: center">
+Download a template <br/>
+↓ <br/>
+xz uncompress <br/>
+↓ <br/>
+virt-resize <br/>
+↓ <br/>
+virt-customize <br/>
+↓ <br/>
+Disk image ready to boot
+</p>
diff --git a/2015-virt-tools/5300-run-virt-builder.term b/2015-virt-tools/5300-run-virt-builder.term
new file mode 100755 (executable)
index 0000000..dd42e31
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash -
+
+source functions
+
+# History.
+
+remember 'virt-builder rhel-7.1'
+remember 'virt-builder rhel-7.1 --install gcc --selinux-relabel'
+remember 'virt-builder rhel-7.1 --size 20G'
+remember 'virt-df -a rhel-7.1.img -h'
+
+echo "Running virt-builder"
+
+cd 5000-virt-builder.d
+terminal
diff --git a/2015-virt-tools/5400-distro-metadata.html b/2015-virt-tools/5400-distro-metadata.html
new file mode 100644 (file)
index 0000000..cfb769a
--- /dev/null
@@ -0,0 +1,60 @@
+<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>virt-builder: Distro metadata</h1>
+
+<table>
+<tr>
+<td width="30%" valign="top">
+
+<div style="
+  border: 1px solid black;
+  font-size: 40%;
+">
+<p style="text-align: center">
+virt-install <br/>
+↓ <br/>
+virt-sysprep <br/>
+↓ <br/>
+virt-sparsify <br/>
+↓ <br/>
+xz compress <br/>
+↓ <br/>
+Online template repository <br/>
+<small>(<a href="http://libguestfs.org/download/builder/">http://libguestfs.org/download/builder</a>)</small>
+</p>
+</div>
+
+</td>
+<td width="55%" valign="top">
+
+<pre style="
+  width: 40%;
+  font-size: 80%;
+  margin-left: 3em;
+">
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+[centos-6.6]
+name=CentOS 6.6
+arch=x86_64
+file=CentOS-6.6-x86_64-Cloud.raw.xz
+checksum[sha512]=fc403ea3555a560...
+format=raw
+size=6442450944
+compressed_size=199265736
+expand=/dev/sda3
+
+-----BEGIN PGP SIGNATURE-----
+</pre>
+
+</td>
+</tr>
+</table>
+
+<p style="text-align: center;">
+virt-builder can pull templates from multiple
+repositories.
+</p>
diff --git a/2015-virt-tools/9000-final.html b/2015-virt-tools/9000-final.html
new file mode 100644 (file)
index 0000000..56479fe
--- /dev/null
@@ -0,0 +1,29 @@
+<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>More information</h1>
+
+<ul>
+<li> Project page and sources: <br>
+<a href="http://libguestfs.org/"><b><big>lib<small>&nbsp;</small>guest<small>&nbsp;</small>fs.org</big></b></a>
+<li> <a href="http://libguestfs.org/virt-resize.1.html">http://libguestfs.org/virt-resize.1.html</a>
+<li> <a href="http://libguestfs.org/virt-sparsify.1.html">http://libguestfs.org/virt-sparsify.1.html</a>
+<li> <a href="http://libguestfs.org/virt-customize.1.html">http://libguestfs.org/virt-customize.1.html</a>
+<li> <a href="http://libguestfs.org/virt-sysprep.1.html">http://libguestfs.org/virt-sysprep.1.html</a>
+<li> <a href="http://libguestfs.org/virt-builder.1.html">http://libguestfs.org/virt-builder.1.html</a>
+<li> Available in all major Linux distros:
+Fedora&nbsp;&ge;&nbsp;11, RHEL&nbsp;&ge;&nbsp;6.0,
+Debian, Ubuntu, SUSE, Arch, Gentoo, etc etc.
+<li> Used widely by Red Hat customers
+<li> Developers and testers at Red Hat: <br/>
+Pino&nbsp;Toscano,
+Shahar&nbsp;Havivi,
+Arik&nbsp;Hadas,
+Tingting&nbsp;Zheng,
+Junqin&nbsp;Zhou,
+Hu&nbsp;Zhang,
+Wei&nbsp;Shi,
+Lingfei&nbsp;Kong,
+John&nbsp;Eckersberg.
+</ul>
diff --git a/2015-virt-tools/NOTES b/2015-virt-tools/NOTES
new file mode 100644 (file)
index 0000000..9223840
--- /dev/null
@@ -0,0 +1,151 @@
+virt-resize, virt-sparsify, virt-customize, virt-sysprep, virt-builder
+----------------------------------------------------------------------
+
+Audience:
+
+ - Interested in manipulating disk images.
+ - May be familiar with disk images, formats, but may not be.
+ - Not developers.
+
+
+1000: Resizing a disk image
+----------------------------------------------------------------------
+
+Show a disk image, use 'qemu-img info' to get data about it.
+
+  $ qemu-img info fedora-22.qcow2
+
+--> Format
+--> Size : virtual and physical may not be related
+
+What the guest would see when booted up:
+
+  $ virt-df -a fedora-22.qcow2 -h
+
+Always use 'qemu-img info', not 'ls -l'.
+
+What if the guest needs more space?
+There are various ways to resize a disk image:
+
+ - Just make the container bigger ('qemu-img resize' or even 'truncate').
+     But the partitions won't get bigger.   [illustrate with picture]
+
+ - Run a tool inside the guest, like parted.  It won't usually work
+   if the disk is mounted.
+
+ - Run a tool alongside the guest, but still in a VM, eg. PartitionMagic,
+   GParted Live.
+
+ - Use virt-resize on the host for offline resizing.
+
+  $ qemu-img create -f qcow2 fedora-22-bigger.qcow2 10G
+  $ virt-resize fedora-22.qcow2 fedora-22-bigger.qcow2 --expand sda3
+  $ virt-df -a fedora-22-bigger.qcow2 -h
+
+virt-resize is quite flexible: For example you could give /dev/sda1
+500 MB and give the rest to /dev/sda3, or you could tell virt-resize
+to put the new space into an extra partition.
+
+Also works for Windows.
+
+
+2000: Sparsifying a disk image
+----------------------------------------------------------------------
+
+Show a fully allocated disk image, this time with 'ls -lh':
+
+  $ qemu-img info fedora-22.img
+  $ du -sh fedora-22.img
+  $ virt-df -a fedora-22.img -h
+
+Sparsify it in place:
+
+  $ virt-sparsify --inplace fedora-22.img
+  $ qemu-img info fedora-22.img
+  $ du -sh fedora-22.img
+
+Explain the two modes for sparsification.
+
+Also works for Windows.
+
+
+3000: Customizing a disk image
+----------------------------------------------------------------------
+
+The situation is that you have an existing guest operating system, and
+you want to _offline_ install packages, set the root password, inject
+files, set the hostname, or about a dozen other things.
+
+  $ virt-customize -a fedora-22.img --install gcc,gdb --root-password password:123456 --edit /etc/selinux/config:s/^SELINUX=.*/SELINUX=permissive/
+  $ virt-cat -a fedora-22.img /etc/selinux/config
+
+Also works for a limited range of operations on Windows.  On Windows,
+most work is done using "firstboot" batch files that run once at the
+next boot.
+
+
+4000: Sysprepping a disk image
+----------------------------------------------------------------------
+
+SYSPREP.EXE is a Microsoft proprietary program for preparing a Windows
+system for duplication.  It removes the identity of the system.
+
+We borrow the name of this program for the next tool, virt-sysprep,
+which does a similar job for Linux systems, turning them into
+templates from which you can clone further guests.  This is a tool
+you'll probably either use all the time or never need to use at all.
+
+  $ virt-sysprep -a fedora-22.img
+
+It runs on the guest in-place.
+
+It performs a serious of sysprepping operations, which you can read
+about in the manual.
+
+There are some operations which are not enabled by default:
+
+  $ virt-sysprep --list-operations
+
+You'll want to read the manual before using this.
+
+This deletes the SSH host keys, because you wouldn't want those to be
+duplicated across clones.  But it can't set up a fresh random seed for
+each clone.  For that you need to set a random seed after the clone,
+using virt-customize.  Virt-builder which I'll talk about next also
+sets a fresh random seed automatically.
+
+
+5000: Building a disk image
+----------------------------------------------------------------------
+
+Show a diagram of the whole process and how the tools are related.
+
+                preparing templates for virt-builder
+  virt-install ---> sysprep ---> sparsify ---> compress ---> templates
+  (OS installer)                                             repository
+
+                running virt-builder as an end user
+  download a template ---> uncompress ---> resize/format ---> customize ---> result
+  or a cloud image
+
+
+  $ virt-builder -l
+  $ virt-builder --notes rhel-7.1
+  $ virt-builder rhel-7.1
+
+Speed is important!
+
+Any virt-customize options can be used:
+
+  $ virt-builder rhel-7.1 --install gcc --selinux-relabel
+
+If you use the --size option, virt-resize is invoked which takes a bit
+longer:
+
+  $ virt-builder rhel-7.1 --size 20G
+  $ virt-df -a rhel-7.1.img -h
+
+virt-builder only builds disk images.  It doesn't run them or upload
+them into glance.
+
+Other tools have been built around virt-builder.
diff --git a/2015-virt-tools/README b/2015-virt-tools/README
new file mode 100644 (file)
index 0000000..192228d
--- /dev/null
@@ -0,0 +1,4 @@
+This is a talk about particular virt tools (virt-resize,
+virt-sparsify, virt-customize, virt-sysprep, virt-builder) which I
+gave privately to Red Hat colleagues (December 2015) and then recorded
+for QEMU's Hangouts on Air programme.
diff --git a/2015-virt-tools/bashrc b/2015-virt-tools/bashrc
new file mode 100644 (file)
index 0000000..4c6a3c6
--- /dev/null
@@ -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/2015-virt-tools/code.js b/2015-virt-tools/code.js
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/2015-virt-tools/functions b/2015-virt-tools/functions
new file mode 100644 (file)
index 0000000..d5347e7
--- /dev/null
@@ -0,0 +1,43 @@
+# -*- 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"
+
+# Ditch libvirt for stability :-(
+export LIBGUESTFS_BACKEND=direct
+
+# 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 "$@"
+}
diff --git a/2015-virt-tools/redhat.png b/2015-virt-tools/redhat.png
new file mode 100644 (file)
index 0000000..f50076a
Binary files /dev/null and b/2015-virt-tools/redhat.png differ
diff --git a/2015-virt-tools/run b/2015-virt-tools/run
new file mode 100755 (executable)
index 0000000..9a80550
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/bash -
+# Run the talk.
+
+set -e
+
+# Avoid GNOME keyring stupidity
+export GNOME_KEYRING_CONTROL=
+export GNOME_KEYRING_PID=
+
+# Clean up everything.
+find -name '*~' -delete
+rm -f [1-9]000-*.d/*
+
+# No proxy.
+#unset http_proxy
+#unset https_proxy
+#unset ftp_proxy
+
+# Get everything into the cache.
+guestfish -a /dev/null run || exit 1
+
+# If not 'quick mode', create the initial images.
+if [ "$1" != "--quick" ]; then
+    pushd 1000-virt-resize.d
+    virt-builder --format qcow2 fedora-22
+    popd
+
+    pushd 2000-virt-sparsify.d
+    qemu-img convert ../1000-virt-resize.d/fedora-22.qcow2 -O raw -o preallocation=falloc fedora-22.img
+    popd
+
+    pushd 3000-virt-customize.d
+    qemu-img convert ../1000-virt-resize.d/fedora-22.qcow2 -O raw fedora-22.img
+    popd
+
+    pushd 4000-virt-sysprep.d
+    qemu-img convert ../1000-virt-resize.d/fedora-22.qcow2 -O raw fedora-22.img
+    popd
+
+    pushd 5000-virt-builder.d
+    popd
+fi
+
+# Run techtalk.
+#techtalk-pse
+~/d/techtalk-pse/techtalk-pse
diff --git a/2015-virt-tools/style.css b/2015-virt-tools/style.css
new file mode 100644 (file)
index 0000000..4a33b8f
--- /dev/null
@@ -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: 28pt; */ /* For max */
+    font-size: 20pt; /* For 1024x768 */
+    /* font-family: liberation, helvetica; */
+    font-family: helvetica;
+}
+
+body td, body th { /* why?? */
+    font-size: 24pt;
+    padding-bottom: 8px;
+}
+
+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