提交 5105b6d8 编写于 作者: A Anthony Liguori

Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony: (46 commits)
  qemu-iotests: common.config: Allow use of arbitrary qemu* paths
  qemu-iotests: check: print relevant path information
  qemu-iotests: test loading internal snapshots
  qemu-iotests: Update filter for default cluster size
  qemu-iotests: add qed support to 025 image resize test
  qemu-iotests: Update rbd support
  qemu-iotests: common.config: Fix no $TEST_DIR directory
  qemu-iotests: only run 016 for file and sheepdog protocols
  qemu-iotests: Use zero-based offsets for IO patterns
  qemu-iotests: add support for rbd and sheepdog protocols
  qemu-iotests: filter IMGFMT correctly in 019
  qemu-iotests: README: Fix spelling
  qemu-iotests: add support for qed format
  qemu-iotests: filter TEST_DIR correctly in 019
  qemu-iotests: fix 019 golden output
  qemu-iotests: update expected results after qemu-img changes
  qemu-iotests: add read/write from smaller backing image test
  qemu-iotests: add sub-cluster allocating write test for sparse image formats
  qemu-iotests: improve test for qemu-img convert with backing file
  qemu-iotests: consider more cases in parsing qemu-io output
  ...
check.log
check.time
*.out.bad
*.notrun
# ignore everything in the scratch directory
scratch/
#!/bin/bash
#
# Test simple read/write using plain bdrv_read/bdrv_write
#
# 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 <http://www.gnu.org/licenses/>.
#
# creator
owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
_supported_fmt generic
_supported_proto generic
_supported_os Linux
size=128M
_make_test_img $size
echo
echo "== reading whole image =="
$QEMU_IO -c "read 0 $size" $TEST_IMG | _filter_qemu_io
echo
echo "== rewriting whole image =="
$QEMU_IO -c "write -P 0xa 0 $size" $TEST_IMG | _filter_qemu_io
echo
echo "== verify pattern =="
$QEMU_IO -c "read -P 0xa 0 $size" $TEST_IMG | _filter_qemu_io
# success, all done
echo "*** done"
rm -f $seq.full
status=0
QA output created by 001
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
== reading whole image ==
read 134217728/134217728 bytes at offset 0
128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== rewriting whole image ==
wrote 134217728/134217728 bytes at offset 0
128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== verify pattern ==
read 134217728/134217728 bytes at offset 0
128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
*** done
#!/bin/bash
#
# Test simple read/write using plain bdrv_pread/bdrv_pwrite
#
# 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 <http://www.gnu.org/licenses/>.
#
# creator
owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
_supported_fmt generic
_supported_proto generic
_supported_os Linux
size=128M
_make_test_img $size
echo
echo "== reading whole image =="
$QEMU_IO -c "read -p 0 $size" $TEST_IMG | _filter_qemu_io
echo
echo "== rewriting whole image =="
$QEMU_IO -c "write -pP 0xa 0 $size" $TEST_IMG | _filter_qemu_io
echo
echo "== verify pattern =="
$QEMU_IO -c "read -pP 0xa 0 $size" $TEST_IMG | _filter_qemu_io
echo
echo "unaligned pwrite"
$QEMU_IO -c 'write -pP 0xab 66 42' $TEST_IMG | _filter_qemu_io
echo
echo "verify pattern"
$QEMU_IO -c 'read -pP 0xab 66 42' $TEST_IMG | _filter_qemu_io
# success, all done
echo "*** done"
rm -f $seq.full
status=0
QA output created by 002
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
== reading whole image ==
read 134217728/134217728 bytes at offset 0
128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== rewriting whole image ==
wrote 134217728/134217728 bytes at offset 0
128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== verify pattern ==
read 134217728/134217728 bytes at offset 0
128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
unaligned pwrite
wrote 42/42 bytes at offset 66
42.000000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
verify pattern
read 42/42 bytes at offset 66
42.000000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
*** done
#!/bin/bash
#
# Test simple read/write using bdrv_aio_readv/bdrv_aio_writev
#
# 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 <http://www.gnu.org/licenses/>.
#
# creator
owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
_supported_fmt generic
_supported_proto generic
_supported_os Linux
size=128M
offset=67M
chunksize=8k
_make_test_img $size
echo
echo "== reading whole image =="
$QEMU_IO -c "readv 0 $size" $TEST_IMG | _filter_qemu_io
echo
echo "== rewriting whole image =="
$QEMU_IO -c "writev -P 0xa 0 $size" $TEST_IMG | _filter_qemu_io
echo
echo "== verify pattern =="
$QEMU_IO -c "readv -P 0xa 0 $size" $TEST_IMG | _filter_qemu_io
echo
echo "== vectored write =="
$QEMU_IO -c "writev -P 0xb $offset $chunksize $chunksize \
$chunksize $chunksize $chunksize $chunksize $chunksize" \
$TEST_IMG | _filter_qemu_io
echo
echo "== verify pattern =="
$QEMU_IO -c "readv -P 0xb $offset $chunksize $chunksize \
$chunksize $chunksize $chunksize $chunksize $chunksize" \
$TEST_IMG | _filter_qemu_io
# success, all done
echo "*** done"
rm -f $seq.full
status=0
QA output created by 003
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
== reading whole image ==
read 134217728/134217728 bytes at offset 0
128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== rewriting whole image ==
wrote 134217728/134217728 bytes at offset 0
128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== verify pattern ==
read 134217728/134217728 bytes at offset 0
128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== vectored write ==
wrote 57344/57344 bytes at offset 70254592
56 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== verify pattern ==
read 57344/57344 bytes at offset 70254592
56 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
*** done
#!/bin/bash
#
# Make sure we can't read and write outside of the image size.
#
# 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 <http://www.gnu.org/licenses/>.
#
# creator
owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
_supported_fmt generic
_supported_proto generic
_supported_os Linux
size=128M
pre_offset=127M
past_offset=140M
_make_test_img $size
echo
echo "write before image boundary"
$QEMU_IO -c "write $pre_offset 1M" $TEST_IMG | _filter_qemu_io
echo
echo "write into image boundary"
$QEMU_IO -c "write $pre_offset 4M" $TEST_IMG
echo
echo "write at image boundary"
$QEMU_IO -c "write $size 4096" $TEST_IMG
echo
echo "write past image boundary"
$QEMU_IO -c "write $past_offset 4096" $TEST_IMG
echo
echo "pwrite past image boundary"
$QEMU_IO -c "write -p $past_offset 4096" $TEST_IMG
echo
echo "writev past image boundary"
$QEMU_IO -c "writev $past_offset 4096" $TEST_IMG
echo
echo "read before image boundary"
$QEMU_IO -c "read $pre_offset 1M" $TEST_IMG | _filter_qemu_io
echo
echo "read into image boundary"
$QEMU_IO -c "read $pre_offset 4M" $TEST_IMG
echo
echo "read at image boundary"
$QEMU_IO -c "read $size 4096" $TEST_IMG
echo
echo "read past image boundary"
$QEMU_IO -c "read $past_offset 4096" $TEST_IMG
echo
echo "pread past image boundary"
$QEMU_IO -c "read -p $past_offset 4096" $TEST_IMG
echo
echo "readv past image boundary"
$QEMU_IO -c "readv $past_offset 4096" $TEST_IMG
# success, all done
echo "*** done"
rm -f $seq.full
status=0
QA output created by 004
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
write before image boundary
wrote 1048576/1048576 bytes at offset 133169152
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
write into image boundary
write failed: Input/output error
write at image boundary
write failed: Input/output error
write past image boundary
write failed: Input/output error
pwrite past image boundary
write failed: Input/output error
writev past image boundary
writev failed: Input/output error
read before image boundary
read 1048576/1048576 bytes at offset 133169152
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read into image boundary
read failed: Input/output error
read at image boundary
read failed: Input/output error
read past image boundary
read failed: Input/output error
pread past image boundary
read failed: Input/output error
readv past image boundary
readv failed: Input/output error
*** done
#!/bin/bash
#
# Make sure qemu-img can create 5TB images
#
# Based on a testcase from Chris Wright,
# https://bugzilla.redhat.com/show_bug.cgi?id=491943
#
# 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 <http://www.gnu.org/licenses/>.
#
# creator
owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
_supported_fmt generic
_supported_proto generic
_supported_os Linux
# vpc is limited to 127GB, so we can't test it here
if [ "$IMGFMT" = "vpc" ]; then
_notrun "image format $IMGFMT does not support large image sizes"
fi
# sheepdog image is limited to 4TB, so we can't test it here
if [ "$IMGPROTO" = "sheepdog" ]; then
_notrun "image protocol $IMGPROTO does not support large image sizes"
fi
echo
echo "creating large image"
_make_test_img 5000G
echo
echo "small read"
$QEMU_IO -c "read 1024 4096" $TEST_IMG | _filter_qemu_io
echo
echo "small write"
$QEMU_IO -c "read 8192 4096" $TEST_IMG | _filter_qemu_io
# success, all done
echo "*** done"
rm -f $seq.full
status=0
QA output created by 005
creating large image
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=5368709120000
small read
read 4096/4096 bytes at offset 1024
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
small write
read 4096/4096 bytes at offset 8192
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
*** done
#!/bin/bash
#
# Make sure qemu-img rejects > 127GB images for the vpc format as the format
# doesn't support this.
#
# 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 <http://www.gnu.org/licenses/>.
#
# creator
owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
_supported_fmt vpc
_supported_proto generic
_supported_os Linux
echo
echo "creating 128GB image"
_make_test_img 128G
# success, all done
echo "*** done"
rm -f $seq.full
status=0
QA output created by 006
creating 128GB image
qemu-img: The image size is too large for file format 'vpc'
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=137438953472
*** done
#!/bin/bash
#
# Check for one possible case of qcow2 refcount corruption.
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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
true
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
# currently only qcow2 allows for consistency checks using qemu-img
_supported_fmt qcow2
_supported_proto generic
_supported_os Linux
echo
echo "creating image"
_make_test_img 1M
for i in `seq 1 10`; do
echo "savevm $i"
# XXX(hch): adding -nographic would be good, but hangs the test
$QEMU -hda $TEST_IMG -monitor stdio >/dev/null 2>&1 <<EOF
savevm test-$i
quit
EOF
done
echo
echo "checking image for errors"
_check_test_img
# success, all done
echo "*** done"
rm -f $seq.full
status=0
QA output created by 007
creating image
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
savevm 1
savevm 2
savevm 3
savevm 4
savevm 5
savevm 6
savevm 7
savevm 8
savevm 9
savevm 10
checking image for errors
No errors were found on the image.
*** done
#!/bin/bash
#
# Test simple asynchronous read/write operations.
#
# 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 <http://www.gnu.org/licenses/>.
#
# creator
owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
_supported_fmt generic
_supported_proto generic
_supported_os Linux
size=128M
_make_test_img $size
echo
echo "== reading whole image =="
$QEMU_IO -c "aio_read 0 $size" $TEST_IMG | _filter_qemu_io
echo
echo "== rewriting whole image =="
$QEMU_IO -c "aio_write -P 0xa 0 $size" $TEST_IMG | _filter_qemu_io
echo
echo "== verify pattern =="
$QEMU_IO -c "aio_read -P 0xa 0 $size" $TEST_IMG | _filter_qemu_io
# success, all done
echo "*** done"
rm -f $seq.full
status=0
QA output created by 008
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
== reading whole image ==
read 134217728/134217728 bytes at offset 0
128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== rewriting whole image ==
wrote 134217728/134217728 bytes at offset 0
128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== verify pattern ==
read 134217728/134217728 bytes at offset 0
128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
*** done
#!/bin/bash
#
# Nolan I qcow2 corruption - incorrectly reports free clusters
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
_supported_fmt generic
_supported_proto generic
_supported_os Linux
size=6G
echo
echo "creating image"
_make_test_img $size
echo
echo "creating pattern"
$QEMU_IO \
-c "write 2048k 4k -P 65" \
-c "write 4k 4k" \
-c "write 9M 4k" \
-c "read 2044k 8k -P 65 -s 4k -l 4k" \
$TEST_IMG | _filter_qemu_io
echo
echo "checking image for errors"
_check_test_img
# success, all done
echo "*** done"
rm -f $seq.full
status=0
QA output created by 009
creating image
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=6442450944
creating pattern
wrote 4096/4096 bytes at offset 2097152
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 4096/4096 bytes at offset 4096
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 4096/4096 bytes at offset 9437184
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 8192/8192 bytes at offset 2093056
8 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
checking image for errors
No errors were found on the image.
*** done
#!/bin/bash
#
# Nolan II qcow2 corruption - wrong used cluster
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
_supported_fmt generic
_supported_proto generic
_supported_os Linux
size=6G
echo
echo "creating image"
_make_test_img $size
echo
echo "creating pattern"
$QEMU_IO \
-c "write 2048k 4k -P 165" \
-c "write 64k 4k" \
-c "write 9M 4k" \
-c "write 2044k 4k -P 165" \
-c "write 8M 4k -P 99" \
-c "read -P 165 2044k 8k" \
$TEST_IMG | _filter_qemu_io
echo
echo "checking image for errors"
_check_test_img
# success, all done
echo "*** done"
rm -f $seq.full
status=0
QA output created by 010
creating image
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=6442450944
creating pattern
wrote 4096/4096 bytes at offset 2097152
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 4096/4096 bytes at offset 65536
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 4096/4096 bytes at offset 9437184
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 4096/4096 bytes at offset 2093056
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 4096/4096 bytes at offset 8388608
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 8192/8192 bytes at offset 2093056
8 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
checking image for errors
No errors were found on the image.
*** done
#!/bin/bash
#
# Test for AIO allocation on the same cluster
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
_supported_fmt generic
_supported_proto generic
_supported_os Linux
size=6G
echo
echo "creating image"
_make_test_img $size
echo
echo "overlapping I/O"
for i in `seq 1 10`; do
let mb=1024*1024
let off1=$i*$mb
let off2=$off1+512
# Note that we filter away the actual offset. That's because qemu
# may re-order the two aio requests. We only want to make sure the
# filesystem isn't corrupted afterwards anyway.
$QEMU_IO $TEST_IMG -c "aio_write $off1 1M" -c "aio_write $off2 1M" | \
_filter_qemu_io | \
sed -e 's/bytes at offset [0-9]*/bytes at offset XXX/g'
done
echo
echo "checking image for errors"
_check_test_img
# success, all done
echo "*** done"
rm -f $seq.full
status=0
QA output created by 011
creating image
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=6442450944
overlapping I/O
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset XXX
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
checking image for errors
No errors were found on the image.
*** done
#!/bin/bash
#
# Make sure we can open read-only images
#
# Regression fixed by commit 11a1feb6552e3a4709e454faea5e3be5ca8d9e6a.
#
# 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 <http://www.gnu.org/licenses/>.
#
# creator
owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
_supported_fmt generic
_supported_proto file
_supported_os Linux
size=128M
_make_test_img $size
echo
echo "== mark image read-only"
chmod a-w $TEST_IMG
echo
echo "== read from read-only image"
$QEMU_IO -r -c "read 0 512" $TEST_IMG | _filter_qemu_io
# success, all done
echo "*** done"
rm -f $seq.full
status=0
QA output created by 012
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
== mark image read-only
== read from read-only image
read 512/512 bytes at offset 0
512.000000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
*** done
#!/bin/bash
#
# qcow2 pattern test, empty and compressed image - 4k cluster patterns
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
. ./common.pattern
# much of this could be generic for any format supporting compression.
_supported_fmt qcow qcow2
_supported_proto generic
_supported_os Linux
TEST_OFFSETS="0 4294967296"
TEST_OPS="writev read write readv"
CLUSTER_SIZE=4096
_make_test_img 6G
echo "Testing empty image"
echo
for offset in $TEST_OFFSETS; do
echo "At offset $offset:"
for op in $TEST_OPS; do
io_test $op $offset $CLUSTER_SIZE 8
done
_check_test_img
done
echo "Compressing image"
echo
mv $TEST_IMG $TEST_IMG.orig
$QEMU_IMG convert -f $IMGFMT -O $IMGFMT -c $TEST_IMG.orig $TEST_IMG
echo "Testing compressed image"
echo
for offset in $TEST_OFFSETS; do
echo "With offset $offset:"
for op in read readv; do
io_test $op $offset $CLUSTER_SIZE 8
done
_check_test_img
done
echo "Testing compressed image with odd offsets"
echo
for offset in $TEST_OFFSETS; do
# Some odd offset (1 sector), so tests will write to areas occupied partly
# by old (compressed) data and empty clusters
offset=$((offset + 512))
echo "With offset $offset:"
for op in $TEST_OPS; do
io_test $op $offset $CLUSTER_SIZE 8
done
_check_test_img
done
# success, all done
echo "*** done"
rm -f $seq.full
status=0
此差异已折叠。
#!/bin/bash
#
# qcow2 pattern test, complex patterns including compression and snapshots
# Using patterns for 4k cluster size.
#
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
. ./common.pattern
# much of this could be generic for any format supporting snapshots
_supported_fmt qcow2
_supported_proto generic
_supported_os Linux
TEST_OFFSETS="0 4294967296"
TEST_OPS="writev read write readv"
CLUSTER_SIZE=4096
_make_test_img 6G
echo "Testing empty image:"
for offset in $TEST_OFFSETS; do
echo test2: With offset $offset
io_test2 $offset $CLUSTER_SIZE 256
_check_test_img
done
# With snapshots
for i in `seq 1 3`; do
$QEMU_IMG snapshot -c test$i $TEST_IMG
for offset in $TEST_OFFSETS; do
echo With snapshot test$i, offset $offset
for op in $TEST_OPS; do
io_test $op $offset $CLUSTER_SIZE 8
done
_check_test_img
done
done
# success, all done
echo "*** done"
rm -f $seq.full
status=0
此差异已折叠。
#!/bin/bash
#
# Combined test to grow the refcount table and test snapshots.
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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
true
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
# actually any format that supports snapshots
_supported_fmt qcow2
_supported_proto generic
_supported_os Linux
echo
echo "creating image"
# With 1k clusters a refcount block contains 512 clusters
# This makes 512k of the image file covered by a refcount block
# A refcount table that spans one clusters has 128 refcount
# tables which makes up 64M in the image file.
#
# We use a 36M image, so initially we can be sure that only one cluster is used
# for the refcount table. On the other hand this is big enough to cause a
# refcount table growth when rewriting the image after creating one snapshot.
size=36M
CLUSTER_SIZE=1k
_make_test_img $size
# Create two snapshots which fill the image with two different patterns
echo "creating first snapshot"
$QEMU_IO -c "aio_write -P 123 0 $size" $TEST_IMG | _filter_qemu_io
$QEMU_IMG snapshot -c snap1 $TEST_IMG
echo "creating second snapshot"
$QEMU_IO -c "aio_write -P 165 0 $size" $TEST_IMG | _filter_qemu_io
$QEMU_IMG snapshot -c snap2 $TEST_IMG
# Now check the pattern
echo "checking first snapshot"
$QEMU_IMG snapshot -a snap1 $TEST_IMG
$QEMU_IO -c "aio_read -P 123 0 $size" $TEST_IMG | _filter_qemu_io
echo "checking second snapshot"
$QEMU_IMG snapshot -a snap2 $TEST_IMG
$QEMU_IO -c "aio_read -P 165 0 $size" $TEST_IMG | _filter_qemu_io
echo
echo "checking image for errors"
_check_test_img
# success, all done
echo "*** done"
rm -f $seq.full
status=0
QA output created by 015
creating image
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=37748736 cluster_size=1024
creating first snapshot
wrote 37748736/37748736 bytes at offset 0
36 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
creating second snapshot
wrote 37748736/37748736 bytes at offset 0
36 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
checking first snapshot
read 37748736/37748736 bytes at offset 0
36 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
checking second snapshot
read 37748736/37748736 bytes at offset 0
36 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
checking image for errors
No errors were found on the image.
*** done
#!/bin/bash
#
# Test I/O after EOF for growable 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 <http://www.gnu.org/licenses/>.
#
# creator
owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
_supported_fmt raw
_supported_proto file sheepdog
_supported_os Linux
size=128M
_make_test_img $size
echo
echo "== reading at EOF =="
$QEMU_IO -g -c "read -P 0 $size 512" $TEST_IMG | _filter_qemu_io
echo
echo "== reading far past EOF =="
$QEMU_IO -g -c "read -P 0 256M 512" $TEST_IMG | _filter_qemu_io
echo
echo "== writing at EOF =="
$QEMU_IO -g -c "write -P 66 $size 512" $TEST_IMG | _filter_qemu_io
$QEMU_IO -c "read -P 66 $size 512" $TEST_IMG | _filter_qemu_io
echo
echo "== writing far past EOF =="
$QEMU_IO -g -c "write -P 66 256M 512" $TEST_IMG | _filter_qemu_io
$QEMU_IO -c "read -P 66 256M 512" $TEST_IMG | _filter_qemu_io
# success, all done
echo "*** done"
rm -f $seq.full
status=0
QA output created by 016
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
== reading at EOF ==
read 512/512 bytes at offset 134217728
512.000000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== reading far past EOF ==
read 512/512 bytes at offset 268435456
512.000000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== writing at EOF ==
wrote 512/512 bytes at offset 134217728
512.000000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 512/512 bytes at offset 134217728
512.000000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== writing far past EOF ==
wrote 512/512 bytes at offset 268435456
512.000000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 512/512 bytes at offset 268435456
512.000000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
*** done
#!/bin/bash
#
# Simple backing file reads
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
. ./common.pattern
# Any format supporting backing files
_supported_fmt qcow qcow2 vmdk qed
_supported_proto generic
_supported_os Linux
TEST_OFFSETS="0 4294967296"
_make_test_img 6G
echo "Filling base image"
echo
for offset in $TEST_OFFSETS; do
# Some clusters with alternating backing file/image file reads
io writev $(( offset )) 512 1024 64
# Complete backing clusters
io writev $(( offset + 64 * 1024)) 65536 65536 1
done
_check_test_img
echo "Creating test image with backing file"
echo
mv $TEST_IMG $TEST_IMG.base
_make_test_img -b $TEST_IMG.base 6G
echo "Filling test image"
echo
for offset in $TEST_OFFSETS; do
# Some clusters with alternating backing file/image file reads
io writev $(( offset + 512 )) 512 1024 64
# Complete test image clusters
io writev $(( offset + 64 * 1024 + 65536)) 65536 65536 1
done
_check_test_img
echo "Reading"
echo
for offset in $TEST_OFFSETS; do
# Some clusters with alternating backing file/image file reads
io readv $(( offset )) 512 1024 64
io readv $(( offset + 512 )) 512 1024 64
# Complete test image clusters
io readv $(( offset + 64 * 1024)) 65536 65536 1
io readv $(( offset + 64 * 1024 + 65536)) 65536 65536 1
# Empty sectors
io_zero readv $(( offset + 64 * 1024 + 65536 * 4 )) 65536 65536 1
done
_check_test_img
# success, all done
echo "*** done"
rm -f $seq.full
status=0
此差异已折叠。
#!/bin/bash
#
# Merge backing file into test image when converting the image
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
. ./common.pattern
# Any format supporting backing files
_supported_fmt qcow qcow2 vmdk qed
_supported_proto generic
_supported_os Linux
TEST_OFFSETS="0 4294967296"
_make_test_img 6G
echo "Filling base image"
echo
for offset in $TEST_OFFSETS; do
# Some clusters with alternating backing file/image file reads
io writev $(( offset )) 512 1024 64
# Complete backing clusters
io writev $(( offset + 64 * 1024)) 65536 65536 1
done
_check_test_img
echo "Creating test image with backing file"
echo
mv $TEST_IMG $TEST_IMG.base
_make_test_img -b $TEST_IMG.base 6G
echo "Filling test image"
echo
for offset in $TEST_OFFSETS; do
# Some clusters with alternating backing file/image file reads
io writev $(( offset + 512 )) 512 1024 64
# Complete test image clusters
io writev $(( offset + 64 * 1024 + 65536)) 65536 65536 1
done
_check_test_img
mv $TEST_IMG $TEST_IMG.orig
$QEMU_IMG convert -O $IMGFMT $TEST_IMG.orig $TEST_IMG
echo "Reading"
echo
for offset in $TEST_OFFSETS; do
# Some clusters with alternating backing file/image file reads
io readv $(( offset )) 512 1024 64
io readv $(( offset + 512 )) 512 1024 64
# Complete test image clusters
io readv $(( offset + 64 * 1024)) 65536 65536 1
io readv $(( offset + 64 * 1024 + 65536)) 65536 65536 1
# Empty sectors
io_zero readv $(( offset + 64 * 1024 + 65536 * 4 )) 65536 65536 1
done
_check_test_img
# success, all done
echo "*** done"
rm -f $seq.full
status=0
此差异已折叠。
#!/bin/bash
#
# When using a backing file for the output image in qemu-img convert,
# the backing file clusters must not copied. The data must still be
# read correctly.
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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_IMG.base
rm -f $TEST_IMG.orig
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
. ./common.pattern
# Any format supporting backing files
_supported_fmt qcow qcow2 vmdk qed
_supported_proto generic
_supported_os Linux
TEST_OFFSETS="0 4294967296"
CLUSTER_SIZE=65536
_make_test_img 6G
echo "Filling base image"
echo
for offset in $TEST_OFFSETS; do
# Some clusters with alternating backing file/image file reads
io_pattern writev $(( offset )) 512 1024 64 42
# Complete backing clusters
io_pattern writev $(( offset + 1024 * 1024)) $CLUSTER_SIZE $CLUSTER_SIZE 1 42
done
_check_test_img
echo "Creating test image with backing file"
echo
mv $TEST_IMG $TEST_IMG.base
_make_test_img -b $TEST_IMG.base 6G
echo "Filling test image"
echo
for offset in $TEST_OFFSETS; do
# Some clusters with alternating backing file/image file reads
io_pattern writev $(( offset + 512 )) 512 1024 64 43
# Complete test image clusters
io_pattern writev $(( offset + 1024 * 1024 + $CLUSTER_SIZE)) $CLUSTER_SIZE $CLUSTER_SIZE 1 43
done
_check_test_img
mv $TEST_IMG $TEST_IMG.orig
# Test the conversion twice: One test with the old-style -B option and another
# one with -o backing_file
for backing_option in "-B $TEST_IMG.base" "-o backing_file=$TEST_IMG.base"; do
echo
echo Testing conversion with $backing_option | _filter_testdir | _filter_imgfmt
echo
$QEMU_IMG convert -O $IMGFMT $backing_option $TEST_IMG.orig $TEST_IMG
echo "Checking if backing clusters are allocated when they shouldn't"
echo
for offset in $TEST_OFFSETS; do
# Complete backing clusters
is_allocated $(( offset + 1024 * 1024)) $CLUSTER_SIZE $CLUSTER_SIZE 1
done
echo "Reading"
echo
for offset in $TEST_OFFSETS; do
# Some clusters with alternating backing file/image file reads
io_pattern readv $(( offset )) 512 1024 64 42
io_pattern readv $(( offset + 512 )) 512 1024 64 43
# Complete test image clusters
io_pattern readv $(( offset + 1024 * 1024)) $CLUSTER_SIZE $CLUSTER_SIZE 1 42
io_pattern readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE)) $CLUSTER_SIZE $CLUSTER_SIZE 1 43
# Empty sectors
io_zero readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE * 4 )) $CLUSTER_SIZE $CLUSTER_SIZE 1
done
_check_test_img
done
# success, all done
echo "*** done"
rm -f $seq.full
status=0
此差异已折叠。
#!/bin/bash
#
# Commit changes to backing file
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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_IMG.base
rm -f $TEST_IMG.orig
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
. ./common.pattern
# Any format supporting backing files
_supported_fmt qcow qcow2 vmdk qed
_supported_proto generic
_supported_os Linux
TEST_OFFSETS="0 4294967296"
_make_test_img 6G
echo "Filling base image"
echo
for offset in $TEST_OFFSETS; do
# Some clusters with alternating backing file/image file reads
io writev $(( offset )) 512 1024 64
# Complete backing clusters
io writev $(( offset + 64 * 1024)) 65536 65536 1
done
_check_test_img
echo "Creating test image with backing file"
echo
mv $TEST_IMG $TEST_IMG.base
_make_test_img -b $TEST_IMG.base 6G
echo "Filling test image"
echo
for offset in $TEST_OFFSETS; do
# Some clusters with alternating backing file/image file reads
io writev $(( offset + 512 )) 512 1024 64
# Complete test image clusters
io writev $(( offset + 64 * 1024 + 65536)) 65536 65536 1
done
_check_test_img
$QEMU_IMG commit $TEST_IMG
mv $TEST_IMG.base $TEST_IMG
echo "Reading from the backing file"
echo
for offset in $TEST_OFFSETS; do
# Some clusters with alternating backing file/image file reads
io readv $(( offset )) 512 1024 64
io readv $(( offset + 512 )) 512 1024 64
# Complete test image clusters
io readv $(( offset + 64 * 1024)) 65536 65536 1
io readv $(( offset + 64 * 1024 + 65536)) 65536 65536 1
# Empty sectors
io_zero readv $(( offset + 64 * 1024 + 65536 * 4 )) 65536 65536 1
done
_check_test_img
# success, all done
echo "*** done"
rm -f $seq.full
status=0
此差异已折叠。
#!/bin/bash
#
# Test handling of invalid patterns arguments to qemu-io
#
# 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 <http://www.gnu.org/licenses/>.
#
# creator
owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
_supported_fmt generic
_supported_proto generic
_supported_os Linux
size=128M
_make_test_img $size
INVALID_PATTERNS="-1 300 12m 4k route66"
TEST_OPS="writev read write readv aio_read aio_write"
for pattern in $INVALID_PATTERNS; do
for op in $TEST_OPS; do
echo
echo "== testing $op -P $pattern =="
$QEMU_IO -c "$op -P $pattern 0 4096" $TEST_IMG | _filter_qemu_io
done
done
# success, all done
echo "*** done"
rm -f $seq.full
status=0
QA output created by 021
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
== testing writev -P -1 ==
-1 is not a valid pattern byte
== testing read -P -1 ==
-1 is not a valid pattern byte
== testing write -P -1 ==
-1 is not a valid pattern byte
== testing readv -P -1 ==
-1 is not a valid pattern byte
== testing aio_read -P -1 ==
-1 is not a valid pattern byte
== testing aio_write -P -1 ==
-1 is not a valid pattern byte
== testing writev -P 300 ==
300 is not a valid pattern byte
== testing read -P 300 ==
300 is not a valid pattern byte
== testing write -P 300 ==
300 is not a valid pattern byte
== testing readv -P 300 ==
300 is not a valid pattern byte
== testing aio_read -P 300 ==
300 is not a valid pattern byte
== testing aio_write -P 300 ==
300 is not a valid pattern byte
== testing writev -P 12m ==
12m is not a valid pattern byte
== testing read -P 12m ==
12m is not a valid pattern byte
== testing write -P 12m ==
12m is not a valid pattern byte
== testing readv -P 12m ==
12m is not a valid pattern byte
== testing aio_read -P 12m ==
12m is not a valid pattern byte
== testing aio_write -P 12m ==
12m is not a valid pattern byte
== testing writev -P 4k ==
4k is not a valid pattern byte
== testing read -P 4k ==
4k is not a valid pattern byte
== testing write -P 4k ==
4k is not a valid pattern byte
== testing readv -P 4k ==
4k is not a valid pattern byte
== testing aio_read -P 4k ==
4k is not a valid pattern byte
== testing aio_write -P 4k ==
4k is not a valid pattern byte
== testing writev -P route66 ==
route66 is not a valid pattern byte
== testing read -P route66 ==
route66 is not a valid pattern byte
== testing write -P route66 ==
route66 is not a valid pattern byte
== testing readv -P route66 ==
route66 is not a valid pattern byte
== testing aio_read -P route66 ==
route66 is not a valid pattern byte
== testing aio_write -P route66 ==
route66 is not a valid pattern byte
*** done
#!/bin/bash
#
# Test bdrv_load/save_vmstate using the usual patterns
#
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
#
# 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
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
. ./common.pattern
# Any format that supports snapshots
_supported_fmt qcow2
_supported_proto generic
_supported_os Linux
TEST_OFFSETS="10485760 4294967296"
CLUSTER_SIZE="4096"
_make_test_img 6G
echo "Testing empty image"
echo
for offset in $TEST_OFFSETS; do
echo "At offset $offset:"
io_test "write -b" $offset $CLUSTER_SIZE 8
io_test "read -b" $offset $CLUSTER_SIZE 8
_check_test_img
done
# success, all done
echo "*** done"
rm -f $seq.full
status=0
此差异已折叠。
#!/bin/bash
#
# qcow2 pattern test with various cluster sizes
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
. ./common.pattern
# much of this could be generic for any format supporting compression.
_supported_fmt qcow qcow2
_supported_proto generic
_supported_os Linux
TEST_OFFSETS="0 4294967296"
TEST_OPS="writev read write readv"
# Can't use 512 byte clusters, the tests use cluster halves
CLUSTER_SIZES="1024 4096 16384 65536"
for CLUSTER_SIZE in $CLUSTER_SIZES; do
echo "Creating new image; cluster size: $CLUSTER_SIZE"
echo
_make_test_img 8G
echo "Testing empty image"
echo
for offset in $TEST_OFFSETS; do
echo "At offset $offset:"
for op in $TEST_OPS; do
io_test $op $offset $CLUSTER_SIZE 3
done
_check_test_img
done
echo "Compressing image"
echo
mv $TEST_IMG $TEST_IMG.orig
$QEMU_IMG convert -f $IMGFMT -O $IMGFMT -c $TEST_IMG.orig $TEST_IMG
echo "Testing compressed image"
echo
for offset in $TEST_OFFSETS; do
echo "With offset $offset:"
for op in read readv; do
io_test $op $offset $CLUSTER_SIZE 3
done
_check_test_img
done
echo "Testing compressed image with odd offsets"
echo
for offset in $TEST_OFFSETS; do
# Some odd offset (1 sector), so tests will write to areas occupied partly
# by old (compressed) data and empty clusters
offset=$((offset + 512))
echo "With offset $offset:"
for op in $TEST_OPS; do
io_test $op $offset $CLUSTER_SIZE 3
done
_check_test_img
done
echo "Creating another new image"
echo
_make_test_img 8G
echo "More complex patterns"
echo
for offset in $TEST_OFFSETS; do
echo test2: With offset $offset
io_test2 $offset $CLUSTER_SIZE 4
_check_test_img
done
done
# success, all done
echo "*** done"
rm -f $seq.full
status=0
此差异已折叠。
#!/bin/bash
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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 and qed support rebasing
_supported_fmt qcow2 qed
_supported_proto generic
_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 -- -- -- --
#
# The pattern is written twice to have both an alloc -> non-alloc and a
# non-alloc -> alloc transition in the COW image.
echo "Creating backing file"
echo
_make_test_img 1G
io_pattern writev 0 $CLUSTER_SIZE $((2 * CLUSTER_SIZE)) 8 0x11
mv $TEST_IMG $TEST_IMG.base_old
echo "Creating new backing file"
echo
_make_test_img 1G
io_pattern writev 0 $((2 * CLUSTER_SIZE)) $((4 * CLUSTER_SIZE)) 4 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
io_pattern writev $((8 * CLUSTER_SIZE)) $((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
io_pattern readv $((8 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
io_pattern readv $((9 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
io_pattern readv $((10 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
io_pattern readv $((11 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
io_pattern readv $((12 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
io_pattern readv $((13 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
io_pattern readv $((14 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
io_pattern readv $((15 * 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
io_pattern readv $((8 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
io_pattern readv $((9 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
io_pattern readv $((10 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
io_pattern readv $((11 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
io_pattern readv $((12 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
io_pattern readv $((13 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
io_pattern readv $((14 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
io_pattern readv $((15 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
# success, all done
echo "*** done"
rm -f $seq.full
status=0
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> wrote 65536/65536 bytes at offset 524288
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
qemu-io> wrote 65536/65536 bytes at offset 655360
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
qemu-io> wrote 65536/65536 bytes at offset 786432
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
qemu-io> wrote 65536/65536 bytes at offset 917504
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> wrote 131072/131072 bytes at offset 524288
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
qemu-io> wrote 131072/131072 bytes at offset 786432
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> === IO: pattern 0x33
qemu-io> wrote 262144/262144 bytes at offset 524288
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> === IO: pattern 0x33
qemu-io> read 65536/65536 bytes at offset 524288
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 589824
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 655360
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 720896
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 786432
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 851968
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 917504
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 983040
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> === IO: pattern 0x33
qemu-io> read 65536/65536 bytes at offset 524288
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 589824
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 655360
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 720896
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 786432
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 851968
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 917504
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 983040
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
qemu-io> *** done
#!/bin/bash
#
# Resizing images
#
# Copyright (C) 2010 IBM, Corp.
#
# 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 <http://www.gnu.org/licenses/>.
#
# creator
owner=stefanha@linux.vnet.ibm.com
seq=`basename $0`
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
. ./common.pattern
_supported_fmt raw qcow2 qed
_supported_proto file sheepdog rbd
_supported_os Linux
echo "=== Creating image"
echo
small_size=$((128 * 1024 * 1024))
big_size=$((384 * 1024 * 1024))
_make_test_img $small_size
echo
echo "=== Writing whole image"
io_pattern write 0 $small_size 0 1 0xc5
_check_test_img
echo
echo "=== Resizing image"
$QEMU_IO $TEST_IMG <<EOF
length
truncate $big_size
length
EOF
_check_test_img
echo
echo "=== Verifying image size after reopen"
$QEMU_IO -c "length" $TEST_IMG
echo
echo "=== Verifying resized image"
io_pattern read 0 $small_size 0 1 0xc5
io_pattern read $small_size $(($big_size - $small_size)) 0 1 0
# success, all done
echo "*** done"
rm -f $seq.full
status=0
QA output created by 025
=== Creating image
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
=== Writing whole image
=== IO: pattern 0xc5
qemu-io> wrote 134217728/134217728 bytes at offset 0
128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
qemu-io> No errors were found on the image.
=== Resizing image
qemu-io> 128 MiB
qemu-io> qemu-io> 384 MiB
qemu-io> No errors were found on the image.
=== Verifying image size after reopen
384 MiB
=== Verifying resized image
=== IO: pattern 0xc5
qemu-io> read 134217728/134217728 bytes at offset 0
128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
qemu-io> === IO: pattern 0
qemu-io> read 268435456/268435456 bytes at offset 134217728
256 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
qemu-io> *** done
#!/bin/bash
#
# qcow2 error path testing
#
# Copyright (C) 2010 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 <http://www.gnu.org/licenses/>.
#
# 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 $TEST_DIR/blkdebug.conf
}
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_proto generic
_supported_os Linux
echo "Errors while writing 128 kB"
echo
CLUSTER_SIZE=1024
BLKDBG_TEST_IMG="blkdebug:$TEST_DIR/blkdebug.conf:$TEST_IMG"
for event in \
l1_update \
\
l2_load \
l2_update \
l2_alloc.write \
\
write_aio \
\
refblock_load \
refblock_update_part \
refblock_alloc \
\
cluster_alloc \
do
for errno in 5 28; do
for imm in off; do
for once in on off; do
for vmstate in "" "-b"; do
cat > $TEST_DIR/blkdebug.conf <<EOF
[inject-error]
event = "$event"
errno = "$errno"
immediately = "$imm"
once ="$once"
EOF
_make_test_img 1G
echo
echo "Event: $event; errno: $errno; imm: $imm; once: $once; write $vmstate"
$QEMU_IO -c "write $vmstate 0 128k " $BLKDBG_TEST_IMG | _filter_qemu_io
# l2_load is not called on allocation, so issue a second write
# Reads are another path to trigger l2_load, so do a read, too
if [ "$event" == "l2_load" ]; then
$QEMU_IO -c "write $vmstate 0 128k " $BLKDBG_TEST_IMG | _filter_qemu_io
$QEMU_IO -c "read $vmstate 0 128k " $BLKDBG_TEST_IMG | _filter_qemu_io
fi
$QEMU_IMG check $TEST_IMG 2>&1 | grep -v "refcount=1 reference=0"
done
done
done
done
done
echo
echo === Refcout table growth tests ===
echo
CLUSTER_SIZE=512
for event in \
refblock_alloc.hookup \
refblock_alloc.write \
refblock_alloc.write_blocks \
refblock_alloc.write_table \
refblock_alloc.switch_table \
do
# This one takes a while, so let's test only one error code (ENOSPC should
# never be generated by qemu, so it's probably a good choice)
for errno in 28; do
for imm in off; do
for once in on off; do
for vmstate in "" "-b"; do
cat > $TEST_DIR/blkdebug.conf <<EOF
[inject-error]
event = "$event"
errno = "$errno"
immediately = "$imm"
once = "$once"
EOF
_make_test_img 1G
echo
echo "Event: $event; errno: $errno; imm: $imm; once: $once; write $vmstate"
$QEMU_IO -c "write $vmstate 0 64M" $BLKDBG_TEST_IMG | _filter_qemu_io
$QEMU_IMG check $TEST_IMG 2>&1 | grep -v "refcount=1 reference=0"
done
done
done
done
done
echo
echo === L1 growth tests ===
echo
CLUSTER_SIZE=1024
for event in \
l1_grow.alloc_table \
l1_grow.write_table \
l1_grow.activate_table \
do
for errno in 5 28; do
for imm in off; do
for once in on off; do
cat > $TEST_DIR/blkdebug.conf <<EOF
[inject-error]
event = "$event"
errno = "$errno"
immediately = "$imm"
once = "$once"
EOF
_make_test_img 1G
echo
echo "Event: $event; errno: $errno; imm: $imm; once: $once"
$QEMU_IO -c "write -b 0 64k" $BLKDBG_TEST_IMG | _filter_qemu_io
$QEMU_IMG check $TEST_IMG 2>&1 | grep -v "refcount=1 reference=0"
done
done
done
done
# success, all done
echo "*** done"
rm -f $seq.full
status=0
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册