cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-qemu-iotests-add-test-for-qcow2-preallocation-with-d.patch

0a122b
From a3a428e70ae71ec09d66cd405bf6a0ef7c42feb4 Mon Sep 17 00:00:00 2001
0a122b
From: Max Reitz <mreitz@redhat.com>
0a122b
Date: Sat, 15 Feb 2014 16:03:50 +0100
0a122b
Subject: [PATCH 5/5] qemu-iotests: add test for qcow2 preallocation with different cluster sizes
0a122b
0a122b
RH-Author: Max Reitz <mreitz@redhat.com>
0a122b
Message-id: <1392480230-24011-5-git-send-email-mreitz@redhat.com>
0a122b
Patchwork-id: 57295
0a122b
O-Subject: [RHEL-7.0 qemu-kvm PATCH 4/4] qemu-iotests: add test for qcow2 preallocation with different cluster sizes
0a122b
Bugzilla: 1055848
0a122b
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
RH-Acked-by: Fam Zheng <famz@redhat.com>
0a122b
0a122b
From: Hu Tao <hutao@cn.fujitsu.com>
0a122b
0a122b
BZ: 1049176
0a122b
BZ: 1055848
0a122b
0a122b
Reviewed-by: Max Reitz <mreitz@redhat.com>
0a122b
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
(cherry picked from commit 693a50ade339e3ef9b042fd73a3b81405101ba3d)
0a122b
0a122b
Signed-off-by: Max Reitz <mreitz@redhat.com>
0a122b
---
0a122b
 tests/qemu-iotests/079     | 63 ++++++++++++++++++++++++++++++++++++++++++++++
0a122b
 tests/qemu-iotests/079.out | 32 +++++++++++++++++++++++
0a122b
 tests/qemu-iotests/group   |  1 +
0a122b
 3 files changed, 96 insertions(+)
0a122b
 create mode 100755 tests/qemu-iotests/079
0a122b
 create mode 100644 tests/qemu-iotests/079.out
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 tests/qemu-iotests/079     |   63 ++++++++++++++++++++++++++++++++++++++++++++
0a122b
 tests/qemu-iotests/079.out |   32 ++++++++++++++++++++++
0a122b
 tests/qemu-iotests/group   |    1 +
0a122b
 3 files changed, 96 insertions(+), 0 deletions(-)
0a122b
 create mode 100755 tests/qemu-iotests/079
0a122b
 create mode 100644 tests/qemu-iotests/079.out
