From: Richard W.M. Jones Date: Fri, 12 Feb 2021 15:09:24 +0000 (+0000) Subject: Slides 6000 (modifications). X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=8448940c7a6a37b5d2d5cd5677f6921768ab233f;p=libguestfs-talks.git Slides 6000 (modifications). --- diff --git a/2021-pipelines/6000-modifications.html b/2021-pipelines/6000-modifications.html new file mode 100644 index 0000000..3f1ad63 --- /dev/null +++ b/2021-pipelines/6000-modifications.html @@ -0,0 +1,22 @@ + + + + +

Modifying disk images in flight

+ +

+virt-v2v can ... +

+ + + +

+(and much more) +

diff --git a/2021-pipelines/6100-simpler-modifications.html b/2021-pipelines/6100-simpler-modifications.html new file mode 100644 index 0000000..08e809e --- /dev/null +++ b/2021-pipelines/6100-simpler-modifications.html @@ -0,0 +1,22 @@ + + + + +

Simpler example of modification

+ +
+┌─────────────┐http┌────────────┐    ┌────────────┐
+│ cloud image │───▶│ xz filter  │───▶│ nbdkit     │
+└─────────────┘    └────────────┘    └────────────┘
+
+                                           ◀─── virt-sparsify --in-place
+
+                                        ◀─── virt-customize
+                                             to deactivate cloud-init
+
+                                     ◀─── virt-customize
+                                          to modify /etc/motd
+                                                            ┌───────────┐
+                                 ───▶ qemu-img convert ────▶│ local.img │
+                                                            └───────────┘
+
diff --git a/2021-pipelines/6200-simpler-modifications.term b/2021-pipelines/6200-simpler-modifications.term new file mode 100755 index 0000000..a6fd7a4 --- /dev/null +++ b/2021-pipelines/6200-simpler-modifications.term @@ -0,0 +1,17 @@ +#!/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 diff --git a/2021-pipelines/notes.txt b/2021-pipelines/notes.txt index 1a51db9..8941a30 100644 --- a/2021-pipelines/notes.txt +++ b/2021-pipelines/notes.txt @@ -311,14 +311,28 @@ I'm not going to talk about this in great detail because it's a very 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 @@ -354,32 +368,6 @@ Discuss: - 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 ----------------------------------------------------------------------