Add benchmarking test scripts.
authorRichard W.M. Jones <rjones@redhat.com>
Wed, 10 Feb 2021 09:49:54 +0000 (09:49 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Wed, 10 Feb 2021 13:08:33 +0000 (13:08 +0000)
2021-pipelines/.gitignore [new file with mode: 0644]
2021-pipelines/benchmarking/create.sh [new file with mode: 0755]
2021-pipelines/benchmarking/settings.sh [new file with mode: 0644]
2021-pipelines/benchmarking/testA4.sh [new file with mode: 0755]
2021-pipelines/benchmarking/testA5.sh [new file with mode: 0755]
2021-pipelines/benchmarking/testA6.sh [new file with mode: 0755]
2021-pipelines/benchmarking/testB4.sh [new file with mode: 0755]

diff --git a/2021-pipelines/.gitignore b/2021-pipelines/.gitignore
new file mode 100644 (file)
index 0000000..ec5fe0c
--- /dev/null
@@ -0,0 +1,2 @@
+benchmarking/local.img
+*.qcow2
\ No newline at end of file
diff --git a/2021-pipelines/benchmarking/create.sh b/2021-pipelines/benchmarking/create.sh
new file mode 100755 (executable)
index 0000000..ee5bb1d
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash
+set -x
+set -e
+
+source settings.sh
+
+file=$dir/fedora-33.img
+
+virt-builder fedora-33 --size 32G -o $file
+virt-customize -a $file \
+    --run-command 'dd if=/dev/urandom of=/var/tmp/big bs=1M count=3000 &&
+                   sync &&
+                   rm /var/tmp/big'
diff --git a/2021-pipelines/benchmarking/settings.sh b/2021-pipelines/benchmarking/settings.sh
new file mode 100644 (file)
index 0000000..28f87f1
--- /dev/null
@@ -0,0 +1,5 @@
+export LIBGUESTFS_BACKEND=direct
+
+remote=kool
+dir=/mnt/scratch/pipes
+ova=$HOME/test.ova
diff --git a/2021-pipelines/benchmarking/testA4.sh b/2021-pipelines/benchmarking/testA4.sh
new file mode 100755 (executable)
index 0000000..88085d0
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+set -x
+set -e
+
+source settings.sh
+
+qemu-img create -f qcow2 -b ssh://$remote/$dir/fedora-33.img snapshot.qcow2
+virt-sparsify --inplace snapshot.qcow2
+qemu-img convert -f qcow2 snapshot.qcow2 -O raw local.img
diff --git a/2021-pipelines/benchmarking/testA5.sh b/2021-pipelines/benchmarking/testA5.sh
new file mode 100755 (executable)
index 0000000..9e6260c
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+set -x
+set -e
+
+source settings.sh
+
+qemu-img create -f qcow2 -b ssh://$remote/$dir/fedora-33.img snapshot.qcow2
+qemu-img convert -f qcow2 snapshot.qcow2 -O raw local.img
diff --git a/2021-pipelines/benchmarking/testA6.sh b/2021-pipelines/benchmarking/testA6.sh
new file mode 100755 (executable)
index 0000000..e19dca2
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+set -x
+set -e
+
+source settings.sh
+
+nbdkit -f --exit-with-parent --filter=cow ssh host=$remote $dir/fedora-33.img &
+sleep 1
+guestfish <<EOF
+  add "" protocol:nbd server:tcp:localhost discard:enable format:raw
+  run
+  mount-options discard /dev/sda2 /
+  fstrim /
+  umount /
+  mount-options discard /dev/sda3 /
+  fstrim /
+  umount /
+EOF
+nbdcopy nbd://localhost local.img
diff --git a/2021-pipelines/benchmarking/testB4.sh b/2021-pipelines/benchmarking/testB4.sh
new file mode 100755 (executable)
index 0000000..f8d0e81
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+set -x
+set -e
+
+source settings.sh
+
+nbdkit -f --exit-with-parent --filter=tar file $ova tar-entry=fedora-33.img &
+sleep 0.5
+qemu-img create -f qcow2 -b nbd:localhost:10809 snapshot.qcow2
+virt-sparsify --inplace snapshot.qcow2
+qemu-img convert -f qcow2 snapshot.qcow2 -O raw local.img