0a122b
0a122b
diff --git a/tests/qemu-iotests/079 b/tests/qemu-iotests/079
0a122b
new file mode 100755
0a122b
index 0000000..2142bbb
0a122b
--- /dev/null
0a122b
+++ b/tests/qemu-iotests/079
0a122b
@@ -0,0 +1,63 @@
0a122b
+#!/bin/bash
0a122b
+#
0a122b
+# Test qcow2 preallocation with different cluster_sizes
0a122b
+#
0a122b
+# Copyright (C) 2014 Fujitsu.
0a122b
+#
0a122b
+# This program is free software; you can redistribute it and/or modify
0a122b
+# it under the terms of the GNU General Public License as published by
0a122b
+# the Free Software Foundation; either version 2 of the License, or
0a122b
+# (at your option) any later version.
0a122b
+#
0a122b
+# This program is distributed in the hope that it will be useful,
0a122b
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
0a122b
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0a122b
+# GNU General Public License for more details.
0a122b
+#
0a122b
+# You should have received a copy of the GNU General Public License
0a122b
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
0a122b
+#
0a122b
+
0a122b
+# creator
0a122b
+owner=hutao@cn.fujitsu.com
0a122b
+
0a122b
+seq=`basename $0`
0a122b
+echo "QA output created by $seq"
0a122b
+
0a122b
+here=`pwd`
0a122b
+tmp=/tmp/$$
0a122b
+status=1	# failure is the default!
0a122b
+
0a122b
+_cleanup()
0a122b
+{
0a122b
+	_cleanup_test_img
0a122b
+}
0a122b
+trap "_cleanup; exit \$status" 0 1 2 3 15
0a122b
+
0a122b
+# get standard environment, filters and checks
0a122b
+. ./common.rc
0a122b
+. ./common.filter
0a122b
+
0a122b
+_supported_fmt qcow2
0a122b
+_supported_proto file
0a122b
+_supported_os Linux
0a122b
+
0a122b
+function test_qemu_img()
0a122b
+{
0a122b
+    echo qemu-img "$@" | _filter_testdir
0a122b
+    $QEMU_IMG "$@" 2>&1 | _filter_testdir
0a122b
+    echo
0a122b
+}
0a122b
+
0a122b
+echo "=== Check option preallocation and cluster_size ==="
0a122b
+echo
0a122b
+cluster_sizes="16384 32768 65536 131072 262144 524288 1048576 2097152 4194304"
0a122b
+
0a122b
+for s in $cluster_sizes; do
0a122b
+    test_qemu_img create -f $IMGFMT -o preallocation=metadata,cluster_size=$s "$TEST_IMG" 4G
0a122b
+done
0a122b
+
0a122b
+# success, all done
0a122b
+echo "*** done"
0a122b
+rm -f $seq.full
0a122b
+status=0
0a122b
diff --git a/tests/qemu-iotests/079.out b/tests/qemu-iotests/079.out
0a122b
new file mode 100644
0a122b
index 0000000..ef4b8c9
0a122b
--- /dev/null
0a122b
+++ b/tests/qemu-iotests/079.out
0a122b
@@ -0,0 +1,32 @@
0a122b
+QA output created by 079
0a122b
+=== Check option preallocation and cluster_size ===
0a122b
+
0a122b
+qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=16384 TEST_DIR/t.qcow2 4G
0a122b
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=4294967296 encryption=off cluster_size=16384 preallocation='metadata' lazy_refcounts=off
0a122b
+
0a122b
+qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=32768 TEST_DIR/t.qcow2 4G
0a122b
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=4294967296 encryption=off cluster_size=32768 preallocation='metadata' lazy_refcounts=off
0a122b
+
0a122b
+qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=65536 TEST_DIR/t.qcow2 4G
0a122b
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=4294967296 encryption=off cluster_size=65536 preallocation='metadata' lazy_refcounts=off
0a122b
+
0a122b
+qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=131072 TEST_DIR/t.qcow2 4G
0a122b
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=4294967296 encryption=off cluster_size=131072 preallocation='metadata' lazy_refcounts=off
0a122b
+
0a122b
+qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=262144 TEST_DIR/t.qcow2 4G
0a122b
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=4294967296 encryption=off cluster_size=262144 preallocation='metadata' lazy_refcounts=off
0a122b
+
0a122b
+qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=524288 TEST_DIR/t.qcow2 4G
0a122b
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=4294967296 encryption=off cluster_size=524288 preallocation='metadata' lazy_refcounts=off
0a122b
+
0a122b
+qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=1048576 TEST_DIR/t.qcow2 4G
0a122b
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=4294967296 encryption=off cluster_size=1048576 preallocation='metadata' lazy_refcounts=off
0a122b
+
0a122b
+qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=2097152 TEST_DIR/t.qcow2 4G
0a122b
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=4294967296 encryption=off cluster_size=2097152 preallocation='metadata' lazy_refcounts=off
0a122b
+
0a122b
+qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=4194304 TEST_DIR/t.qcow2 4G
0a122b
+qemu-img: TEST_DIR/t.qcow2: Cluster size must be a power of two between 512 and 2048k
0a122b
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=4294967296 encryption=off cluster_size=4194304 preallocation='metadata' lazy_refcounts=off
0a122b
+
0a122b
+*** done
0a122b
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
0a122b
index dd70acb..fce6ca8 100644
0a122b
--- a/tests/qemu-iotests/group
0a122b
+++ b/tests/qemu-iotests/group
0a122b
@@ -72,3 +72,4 @@
0a122b
 068 rw auto
0a122b
 070 rw auto
0a122b
 077 rw auto
0a122b
+079 rw auto
0a122b
-- 
0a122b
1.7.1
0a122b