mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
Block layer patches
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJWIP1yAAoJEH8JsnLIjy/WvQwQAJ9L9GaOochbHZ9Y2VjsRO07 oqpd997p42GMGkcpTaEn1iyKgH4M+HN7iMu5FvISW/6HPVCgfRhLsrkOoBVTOhSv dM6PFFOxqI6fp/HsHbV1yt3M6hy01WP+kNuRmqPyjV3veEKtHgm7QzFqgA6LTXhT z6dLpl5qKxMd5gHzpJm91hql4I9nwVBDT4LKQpA3j0yO9WrZ6uGTHubFJ514raWC Kp1xxkuhIbyNdOs3lb7UAbAjCDX9am9+jorT7J1M1e97yZiYtuSbcElVnZDHI8hq 0e8t/oQ3WdLP35Tg6n6XG37fhb6pMsC03wxWqXygoQbovLFTOHmPW0dSQhlhRcBm RZfJ77//QIVtKhrIPRzQMAy+AJUjBvQhcNDMOs1wfKsqEHgAHlFupwRxUK5DMOd7 GYWnx3gYBGqdof1GXIzGhc024dsOmwlgluSQK4/Q7LGkF3DCeW960yItht41Lee0 vDWAyLaa+SDujsTNye5LFbYEfScIOZR0bUzyfOHBdSsMiHgPElUV2f+XubAVGynC SCe4fQMciohpFPqVnkj8wBHl/AwPKR44sOqqQOEIXZ9pCI5qqebyuP1y/4druRLW UdzZ1rpJTExNATNJO8AEjXw1vKAhKZTh0UlQXIhtnYFB7vMMXEeVo1dxBrKffiSV m8Mb2lRdEhxApsoUPUxm =/ct2 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging Block layer patches # gpg: Signature made Fri 16 Oct 2015 14:36:50 BST using RSA key ID C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: (29 commits) blkdebug: Don't confuse image as backing file qcow2: Remove forward declaration of QCowAIOCB qemu-nbd: always compile in --aio=MODE option blockdev: always compile in -drive aio= parsing raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable block: auto-generated node-names util - add automated ID generation utility blkverify: Fix BDS leak in .bdrv_open error path block: Allow bdrv_unref_child(bs, NULL) block: Remove bdrv_swap() block: Add and use bdrv_replace_in_backing_chain() blockjob: Store device name at job creation block: Implement bdrv_append() without bdrv_swap() block: Introduce parents list block-backend: Add blk_set_bs() block/io: Make bdrv_requests_pending() public block: Split bdrv_move_feature_fields() block: Manage backing file references in bdrv_set_backing_hd() block: Convert bs->backing_hd to BdrvChild block: Remove bdrv_open_image() ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
c737c7a608
56 changed files with 963 additions and 886 deletions
|
@ -780,7 +780,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
|
|||
# here we check that the last registered quorum file has not been
|
||||
# swapped out and unref
|
||||
result = self.vm.qmp('query-named-block-nodes')
|
||||
self.assert_qmp(result, 'return[0]/file', quorum_img3)
|
||||
self.assert_qmp(result, 'return[1]/file', quorum_img3)
|
||||
self.vm.shutdown()
|
||||
|
||||
def test_cancel_after_ready(self):
|
||||
|
@ -799,7 +799,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
|
|||
result = self.vm.qmp('query-named-block-nodes')
|
||||
# here we check that the last registered quorum file has not been
|
||||
# swapped out and unref
|
||||
self.assert_qmp(result, 'return[0]/file', quorum_img3)
|
||||
self.assert_qmp(result, 'return[1]/file', quorum_img3)
|
||||
self.vm.shutdown()
|
||||
self.assertTrue(iotests.compare_images(quorum_img2, quorum_repair_img),
|
||||
'target image does not match source after mirroring')
|
||||
|
|
|
@ -108,7 +108,8 @@ echo
|
|||
echo === Overriding backing file ===
|
||||
echo
|
||||
|
||||
echo "info block" | run_qemu -drive file="$TEST_IMG",driver=qcow2,backing.file.filename="$TEST_IMG.orig" -nodefaults
|
||||
echo "info block" | run_qemu -drive file="$TEST_IMG",driver=qcow2,backing.file.filename="$TEST_IMG.orig" -nodefaults\
|
||||
| _filter_generated_node_ids
|
||||
|
||||
# Drivers that don't support backing files
|
||||
run_qemu -drive file="$TEST_IMG",driver=raw,backing.file.filename="$TEST_IMG.orig"
|
||||
|
|
|
@ -59,7 +59,7 @@ QEMU X.Y.Z monitor - type 'help' for more information
|
|||
Testing: -drive file=TEST_DIR/t.qcow2,driver=qcow2,backing.file.filename=TEST_DIR/t.qcow2.orig -nodefaults
|
||||
QEMU X.Y.Z monitor - type 'help' for more information
|
||||
(qemu) i[K[Din[K[D[Dinf[K[D[D[Dinfo[K[D[D[D[Dinfo [K[D[D[D[D[Dinfo b[K[D[D[D[D[D[Dinfo bl[K[D[D[D[D[D[D[Dinfo blo[K[D[D[D[D[D[D[D[Dinfo bloc[K[D[D[D[D[D[D[D[D[Dinfo block[K
|
||||
ide0-hd0: TEST_DIR/t.qcow2 (qcow2)
|
||||
ide0-hd0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
|
||||
Cache mode: writeback
|
||||
Backing file: TEST_DIR/t.qcow2.orig (chain depth: 1)
|
||||
(qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K
|
||||
|
|
|
@ -16,17 +16,17 @@ qemu-io: can't open device TEST_DIR/t.vmdk: L1 size too big
|
|||
no file open, try 'help open'
|
||||
|
||||
=== Testing monolithicFlat creation and opening ===
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 subformat=monolithicFlat
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 2.0G (2147483648 bytes)
|
||||
|
||||
=== Testing monolithicFlat with zeroed_grain ===
|
||||
qemu-img: TEST_DIR/t.IMGFMT: Flat image can't enable zeroed grain
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 subformat=monolithicFlat
|
||||
|
||||
=== Testing big twoGbMaxExtentFlat ===
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824000
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824000 subformat=twoGbMaxExtentFlat
|
||||
image: TEST_DIR/t.vmdk
|
||||
file format: vmdk
|
||||
virtual size: 1.0T (1073741824000 bytes)
|
||||
|
@ -2043,7 +2043,7 @@ RW 12582912 VMFS "dummy.IMGFMT" 1
|
|||
|
||||
|
||||
=== Testing truncated sparse ===
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=107374182400
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=107374182400 subformat=monolithicSparse
|
||||
qemu-img: Could not open 'TEST_DIR/t.IMGFMT': File truncated, expecting at least 13172736 bytes
|
||||
|
||||
=== Converting to streamOptimized from image with small cluster size===
|
||||
|
@ -2054,7 +2054,7 @@ wrote 512/512 bytes at offset 10240
|
|||
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
||||
=== Testing monolithicFlat with internally generated JSON file name ===
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 subformat=monolithicFlat
|
||||
qemu-io: can't open: Cannot use relative extent paths with VMDK descriptor file 'json:{"image": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "driver": "blkdebug", "inject-error.0.event": "read_aio"}'
|
||||
|
||||
=== Testing version 3 ===
|
||||
|
@ -2264,7 +2264,7 @@ read 512/512 bytes at offset 64931328
|
|||
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
||||
=== Testing 4TB monolithicFlat creation and IO ===
|
||||
Formatting 'TEST_DIR/iotest-version3.IMGFMT', fmt=IMGFMT size=4398046511104
|
||||
Formatting 'TEST_DIR/iotest-version3.IMGFMT', fmt=IMGFMT size=4398046511104 subformat=monolithicFlat
|
||||
image: TEST_DIR/iotest-version3.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 4.0T (4398046511104 bytes)
|
||||
|
|
|
@ -58,8 +58,8 @@ echo
|
|||
echo "=== Testing dirty version downgrade ==="
|
||||
echo
|
||||
IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
|
||||
$QEMU_IO -c "write -P 0x2a 0 128k" -c flush -c abort "$TEST_IMG" 2>&1 \
|
||||
| _filter_qemu_io
|
||||
$QEMU_IO -c "write -P 0x2a 0 128k" -c flush \
|
||||
-c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 | _filter_qemu_io
|
||||
$PYTHON qcow2.py "$TEST_IMG" dump-header
|
||||
$QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
|
||||
$PYTHON qcow2.py "$TEST_IMG" dump-header
|
||||
|
@ -92,8 +92,8 @@ echo
|
|||
echo "=== Testing dirty lazy_refcounts=off ==="
|
||||
echo
|
||||
IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
|
||||
$QEMU_IO -c "write -P 0x2a 0 128k" -c flush -c abort "$TEST_IMG" 2>&1 \
|
||||
| _filter_qemu_io
|
||||
$QEMU_IO -c "write -P 0x2a 0 128k" -c flush \
|
||||
-c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 | _filter_qemu_io
|
||||
$PYTHON qcow2.py "$TEST_IMG" dump-header
|
||||
$QEMU_IMG amend -o "lazy_refcounts=off" "$TEST_IMG"
|
||||
$PYTHON qcow2.py "$TEST_IMG" dump-header
|
||||
|
|
|
@ -57,7 +57,7 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
||||
wrote 131072/131072 bytes at offset 0
|
||||
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
./common.config: Aborted (core dumped) ( exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@" )
|
||||
./common.config: Killed ( exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@" )
|
||||
magic 0x514649fb
|
||||
version 3
|
||||
backing_file_offset 0x0
|
||||
|
@ -215,7 +215,7 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
||||
wrote 131072/131072 bytes at offset 0
|
||||
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
./common.config: Aborted (core dumped) ( exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@" )
|
||||
./common.config: Killed ( exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@" )
|
||||
magic 0x514649fb
|
||||
version 3
|
||||
backing_file_offset 0x0
|
||||
|
|
|
@ -48,7 +48,8 @@ function do_run_qemu()
|
|||
function run_qemu()
|
||||
{
|
||||
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp | _filter_qemu \
|
||||
| sed -e 's/\("actual-size":\s*\)[0-9]\+/\1SIZE/g'
|
||||
| sed -e 's/\("actual-size":\s*\)[0-9]\+/\1SIZE/g' \
|
||||
| _filter_generated_node_ids
|
||||
}
|
||||
|
||||
size=128M
|
||||
|
|
|
@ -40,6 +40,7 @@ Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk -device virti
|
|||
},
|
||||
"iops_wr": 0,
|
||||
"ro": false,
|
||||
"node-name": "NODE_NAME",
|
||||
"backing_file_depth": 0,
|
||||
"drv": "qcow2",
|
||||
"iops": 0,
|
||||
|
@ -151,6 +152,7 @@ Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk
|
|||
},
|
||||
"iops_wr": 0,
|
||||
"ro": false,
|
||||
"node-name": "NODE_NAME",
|
||||
"backing_file_depth": 0,
|
||||
"drv": "qcow2",
|
||||
"iops": 0,
|
||||
|
@ -270,6 +272,7 @@ Testing:
|
|||
},
|
||||
"iops_wr": 0,
|
||||
"ro": false,
|
||||
"node-name": "NODE_NAME",
|
||||
"backing_file_depth": 0,
|
||||
"drv": "qcow2",
|
||||
"iops": 0,
|
||||
|
@ -390,6 +393,7 @@ Testing:
|
|||
},
|
||||
"iops_wr": 0,
|
||||
"ro": false,
|
||||
"node-name": "NODE_NAME",
|
||||
"backing_file_depth": 0,
|
||||
"drv": "qcow2",
|
||||
"iops": 0,
|
||||
|
@ -480,6 +484,7 @@ Testing:
|
|||
},
|
||||
"iops_wr": 0,
|
||||
"ro": false,
|
||||
"node-name": "NODE_NAME",
|
||||
"backing_file_depth": 0,
|
||||
"drv": "qcow2",
|
||||
"iops": 0,
|
||||
|
|
|
@ -53,7 +53,8 @@ function do_run_qemu()
|
|||
|
||||
function run_qemu()
|
||||
{
|
||||
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp | _filter_qemu_io
|
||||
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp\
|
||||
| _filter_qemu_io | _filter_generated_node_ids
|
||||
}
|
||||
|
||||
test_quorum=$($QEMU_IMG --help|grep quorum)
|
||||
|
|
|
@ -30,7 +30,7 @@ Testing: -drive file=TEST_DIR/2.IMGFMT,format=IMGFMT,if=none,id=drive2
|
|||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "QUORUM_REPORT_BAD", "data": {"node-name": "", "sectors-count": 20480, "sector-num": 0}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "QUORUM_REPORT_BAD", "data": {"node-name": "NODE_NAME", "sectors-count": 20480, "sector-num": 0}}
|
||||
read 10485760/10485760 bytes at offset 0
|
||||
10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
{"return": ""}
|
||||
|
|
69
tests/qemu-iotests/096
Normal file
69
tests/qemu-iotests/096
Normal file
|
@ -0,0 +1,69 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Test that snapshots move the throttling configuration to the active
|
||||
# layer
|
||||
#
|
||||
# Copyright (C) 2015 Igalia, S.L.
|
||||
#
|
||||
# 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 iotests
|
||||
import os
|
||||
|
||||
class TestLiveSnapshot(iotests.QMPTestCase):
|
||||
base_img = os.path.join(iotests.test_dir, 'base.img')
|
||||
target_img = os.path.join(iotests.test_dir, 'target.img')
|
||||
group = 'mygroup'
|
||||
iops = 6000
|
||||
iops_size = 1024
|
||||
|
||||
def setUp(self):
|
||||
opts = []
|
||||
opts.append('node-name=base')
|
||||
opts.append('throttling.group=%s' % self.group)
|
||||
opts.append('throttling.iops-total=%d' % self.iops)
|
||||
opts.append('throttling.iops-size=%d' % self.iops_size)
|
||||
iotests.qemu_img('create', '-f', iotests.imgfmt, self.base_img, '100M')
|
||||
self.vm = iotests.VM().add_drive(self.base_img, ','.join(opts))
|
||||
self.vm.launch()
|
||||
|
||||
def tearDown(self):
|
||||
self.vm.shutdown()
|
||||
os.remove(self.base_img)
|
||||
os.remove(self.target_img)
|
||||
|
||||
def checkConfig(self, active_layer):
|
||||
result = self.vm.qmp('query-named-block-nodes')
|
||||
for r in result['return']:
|
||||
if r['node-name'] == active_layer:
|
||||
self.assertEqual(r['group'], self.group)
|
||||
self.assertEqual(r['iops'], self.iops)
|
||||
self.assertEqual(r['iops_size'], self.iops_size)
|
||||
else:
|
||||
self.assertFalse(r.has_key('group'))
|
||||
self.assertEqual(r['iops'], 0)
|
||||
self.assertFalse(r.has_key('iops_size'))
|
||||
|
||||
def testSnapshot(self):
|
||||
self.checkConfig('base')
|
||||
self.vm.qmp('blockdev-snapshot-sync',
|
||||
node_name = 'base',
|
||||
snapshot_node_name = 'target',
|
||||
snapshot_file = self.target_img,
|
||||
format = iotests.imgfmt)
|
||||
self.checkConfig('target')
|
||||
|
||||
if __name__ == '__main__':
|
||||
iotests.main(supported_fmts=['qcow2'])
|
5
tests/qemu-iotests/096.out
Normal file
5
tests/qemu-iotests/096.out
Normal file
|
@ -0,0 +1,5 @@
|
|||
.
|
||||
----------------------------------------------------------------------
|
||||
Ran 1 tests
|
||||
|
||||
OK
|
|
@ -128,6 +128,11 @@ _filter_date()
|
|||
-e 's/[A-Z][a-z][a-z] [A-z][a-z][a-z] *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]$/DATE/'
|
||||
}
|
||||
|
||||
_filter_generated_node_ids()
|
||||
{
|
||||
sed -re 's/\#block[0-9]{3,}/NODE_NAME/'
|
||||
}
|
||||
|
||||
# replace occurrences of the actual TEST_DIR value with TEST_DIR
|
||||
_filter_testdir()
|
||||
{
|
||||
|
|
|
@ -102,6 +102,7 @@
|
|||
093 auto
|
||||
094 rw auto quick
|
||||
095 rw auto quick
|
||||
096 rw auto quick
|
||||
097 rw auto backing
|
||||
098 rw auto backing quick
|
||||
099 rw auto quick
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue