--- /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>Modifying disk images in flight</h1>
+
+<p>
+virt-v2v can ...
+</p>
+
+<ul>
+<li> install virtio drivers
+<li> remove VMware tools
+<li> modify the bootloader
+<li> rebuild the initramfs
+<li> change device names in /etc files
+<li> change the Windows registry
+</ul>
+
+<p>
+(and much more)
+</p>
--- /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>Simpler example of modification</h1>
+
+<pre>
+┌─────────────┐http┌────────────┐ ┌────────────┐
+│ cloud image │───▶│ xz filter │───▶│ nbdkit │
+└─────────────┘ └────────────┘ └────────────┘
+
+ ◀─── virt-sparsify --in-place
+
+ ◀─── <b>virt-customize</b>
+ to deactivate cloud-init
+
+ ◀─── <b>virt-customize</b>
+ to modify /etc/motd
+ ┌───────────┐
+ ───▶ qemu-img convert ────▶│ local.img │
+ └───────────┘
+</pre>
--- /dev/null
+#!/bin/bash -
+
+source functions
+
+# Title.
+export title="Modifying a disk image in flight"
+
+# History.
+remember 'nbdkit curl https://download.fedoraproject.org/pub/fedora/linux/releases/33/Cloud/x86_64/images/Fedora-Cloud-Base-33-1.2.x86_64.raw.xz --filter=xz'
+remember 'qemu-img create -f qcow2 -F raw -b nbd://localhost snapshot.qcow2'
+remember 'virt-sparsify --inplace snapshot.qcow2'
+remember 'virt-customize -a snapshot.qcow2 --run-command "systemctl disable cloud-init" --write /etc/motd:HELLO_WORLD'
+remember 'ls -lh snapshot.qcow2'
+remember 'qemu-img convert -f qcow2 snapshot.qcow2 -O raw local.img -p'
+remember 'virt-cat -a local.img /etc/motd'
+
+terminal
complex topic. Instead I will show you a simple demonstration of a
similar technique.
- qemu-img create -f qcow2 -b ssh://kool/mnt/scratch/pipes/fedora-33.img snapshot.qcow2
+DIAGRAM:
+
+ (Screenshot from https://alt.fedoraproject.org/cloud/)
+
+ HTTPS
+ -----> nbdkit-curl-plugin --> xz filter --> qcow2 snapshot
+ <-- sparsify
+ <-- deactivate cloud-init
+ <-- write a file
+ --> qemu-img convert
+
+DEMO:
+
+ nbdkit curl https://download.fedoraproject.org/pub/fedora/linux/releases/33/Cloud/x86_64/images/Fedora-Cloud-Base-33-1.2.x86_64.raw.xz --filter=xz
+ qemu-img create -f qcow2 -b nbd://localhost -F raw snapshot.qcow2
virt-sparsify --inplace snapshot.qcow2
- guestfish -a snapshot.qcow2 -i write /etc/motd 'HEY, IT WORKED!'
- ls -lh snapshot.qcow2
+ virt-customize -a snapshot.qcow2 \
+ --run-command 'systemctl disable cloud-init' \
+ --write /hello:HELLO
+ ls -lsh snapshot.qcow2
qemu-img convert -f qcow2 snapshot.qcow2 -O raw local.img -p
- virt-cat -a local.img /etc/motd
-
-(Show this as a demo. Show original untouched)
+ guestfish --ro -a local.img -i ll /
Complete virt-v2v paths
- many other tricks used
-Streaming and modifying a compressed image
-----------------------------------------------------------------------
-
-DIAGRAM:
-
- (Screenshot from https://alt.fedoraproject.org/cloud/)
-
- HTTPS
- -----> nbdkit-curl-plugin --> xz filter --> qcow2 snapshot
- <-- sparsify
- <-- deactivate cloud-init
- <-- write a file
- --> qemu-img convert
-
-DEMO:
-
- nbdkit curl https://download.fedoraproject.org/pub/fedora/linux/releases/33/Cloud/x86_64/images/Fedora-Cloud-Base-33-1.2.x86_64.raw.xz --filter=xz
- qemu-img create -f qcow2 -b nbd://localhost -F raw snapshot.qcow2
- virt-sparsify --inplace snapshot.qcow2
- virt-customize -a snapshot.qcow2 \
- --run-command 'systemctl disable cloud-init' \
- --write /hello:HELLO
- ls -lsh snapshot.qcow2
- qemu-img convert -f qcow2 snapshot.qcow2 -O raw local.img -p
- guestfish --ro -a local.img -i ll /
-
Conclusions
----------------------------------------------------------------------