From patchwork Thu Jan 14 16:48:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 42906 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C6D68B7CCD for ; Fri, 15 Jan 2010 03:52:41 +1100 (EST) Received: from localhost ([127.0.0.1]:54898 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NVSup-0005K3-6n for incoming@patchwork.ozlabs.org; Thu, 14 Jan 2010 11:51:23 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NVStK-0005Gd-63 for qemu-devel@nongnu.org; Thu, 14 Jan 2010 11:49:50 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NVStF-00059w-6J for qemu-devel@nongnu.org; Thu, 14 Jan 2010 11:49:49 -0500 Received: from [199.232.76.173] (port=56623 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NVStE-00059d-Tq for qemu-devel@nongnu.org; Thu, 14 Jan 2010 11:49:44 -0500 Received: from mx20.gnu.org ([199.232.41.8]:23646) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NVStE-0001WH-EW for qemu-devel@nongnu.org; Thu, 14 Jan 2010 11:49:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NVSt7-0006rv-SH for qemu-devel@nongnu.org; Thu, 14 Jan 2010 11:49:38 -0500 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0EGnR7c025914 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 14 Jan 2010 11:49:27 -0500 Received: from localhost.localdomain (dhcp-5-175.str.redhat.com [10.32.5.175]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0EGnP6V006447; Thu, 14 Jan 2010 11:49:26 -0500 From: Kevin Wolf To: hch@lst.de Date: Thu, 14 Jan 2010 17:48:29 +0100 Message-Id: <1263487709-4139-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by mx20.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Kevin Wolf , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] qemu-iotests: Test qemu-img rebase X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Kevin Wolf --- 024 | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 024.out | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ group | 1 + 3 files changed, 186 insertions(+), 0 deletions(-) create mode 100755 024 create mode 100644 024.out diff --git a/024 b/024 new file mode 100755 index 0000000..c53831f --- /dev/null +++ b/024 @@ -0,0 +1,104 @@ +#!/bin/sh +# +# Rebasing COW images +# +# Copyright (C) 2009 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# creator +owner=kwolf@redhat.com + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img + rm -f $TEST_DIR/t.$IMGFMT.base_old + rm -f $TEST_DIR/t.$IMGFMT.base_new +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.pattern + +# Currently only qcow2 supports rebasing +_supported_fmt qcow2 +_supported_os Linux + +CLUSTER_SIZE=65536 + +# Cluster allocations to be tested: +# +# Backing (old) 11 -- 11 -- 11 -- 11 -- +# Backing (new) 22 22 -- -- 22 22 -- -- +# COW image 33 33 33 33 -- -- -- -- + +echo "Creating backing file" +echo + +_make_test_img 1G +io_pattern writev $((-2 * CLUSTER_SIZE)) $CLUSTER_SIZE $((2 * CLUSTER_SIZE)) 4 0x11 +mv $TEST_IMG $TEST_IMG.base_old + +echo "Creating new backing file" +echo + +_make_test_img 1G +io_pattern writev $((-4 * CLUSTER_SIZE)) $((2 * CLUSTER_SIZE)) $((4 * CLUSTER_SIZE)) 2 0x22 +mv $TEST_IMG $TEST_IMG.base_new + +echo "Creating COW image" +echo + +_make_test_img -b $TEST_IMG.base_old 1G +io_pattern writev 0 $((4 * CLUSTER_SIZE)) 0 1 0x33 + +echo "Read before the rebase to make sure everything is set up correctly" +echo +io_pattern readv $((0 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33 +io_pattern readv $((1 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33 +io_pattern readv $((2 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33 +io_pattern readv $((3 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33 +io_pattern readv $((4 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11 +io_pattern readv $((5 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00 +io_pattern readv $((6 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11 +io_pattern readv $((7 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00 + +echo +echo Rebase and test again +echo +$QEMU_IMG rebase -b $TEST_IMG.base_new $TEST_IMG +io_pattern readv $((0 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33 +io_pattern readv $((1 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33 +io_pattern readv $((2 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33 +io_pattern readv $((3 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33 +io_pattern readv $((4 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11 +io_pattern readv $((5 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00 +io_pattern readv $((6 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11 +io_pattern readv $((7 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00 + + +# success, all done +echo "*** done" +rm -f $seq.full +status=0 diff --git a/024.out b/024.out new file mode 100644 index 0000000..f75b75e --- /dev/null +++ b/024.out @@ -0,0 +1,81 @@ +QA output created by 024 +Creating backing file + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=65536 +=== IO: pattern 0x11 +qemu-io> wrote 65536/65536 bytes at offset 0 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> wrote 65536/65536 bytes at offset 131072 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> wrote 65536/65536 bytes at offset 262144 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> wrote 65536/65536 bytes at offset 393216 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> Creating new backing file + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=65536 +=== IO: pattern 0x22 +qemu-io> wrote 131072/131072 bytes at offset 0 +128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> wrote 131072/131072 bytes at offset 262144 +128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> Creating COW image + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 backing_file='TEST_DIR/t.IMGFMT.base_old' cluster_size=65536 +=== IO: pattern 0x33 +qemu-io> wrote 262144/262144 bytes at offset 0 +256 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> Read before the rebase to make sure everything is set up correctly + +=== IO: pattern 0x33 +qemu-io> read 65536/65536 bytes at offset 0 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> === IO: pattern 0x33 +qemu-io> read 65536/65536 bytes at offset 65536 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> === IO: pattern 0x33 +qemu-io> read 65536/65536 bytes at offset 131072 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> === IO: pattern 0x33 +qemu-io> read 65536/65536 bytes at offset 196608 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> === IO: pattern 0x11 +qemu-io> read 65536/65536 bytes at offset 262144 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> === IO: pattern 0x00 +qemu-io> read 65536/65536 bytes at offset 327680 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> === IO: pattern 0x11 +qemu-io> read 65536/65536 bytes at offset 393216 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> === IO: pattern 0x00 +qemu-io> read 65536/65536 bytes at offset 458752 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> +Rebase and test again + +=== IO: pattern 0x33 +qemu-io> read 65536/65536 bytes at offset 0 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> === IO: pattern 0x33 +qemu-io> read 65536/65536 bytes at offset 65536 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> === IO: pattern 0x33 +qemu-io> read 65536/65536 bytes at offset 131072 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> === IO: pattern 0x33 +qemu-io> read 65536/65536 bytes at offset 196608 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> === IO: pattern 0x11 +qemu-io> read 65536/65536 bytes at offset 262144 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> === IO: pattern 0x00 +qemu-io> read 65536/65536 bytes at offset 327680 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> === IO: pattern 0x11 +qemu-io> read 65536/65536 bytes at offset 393216 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> === IO: pattern 0x00 +qemu-io> read 65536/65536 bytes at offset 458752 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io> *** done diff --git a/group b/group index 378eb13..b4b3b40 100644 --- a/group +++ b/group @@ -30,3 +30,4 @@ 021 io auto 022 rw snapshot auto 023 rw auto +024 rw backing auto