mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
Block layer patches
-----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJZylugAAoJEH8JsnLIjy/Wp1QP/jtwre8WwtlX3SZ82cyiwonc fODcokF6iEsX7vs9vMr8lkbwF4mjxaU2Xf/knC98J/6rCxM8DRP/MW4BZttTxDI9 ++U926cIHHzjtSDalcjfTKnJD7PikHbLXz3SJ+u9hPnIeGs56hybCU6iHrrIcOTs YSMtD3eUQ8B8JaoegKgNyqkhvfhEdHlWFCq9/T2YEWwYMzGt1jvSTRqe3vr8vIu3 v7QKvh35gm965yaUTGpv7Ej7TOBTWOaYBo9D1TBKNEZOFTBjqyldciyBoDhCF2P9 +4EsNTkZ7u20Rko41dzsZPzhjG10gm/lNZNj3Cul9ta4kQ0hGeOjEujd9L9ANTGl gwnPPHKwgax5O+ctCPmrU7yHG+XIQD3gckC69qQeRXnPYQ4Jeo/LqhwjU+FcZfHs 97Lz6CHQHgtBP9JJwBMtUp77HJ58KPnnWIxGkb9u2vm4CpvRFkMrx5ekmj//9klX 5niRiqkNdrkEUnu/FIXOXxSmwnlhedAGQNq7ALSoW95El1QCy8Mm0eKEvmHyvZzd z2gSufLX6ynOaG4x5oY5eezKm6F4Hxwt+w8Svj9PHXIrmrEIop11LG5MVsDGDjyh XKiLddEIVKTYGwffX0CGTLYA34m2uHPkVVrMOIEvni3G6byXkb10+4pBpuTu/O/h wQPFraquH1I2B5YETsMa =7Bt2 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging Block layer patches # gpg: Signature made Tue 26 Sep 2017 14:52:32 BST # gpg: using RSA key 0x7F09B272C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * remotes/kevin/tags/for-upstream: (24 commits) block/qcow2-bitmap: fix use of uninitialized pointer qemu-iotests: add shrinking image test qcow2: add shrink image support qcow2: add qcow2_cache_discard qemu-img: add --shrink flag for resize iotests: fix 181: enable postcopy-ram capability on target qemu-iotests: Test change-backing-file command block: Fix permissions after bdrv_reopen() block: reopen: Queue children after their parents block: Base permissions on rw state after reopen block: Add reopen queue to bdrv_check_perm() block: Add reopen_queue to bdrv_child_perm() qemu-io: Drop write permissions before read-only reopen block: Clean up some bad code in the vvfat driver block/throttle-groups.c: allocate RestartData on the heap throttle: Assert that bkt->max is valid in throttle_compute_wait() iotests: Print full path of bad output if mismatch iotests: use virtio aliases for 067 iotests: use -ccw on s390x for 051 iotests: use -ccw on s390x for 040, 139, and 182 ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
cfe4cade05
45 changed files with 1710 additions and 897 deletions
|
@ -82,7 +82,11 @@ class TestSingleDrive(ImageCommitTestCase):
|
|||
qemu_io('-f', 'raw', '-c', 'write -P 0xab 0 524288', backing_img)
|
||||
qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0xef 524288 524288', mid_img)
|
||||
self.vm = iotests.VM().add_drive(test_img, "node-name=top,backing.node-name=mid,backing.backing.node-name=base", interface="none")
|
||||
self.vm.add_device("virtio-scsi-pci")
|
||||
if iotests.qemu_default_machine == 's390-ccw-virtio':
|
||||
self.vm.add_device("virtio-scsi-ccw")
|
||||
else:
|
||||
self.vm.add_device("virtio-scsi-pci")
|
||||
|
||||
self.vm.add_device("scsi-hd,id=scsi0,drive=drive0")
|
||||
self.vm.launch()
|
||||
|
||||
|
|
|
@ -103,7 +103,17 @@ echo
|
|||
echo === Device without drive ===
|
||||
echo
|
||||
|
||||
run_qemu -device virtio-scsi-pci -device scsi-hd
|
||||
case "$QEMU_DEFAULT_MACHINE" in
|
||||
s390-ccw-virtio)
|
||||
virtio_scsi=virtio-scsi-ccw
|
||||
;;
|
||||
*)
|
||||
virtio_scsi=virtio-scsi-pci
|
||||
;;
|
||||
esac
|
||||
|
||||
run_qemu -device $virtio_scsi -device scsi-hd |
|
||||
sed -e "s/$virtio_scsi/VIRTIO_SCSI/"
|
||||
|
||||
echo
|
||||
echo === Overriding backing file ===
|
||||
|
|
|
@ -49,7 +49,7 @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,driver=qcow2,format=qcow2: Cannot specif
|
|||
|
||||
=== Device without drive ===
|
||||
|
||||
Testing: -device virtio-scsi-pci -device scsi-hd
|
||||
Testing: -device VIRTIO_SCSI -device scsi-hd
|
||||
QEMU X.Y.Z monitor - type 'help' for more information
|
||||
(qemu) QEMU_PROG: -device scsi-hd: drive property not set
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,driver=qcow2,format=qcow2: Cannot specif
|
|||
|
||||
=== Device without drive ===
|
||||
|
||||
Testing: -device virtio-scsi-pci -device scsi-hd
|
||||
Testing: -device VIRTIO_SCSI -device scsi-hd
|
||||
QEMU X.Y.Z monitor - type 'help' for more information
|
||||
(qemu) QEMU_PROG: -device scsi-hd: drive property not set
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ echo
|
|||
echo === Empty drive with -device and device_del ===
|
||||
echo
|
||||
|
||||
run_qemu -device virtio-scsi-pci -device scsi-cd,id=cd0 <<EOF
|
||||
run_qemu -device virtio-scsi -device scsi-cd,id=cd0 <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "query-block" }
|
||||
{ "execute": "device_del", "arguments": { "id": "cd0" } }
|
||||
|
|
|
@ -419,7 +419,7 @@ Testing:
|
|||
|
||||
=== Empty drive with -device and device_del ===
|
||||
|
||||
Testing: -device virtio-scsi-pci -device scsi-cd,id=cd0
|
||||
Testing: -device virtio-scsi -device scsi-cd,id=cd0
|
||||
{
|
||||
QMP_VERSION
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ _make_test_img $IMG_SIZE
|
|||
$QEMU_IO -c 'write 0 64k' "$TEST_IMG" | _filter_qemu_io
|
||||
# Remove data cluster from image (first cluster: image header, second: reftable,
|
||||
# third: refblock, fourth: L1 table, fifth: L2 table)
|
||||
$QEMU_IMG resize -f raw "$TEST_IMG" $((5 * 64 * 1024))
|
||||
$QEMU_IMG resize -f raw --shrink "$TEST_IMG" $((5 * 64 * 1024))
|
||||
|
||||
$QEMU_IO -c map "$TEST_IMG"
|
||||
$QEMU_IMG map "$TEST_IMG"
|
||||
|
@ -69,7 +69,7 @@ $QEMU_IO -c 'write 0 64k' "$TEST_IMG" | _filter_qemu_io
|
|||
|
||||
qemu_comm_method=monitor _launch_qemu -drive if=none,file="$TEST_IMG",id=drv0
|
||||
|
||||
$QEMU_IMG resize -f raw "$TEST_IMG" $((5 * 64 * 1024))
|
||||
$QEMU_IMG resize -f raw --shrink "$TEST_IMG" $((5 * 64 * 1024))
|
||||
|
||||
_send_qemu_cmd $QEMU_HANDLE 'qemu-io drv0 map' 'allocated' \
|
||||
| sed -e 's/^(qemu).*qemu-io drv0 map...$/(qemu) qemu-io drv0 map/'
|
||||
|
|
|
@ -83,7 +83,7 @@ echo '=== Testing image shrinking ==='
|
|||
for growth_mode in falloc full off; do
|
||||
echo
|
||||
echo "--- growth_mode=$growth_mode ---"
|
||||
$QEMU_IMG resize -f "$IMGFMT" --preallocation=$growth_mode "$TEST_IMG" -${GROWTH_SIZE}K
|
||||
$QEMU_IMG resize -f "$IMGFMT" --shrink --preallocation=$growth_mode "$TEST_IMG" -${GROWTH_SIZE}K
|
||||
done
|
||||
|
||||
# success, all done
|
||||
|
|
|
@ -25,13 +25,21 @@ import time
|
|||
|
||||
base_img = os.path.join(iotests.test_dir, 'base.img')
|
||||
new_img = os.path.join(iotests.test_dir, 'new.img')
|
||||
if iotests.qemu_default_machine == 's390-ccw-virtio':
|
||||
default_virtio_blk = 'virtio-blk-ccw'
|
||||
else:
|
||||
default_virtio_blk = 'virtio-blk-pci'
|
||||
|
||||
class TestBlockdevDel(iotests.QMPTestCase):
|
||||
|
||||
def setUp(self):
|
||||
iotests.qemu_img('create', '-f', iotests.imgfmt, base_img, '1M')
|
||||
self.vm = iotests.VM()
|
||||
self.vm.add_device("virtio-scsi-pci,id=virtio-scsi")
|
||||
if iotests.qemu_default_machine == 's390-ccw-virtio':
|
||||
self.vm.add_device("virtio-scsi-ccw,id=virtio-scsi")
|
||||
else:
|
||||
self.vm.add_device("virtio-scsi-pci,id=virtio-scsi")
|
||||
|
||||
self.vm.launch()
|
||||
|
||||
def tearDown(self):
|
||||
|
@ -87,7 +95,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
|
|||
self.checkBlockDriverState(node, expect_error)
|
||||
|
||||
# Add a device model
|
||||
def addDeviceModel(self, device, backend, driver = 'virtio-blk-pci'):
|
||||
def addDeviceModel(self, device, backend, driver = default_virtio_blk):
|
||||
result = self.vm.qmp('device_add', id = device,
|
||||
driver = driver, drive = backend)
|
||||
self.assert_qmp(result, 'return', {})
|
||||
|
|
170
tests/qemu-iotests/163
Normal file
170
tests/qemu-iotests/163
Normal file
|
@ -0,0 +1,170 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Tests for shrinking images
|
||||
#
|
||||
# Copyright (c) 2016-2017 Parallels International GmbH
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
|
||||
import os, random, iotests, struct, qcow2
|
||||
from iotests import qemu_img, qemu_io, image_size
|
||||
|
||||
test_img = os.path.join(iotests.test_dir, 'test.img')
|
||||
check_img = os.path.join(iotests.test_dir, 'check.img')
|
||||
|
||||
def size_to_int(str):
|
||||
suff = ['B', 'K', 'M', 'G', 'T']
|
||||
return int(str[:-1]) * 1024**suff.index(str[-1:])
|
||||
|
||||
class ShrinkBaseClass(iotests.QMPTestCase):
|
||||
image_len = '128M'
|
||||
shrink_size = '10M'
|
||||
chunk_size = '16M'
|
||||
refcount_bits = '16'
|
||||
|
||||
def __qcow2_check(self, filename):
|
||||
entry_bits = 3
|
||||
entry_size = 1 << entry_bits
|
||||
l1_mask = 0x00fffffffffffe00
|
||||
div_roundup = lambda n, d: (n + d - 1) / d
|
||||
|
||||
def split_by_n(data, n):
|
||||
for x in xrange(0, len(data), n):
|
||||
yield struct.unpack('>Q', data[x:x + n])[0] & l1_mask
|
||||
|
||||
def check_l1_table(h, l1_data):
|
||||
l1_list = list(split_by_n(l1_data, entry_size))
|
||||
real_l1_size = div_roundup(h.size,
|
||||
1 << (h.cluster_bits*2 - entry_size))
|
||||
used, unused = l1_list[:real_l1_size], l1_list[real_l1_size:]
|
||||
|
||||
self.assertTrue(len(used) != 0, "Verifying l1 table content")
|
||||
self.assertFalse(any(unused), "Verifying l1 table content")
|
||||
|
||||
def check_reftable(fd, h, reftable):
|
||||
for offset in split_by_n(reftable, entry_size):
|
||||
if offset != 0:
|
||||
fd.seek(offset)
|
||||
cluster = fd.read(1 << h.cluster_bits)
|
||||
self.assertTrue(any(cluster), "Verifying reftable content")
|
||||
|
||||
with open(filename, "rb") as fd:
|
||||
h = qcow2.QcowHeader(fd)
|
||||
|
||||
fd.seek(h.l1_table_offset)
|
||||
l1_table = fd.read(h.l1_size << entry_bits)
|
||||
|
||||
fd.seek(h.refcount_table_offset)
|
||||
reftable = fd.read(h.refcount_table_clusters << h.cluster_bits)
|
||||
|
||||
check_l1_table(h, l1_table)
|
||||
check_reftable(fd, h, reftable)
|
||||
|
||||
def __raw_check(self, filename):
|
||||
pass
|
||||
|
||||
image_check = {
|
||||
'qcow2' : __qcow2_check,
|
||||
'raw' : __raw_check
|
||||
}
|
||||
|
||||
def setUp(self):
|
||||
if iotests.imgfmt == 'raw':
|
||||
qemu_img('create', '-f', iotests.imgfmt, test_img, self.image_len)
|
||||
qemu_img('create', '-f', iotests.imgfmt, check_img,
|
||||
self.shrink_size)
|
||||
else:
|
||||
qemu_img('create', '-f', iotests.imgfmt,
|
||||
'-o', 'cluster_size=' + self.cluster_size +
|
||||
',refcount_bits=' + self.refcount_bits,
|
||||
test_img, self.image_len)
|
||||
qemu_img('create', '-f', iotests.imgfmt,
|
||||
'-o', 'cluster_size=%s'% self.cluster_size,
|
||||
check_img, self.shrink_size)
|
||||
qemu_io('-c', 'write -P 0xff 0 ' + self.shrink_size, check_img)
|
||||
|
||||
def tearDown(self):
|
||||
os.remove(test_img)
|
||||
os.remove(check_img)
|
||||
|
||||
def image_verify(self):
|
||||
self.assertEqual(image_size(test_img), image_size(check_img),
|
||||
"Verifying image size")
|
||||
self.image_check[iotests.imgfmt](self, test_img)
|
||||
|
||||
if iotests.imgfmt == 'raw':
|
||||
return
|
||||
self.assertEqual(qemu_img('check', test_img), 0,
|
||||
"Verifying image corruption")
|
||||
|
||||
def test_empty_image(self):
|
||||
qemu_img('resize', '-f', iotests.imgfmt, '--shrink', test_img,
|
||||
self.shrink_size)
|
||||
|
||||
self.assertEqual(
|
||||
qemu_io('-c', 'read -P 0x00 %s'%self.shrink_size, test_img),
|
||||
qemu_io('-c', 'read -P 0x00 %s'%self.shrink_size, check_img),
|
||||
"Verifying image content")
|
||||
|
||||
self.image_verify()
|
||||
|
||||
def test_sequential_write(self):
|
||||
for offs in range(0, size_to_int(self.image_len),
|
||||
size_to_int(self.chunk_size)):
|
||||
qemu_io('-c', 'write -P 0xff %d %s' % (offs, self.chunk_size),
|
||||
test_img)
|
||||
|
||||
qemu_img('resize', '-f', iotests.imgfmt, '--shrink', test_img,
|
||||
self.shrink_size)
|
||||
|
||||
self.assertEqual(qemu_img("compare", test_img, check_img), 0,
|
||||
"Verifying image content")
|
||||
|
||||
self.image_verify()
|
||||
|
||||
def test_random_write(self):
|
||||
offs_list = range(0, size_to_int(self.image_len),
|
||||
size_to_int(self.chunk_size))
|
||||
random.shuffle(offs_list)
|
||||
for offs in offs_list:
|
||||
qemu_io('-c', 'write -P 0xff %d %s' % (offs, self.chunk_size),
|
||||
test_img)
|
||||
|
||||
qemu_img('resize', '-f', iotests.imgfmt, '--shrink', test_img,
|
||||
self.shrink_size)
|
||||
|
||||
self.assertEqual(qemu_img("compare", test_img, check_img), 0,
|
||||
"Verifying image content")
|
||||
|
||||
self.image_verify()
|
||||
|
||||
class TestShrink512(ShrinkBaseClass):
|
||||
image_len = '3M'
|
||||
shrink_size = '1M'
|
||||
chunk_size = '256K'
|
||||
cluster_size = '512'
|
||||
refcount_bits = '64'
|
||||
|
||||
class TestShrink64K(ShrinkBaseClass):
|
||||
cluster_size = '64K'
|
||||
|
||||
class TestShrink1M(ShrinkBaseClass):
|
||||
cluster_size = '1M'
|
||||
refcount_bits = '1'
|
||||
|
||||
ShrinkBaseClass = None
|
||||
|
||||
if __name__ == '__main__':
|
||||
iotests.main(supported_fmts=['raw', 'qcow2'])
|
5
tests/qemu-iotests/163.out
Normal file
5
tests/qemu-iotests/163.out
Normal file
|
@ -0,0 +1,5 @@
|
|||
.........
|
||||
----------------------------------------------------------------------
|
||||
Ran 9 tests
|
||||
|
||||
OK
|
|
@ -56,7 +56,7 @@ function do_run_qemu()
|
|||
done
|
||||
fi
|
||||
echo quit
|
||||
) | $QEMU -nographic -monitor stdio -serial none "$@"
|
||||
) | $QEMU -machine accel=qtest -nographic -monitor stdio -serial none "$@"
|
||||
echo
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,9 @@ echo
|
|||
|
||||
# Slow down migration so much that it definitely won't finish before we can
|
||||
# switch to postcopy
|
||||
# Enable postcopy-ram capability both on source and destination
|
||||
silent=yes
|
||||
_send_qemu_cmd $dest 'migrate_set_capability postcopy-ram on' "(qemu)"
|
||||
_send_qemu_cmd $src 'migrate_set_speed 4k' "(qemu)"
|
||||
_send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)"
|
||||
_send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)"
|
||||
|
|
|
@ -20,7 +20,6 @@ read 65536/65536 bytes at offset 0
|
|||
|
||||
=== Do some I/O on the destination ===
|
||||
|
||||
QEMU X.Y.Z monitor - type 'help' for more information
|
||||
(qemu) qemu-io disk "read -P 0x55 0 64k"
|
||||
read 65536/65536 bytes at offset 0
|
||||
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
|
|
@ -45,17 +45,26 @@ _supported_os Linux
|
|||
|
||||
size=32M
|
||||
|
||||
case "$QEMU_DEFAULT_MACHINE" in
|
||||
s390-ccw-virtio)
|
||||
virtioblk=virtio-blk-ccw
|
||||
;;
|
||||
*)
|
||||
virtioblk=virtio-blk-pci
|
||||
;;
|
||||
esac
|
||||
|
||||
_make_test_img $size
|
||||
|
||||
echo "Starting QEMU"
|
||||
_launch_qemu -drive file=$TEST_IMG,if=none,id=drive0,file.locking=on \
|
||||
-device virtio-blk-pci,drive=drive0
|
||||
-device $virtioblk,drive=drive0
|
||||
|
||||
echo
|
||||
echo "Starting a second QEMU using the same image should fail"
|
||||
echo 'quit' | $QEMU -monitor stdio \
|
||||
-drive file=$TEST_IMG,if=none,id=drive0,file.locking=on \
|
||||
-device virtio-blk-pci,drive=drive0 2>&1 | _filter_testdir 2>&1 |
|
||||
-device $virtioblk,drive=drive0 2>&1 | _filter_testdir 2>&1 |
|
||||
_filter_qemu |
|
||||
sed -e '/falling back to POSIX file/d' \
|
||||
-e '/locks can be lost unexpectedly/d'
|
||||
|
|
|
@ -56,15 +56,15 @@ function do_run_qemu()
|
|||
done
|
||||
fi
|
||||
echo quit
|
||||
) | $QEMU -S -nodefaults -display none -device virtio-scsi-pci -monitor stdio "$@" 2>&1
|
||||
) | $QEMU -S -display none -device virtio-scsi-pci -monitor stdio "$@" 2>&1
|
||||
echo
|
||||
}
|
||||
|
||||
function check_info_block()
|
||||
{
|
||||
echo "info block" |
|
||||
QEMU_OPTIONS="" do_run_qemu "$@" | _filter_win32 | _filter_hmp |
|
||||
_filter_qemu | _filter_generated_node_ids
|
||||
do_run_qemu "$@" | _filter_win32 | _filter_hmp | _filter_qemu |
|
||||
_filter_generated_node_ids
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ Start from read-write
|
|||
|
||||
wrote 65536/65536 bytes at offset 0
|
||||
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
write failed: Operation not permitted
|
||||
Block node is read-only
|
||||
wrote 65536/65536 bytes at offset 0
|
||||
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
*** done
|
||||
|
|
92
tests/qemu-iotests/195
Executable file
92
tests/qemu-iotests/195
Executable file
|
@ -0,0 +1,92 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Test change-backing-file command
|
||||
#
|
||||
# Copyright (C) 2017 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`
|
||||
status=1 # failure is the default!
|
||||
|
||||
_cleanup()
|
||||
{
|
||||
_cleanup_test_img
|
||||
rm -f "$TEST_IMG.mid"
|
||||
}
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
|
||||
_supported_fmt qcow2
|
||||
_supported_proto file
|
||||
_supported_os Linux
|
||||
|
||||
function do_run_qemu()
|
||||
{
|
||||
echo Testing: "$@" | _filter_imgfmt
|
||||
$QEMU -nographic -qmp-pretty stdio -serial none "$@"
|
||||
echo
|
||||
}
|
||||
|
||||
function run_qemu()
|
||||
{
|
||||
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp \
|
||||
| _filter_qemu_io | _filter_generated_node_ids
|
||||
}
|
||||
|
||||
size=64M
|
||||
TEST_IMG="$TEST_IMG.base" _make_test_img $size
|
||||
TEST_IMG="$TEST_IMG.mid" _make_test_img -b "$TEST_IMG.base"
|
||||
_make_test_img -b "$TEST_IMG.mid"
|
||||
|
||||
echo
|
||||
echo "Change backing file of mid (opened read-only)"
|
||||
echo
|
||||
|
||||
run_qemu -drive if=none,file="$TEST_IMG",backing.node-name=mid <<EOF
|
||||
{"execute":"qmp_capabilities"}
|
||||
{"execute":"change-backing-file", "arguments":{"device":"none0","image-node-name":"mid","backing-file":"/dev/null"}}
|
||||
{"execute":"quit"}
|
||||
EOF
|
||||
|
||||
TEST_IMG="$TEST_IMG.mid" _img_info
|
||||
|
||||
echo
|
||||
echo "Change backing file of top (opened writable)"
|
||||
echo
|
||||
|
||||
TEST_IMG="$TEST_IMG.mid" _make_test_img -b "$TEST_IMG.base"
|
||||
|
||||
run_qemu -drive if=none,file="$TEST_IMG",node-name=top <<EOF
|
||||
{"execute":"qmp_capabilities"}
|
||||
{"execute":"change-backing-file", "arguments":{"device":"none0","image-node-name":"top","backing-file":"/dev/null"}}
|
||||
{"execute":"quit"}
|
||||
EOF
|
||||
|
||||
_img_info
|
||||
|
||||
# success, all done
|
||||
echo "*** done"
|
||||
rm -f $seq.full
|
||||
status=0
|
78
tests/qemu-iotests/195.out
Normal file
78
tests/qemu-iotests/195.out
Normal file
|
@ -0,0 +1,78 @@
|
|||
QA output created by 195
|
||||
Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864
|
||||
Formatting 'TEST_DIR/t.IMGFMT.mid', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.base
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.mid
|
||||
|
||||
Change backing file of mid (opened read-only)
|
||||
|
||||
Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,backing.node-name=mid
|
||||
{
|
||||
QMP_VERSION
|
||||
}
|
||||
{
|
||||
"return": {
|
||||
}
|
||||
}
|
||||
{
|
||||
"return": {
|
||||
}
|
||||
}
|
||||
{
|
||||
"return": {
|
||||
}
|
||||
}
|
||||
{
|
||||
"timestamp": {
|
||||
"seconds": TIMESTAMP,
|
||||
"microseconds": TIMESTAMP
|
||||
},
|
||||
"event": "SHUTDOWN",
|
||||
"data": {
|
||||
"guest": false
|
||||
}
|
||||
}
|
||||
|
||||
image: TEST_DIR/t.IMGFMT.mid
|
||||
file format: IMGFMT
|
||||
virtual size: 64M (67108864 bytes)
|
||||
cluster_size: 65536
|
||||
backing file: /dev/null
|
||||
backing file format: IMGFMT
|
||||
|
||||
Change backing file of top (opened writable)
|
||||
|
||||
Formatting 'TEST_DIR/t.IMGFMT.mid', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.base
|
||||
Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,node-name=top
|
||||
{
|
||||
QMP_VERSION
|
||||
}
|
||||
{
|
||||
"return": {
|
||||
}
|
||||
}
|
||||
{
|
||||
"return": {
|
||||
}
|
||||
}
|
||||
{
|
||||
"return": {
|
||||
}
|
||||
}
|
||||
{
|
||||
"timestamp": {
|
||||
"seconds": TIMESTAMP,
|
||||
"microseconds": TIMESTAMP
|
||||
},
|
||||
"event": "SHUTDOWN",
|
||||
"data": {
|
||||
"guest": false
|
||||
}
|
||||
}
|
||||
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 64M (67108864 bytes)
|
||||
cluster_size: 65536
|
||||
backing file: /dev/null
|
||||
backing file format: IMGFMT
|
||||
*** done
|
|
@ -353,7 +353,7 @@ do
|
|||
else
|
||||
echo " - output mismatch (see $seq.out.bad)"
|
||||
mv $tmp.out $seq.out.bad
|
||||
$diff -w "$reference" $seq.out.bad
|
||||
$diff -w "$reference" $(realpath $seq.out.bad)
|
||||
err=true
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -166,6 +166,7 @@
|
|||
159 rw auto quick
|
||||
160 rw auto quick
|
||||
162 auto quick
|
||||
163 rw auto quick
|
||||
165 rw auto quick
|
||||
170 rw auto quick
|
||||
171 rw auto quick
|
||||
|
@ -189,3 +190,4 @@
|
|||
190 rw auto quick
|
||||
192 rw auto quick
|
||||
194 rw auto migration quick
|
||||
195 rw auto quick
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue