yeahuh / 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

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