|
|
696189 |
From 672b9795e85b48f337b3da2d6fa393e7788d79a1 Mon Sep 17 00:00:00 2001
|
|
|
696189 |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
696189 |
Date: Fri, 1 Jul 2022 11:18:53 +0100
|
|
|
696189 |
Subject: [PATCH] tests: Add a simple test of -o local -of qcow2 -oo compressed
|
|
|
696189 |
|
|
|
696189 |
This only tests that it doesn't completely fail, which it did before
|
|
|
696189 |
we fixed nbdcopy. I checked the file sizes manually and with
|
|
|
696189 |
compression the resulting file is about half the size.
|
|
|
696189 |
|
|
|
696189 |
This test is a clone of tests/test-v2v-of-option.sh. In order to
|
|
|
696189 |
compare the sizes across the two tests, and to keep the tests fairly
|
|
|
696189 |
similar I added an ls -l command to the original test.
|
|
|
696189 |
|
|
|
696189 |
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
696189 |
(cherry picked from commit 7505750972b49e1a448c519a27998bd5f20be60a)
|
|
|
696189 |
---
|
|
|
696189 |
tests/Makefile.am | 2 +
|
|
|
696189 |
tests/test-v2v-o-local-qcow2-compressed.sh | 53 ++++++++++++++++++++++
|
|
|
696189 |
tests/test-v2v-of-option.sh | 2 +
|
|
|
696189 |
3 files changed, 57 insertions(+)
|
|
|
696189 |
create mode 100755 tests/test-v2v-o-local-qcow2-compressed.sh
|
|
|
696189 |
|
|
|
696189 |
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
|
|
696189 |
index e787a86c..a26ecf7a 100644
|
|
|
696189 |
--- a/tests/Makefile.am
|
|
|
696189 |
+++ b/tests/Makefile.am
|
|
|
696189 |
@@ -82,6 +82,7 @@ TESTS = \
|
|
|
696189 |
test-v2v-networks-and-bridges.sh \
|
|
|
696189 |
test-v2v-o-glance.sh \
|
|
|
696189 |
test-v2v-o-libvirt.sh \
|
|
|
696189 |
+ test-v2v-o-local-qcow2-compressed.sh \
|
|
|
696189 |
test-v2v-o-null.sh \
|
|
|
696189 |
test-v2v-o-openstack.sh \
|
|
|
696189 |
test-v2v-o-qemu.sh \
|
|
|
696189 |
@@ -241,6 +242,7 @@ EXTRA_DIST += \
|
|
|
696189 |
test-v2v-networks-and-bridges-expected.xml \
|
|
|
696189 |
test-v2v-o-glance.sh \
|
|
|
696189 |
test-v2v-o-libvirt.sh \
|
|
|
696189 |
+ test-v2v-o-local-qcow2-compressed.sh \
|
|
|
696189 |
test-v2v-o-null.sh \
|
|
|
696189 |
test-v2v-o-openstack.sh \
|
|
|
696189 |
test-v2v-o-qemu.sh \
|
|
|
696189 |
diff --git a/tests/test-v2v-o-local-qcow2-compressed.sh b/tests/test-v2v-o-local-qcow2-compressed.sh
|
|
|
696189 |
new file mode 100755
|
|
|
696189 |
index 00000000..32c9ebbe
|
|
|
696189 |
--- /dev/null
|
|
|
696189 |
+++ b/tests/test-v2v-o-local-qcow2-compressed.sh
|
|
|
696189 |
@@ -0,0 +1,53 @@
|
|
|
696189 |
+#!/bin/bash -
|
|
|
696189 |
+# libguestfs virt-v2v test script
|
|
|
696189 |
+# Copyright (C) 2014-2022 Red Hat Inc.
|
|
|
696189 |
+#
|
|
|
696189 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
696189 |
+# it under the terms of the GNU General Public License as published by
|
|
|
696189 |
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
696189 |
+# (at your option) any later version.
|
|
|
696189 |
+#
|
|
|
696189 |
+# This program is distributed in the hope that it will be useful,
|
|
|
696189 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
696189 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
696189 |
+# GNU General Public License for more details.
|
|
|
696189 |
+#
|
|
|
696189 |
+# You should have received a copy of the GNU General Public License
|
|
|
696189 |
+# along with this program; if not, write to the Free Software
|
|
|
696189 |
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
696189 |
+
|
|
|
696189 |
+# Test -o local -of qcow2 -oo compressed.
|
|
|
696189 |
+
|
|
|
696189 |
+set -e
|
|
|
696189 |
+
|
|
|
696189 |
+source ./functions.sh
|
|
|
696189 |
+set -e
|
|
|
696189 |
+set -x
|
|
|
696189 |
+
|
|
|
696189 |
+skip_if_skipped
|
|
|
696189 |
+requires test -f ../test-data/phony-guests/windows.img
|
|
|
696189 |
+
|
|
|
696189 |
+# This requires fixed nbdcopy >= 1.13.5.
|
|
|
696189 |
+requires nbdcopy --version
|
|
|
696189 |
+nbdcopy --version | {
|
|
|
696189 |
+ IFS=' .' read name major minor release
|
|
|
696189 |
+ requires test \( "$major" -gt 1 \) -o \
|
|
|
696189 |
+ \( "$major" -eq 1 -a "$minor" -gt 13 \) -o \
|
|
|
696189 |
+ \( "$major" -eq 1 -a "$minor" -eq 13 -a "$release" -ge 5 \)
|
|
|
696189 |
+}
|
|
|
696189 |
+
|
|
|
696189 |
+export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools"
|
|
|
696189 |
+
|
|
|
696189 |
+d=test-v2v-o-local-qcow2-compressed.d
|
|
|
696189 |
+rm -rf $d
|
|
|
696189 |
+cleanup_fn rm -rf $d
|
|
|
696189 |
+mkdir $d
|
|
|
696189 |
+
|
|
|
696189 |
+$VG virt-v2v --debug-gc \
|
|
|
696189 |
+ -i disk ../test-data/phony-guests/windows.img \
|
|
|
696189 |
+ -o local -of qcow2 -oo compressed -os $d
|
|
|
696189 |
+
|
|
|
696189 |
+# Test the libvirt XML metadata and a disk was created.
|
|
|
696189 |
+ls -l $d
|
|
|
696189 |
+test -f $d/windows.xml
|
|
|
696189 |
+test -f $d/windows-sda
|
|
|
696189 |
diff --git a/tests/test-v2v-of-option.sh b/tests/test-v2v-of-option.sh
|
|
|
696189 |
index bdfd3418..6c5f5938 100755
|
|
|
696189 |
--- a/tests/test-v2v-of-option.sh
|
|
|
696189 |
+++ b/tests/test-v2v-of-option.sh
|
|
|
696189 |
@@ -42,6 +42,8 @@ $VG virt-v2v --debug-gc \
|
|
|
696189 |
-i libvirt -ic "$libvirt_uri" windows \
|
|
|
696189 |
-o local -os $d -of qcow2
|
|
|
696189 |
|
|
|
696189 |
+ls -l $d
|
|
|
696189 |
+
|
|
|
696189 |
# Test the disk is qcow2 format.
|
|
|
696189 |
if [ "$(guestfish disk-format $d/windows-sda)" != qcow2 ]; then
|
|
|
696189 |
echo "$0: test failed: output is not qcow2"
|