1 | The following changes since commit aceeaa69d28e6f08a24395d0aa6915b687d0a681: | 1 | The following changes since commit 60205b71421cbc529ca60b12c79e0eeace007319: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-12-17' into staging (2019-12-17 15:55:20 +0000) | 3 | Merge tag 'pull-aspeed-20220801' of https://github.com/legoater/qemu into staging (2022-08-01 13:55:11 -0700) |
4 | 4 | ||
5 | are available in the Git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | git://repo.or.cz/qemu/kevin.git tags/for-upstream | 7 | git://repo.or.cz/qemu/kevin.git tags/for-upstream |
8 | 8 | ||
9 | for you to fetch changes up to f62f08ab7a9d902da70078992248ec5c98f652ad: | 9 | for you to fetch changes up to 21b1d974595b3986c68fe80a1f7e9b87886d4bae: |
10 | 10 | ||
11 | iotests: Test external snapshot with VM state (2019-12-19 18:04:25 +0100) | 11 | main loop: add missing documentation links to GS/IO macros (2022-08-02 12:02:17 +0200) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Block layer patches: | 14 | Block layer patches |
15 | 15 | ||
16 | - qemu-img: fix info --backing-chain --image-opts | 16 | - libvduse: Coverity fixes |
17 | - Error out on image creation with conflicting size options | 17 | - hd-geometry: Fix ignored bios-chs-trans setting |
18 | - Fix external snapshot with VM state | 18 | - io_uring: Fix compiler warning (missing #include) |
19 | - hmp: Allow using qdev ID for qemu-io command | 19 | - main loop: add missing documentation links to GS/IO macros |
20 | - Misc code cleanup | 20 | - qemu-iotests: Discard stderr when probing devices |
21 | - Many iotests improvements | ||
22 | 21 | ||
23 | ---------------------------------------------------------------- | 22 | ---------------------------------------------------------------- |
24 | Alberto Garcia (1): | 23 | Cole Robinson (1): |
25 | qcow2: Use offset_into_cluster() | 24 | qemu-iotests: Discard stderr when probing devices |
26 | 25 | ||
27 | Daniel P. Berrangé (1): | 26 | Emanuele Giuseppe Esposito (1): |
28 | qapi: better document NVMe blockdev @device parameter | 27 | main loop: add missing documentation links to GS/IO macros |
29 | 28 | ||
30 | Kevin Wolf (19): | 29 | Jinhao Fan (1): |
31 | block: Error out on image creation with conflicting size options | 30 | block/io_uring: add missing include file |
32 | blockjob: Fix error message for negative speed | ||
33 | qcow2: Declare BDRV_REQ_NO_FALLBACK supported | ||
34 | iotests: Add qemu_io_log() | ||
35 | iotests: Fix timeout in run_job() | ||
36 | iotests: Support job-complete in run_job() | ||
37 | iotests: Create VM.blockdev_create() | ||
38 | iotests: 255: Drop blockdev_create() | ||
39 | iotests: 206: Convert to VM.blockdev_create() | ||
40 | iotests: 210: Convert to VM.blockdev_create() | ||
41 | iotests: 212: Convert to VM.blockdev_create() | ||
42 | iotests: 213: Convert to VM.blockdev_create() | ||
43 | iotests: 237: Convert to VM.blockdev_create() | ||
44 | iotests: 266: Convert to VM.blockdev_create() | ||
45 | iotests: 207: Remove duplication with VM.blockdev_create() | ||
46 | iotests: 211: Remove duplication with VM.blockdev_create() | ||
47 | block: Activate recursively even for already active nodes | ||
48 | hmp: Allow using qdev ID for qemu-io command | ||
49 | iotests: Test external snapshot with VM state | ||
50 | 31 | ||
51 | Max Reitz (2): | 32 | Lev Kujawski (1): |
52 | iotests/273: Filter format-specific information | 33 | hw/block/hd-geometry: Do not override specified bios-chs-trans |
53 | iotests: Fix IMGOPTSSYNTAX for nbd | ||
54 | 34 | ||
55 | Stefan Hajnoczi (1): | 35 | Xie Yongji (3): |
56 | qemu-img: fix info --backing-chain --image-opts | 36 | libvduse: Fix the incorrect function name |
37 | libvduse: Replace strcpy() with strncpy() | ||
38 | libvduse: Pass positive value to strerror() | ||
57 | 39 | ||
58 | Thomas Huth (4): | 40 | include/qemu/main-loop.h | 18 +++++++++++++++--- |
59 | iotests: Provide a function for checking the creation of huge files | 41 | block/io_uring.c | 1 + |
60 | iotests: Skip test 060 if it is not possible to create large files | 42 | hw/block/hd-geometry.c | 7 ++++++- |
61 | iotests: Skip test 079 if it is not possible to create large files | 43 | subprojects/libvduse/libvduse.c | 13 +++++++------ |
62 | iotests: Add more "_require_drivers" checks to the shell-based tests | 44 | tests/qemu-iotests/common.rc | 4 ++-- |
63 | 45 | 5 files changed, 31 insertions(+), 12 deletions(-) | |
64 | Tuguoyi (1): | ||
65 | qcow2: Move error check of local_err near its assignment | ||
66 | |||
67 | Vladimir Sementsov-Ogievskiy (1): | ||
68 | MAINTAINERS: fix qcow2-bitmap.c under Dirty Bitmaps header | ||
69 | |||
70 | qapi/block-core.json | 6 +- | ||
71 | block.c | 60 ++++++----- | ||
72 | block/qcow2.c | 21 ++-- | ||
73 | blockjob.c | 3 +- | ||
74 | monitor/hmp-cmds.c | 28 +++-- | ||
75 | qemu-img.c | 3 + | ||
76 | MAINTAINERS | 6 +- | ||
77 | hmp-commands.hx | 8 +- | ||
78 | tests/qemu-iotests/005 | 5 +- | ||
79 | tests/qemu-iotests/030 | 4 +- | ||
80 | tests/qemu-iotests/049 | 5 + | ||
81 | tests/qemu-iotests/049.out | 5 + | ||
82 | tests/qemu-iotests/051 | 1 + | ||
83 | tests/qemu-iotests/060 | 3 + | ||
84 | tests/qemu-iotests/079 | 3 + | ||
85 | tests/qemu-iotests/206 | 232 ++++++++++++++++++++---------------------- | ||
86 | tests/qemu-iotests/207 | 8 +- | ||
87 | tests/qemu-iotests/210 | 81 +++++++-------- | ||
88 | tests/qemu-iotests/211 | 12 +-- | ||
89 | tests/qemu-iotests/212 | 101 +++++++++--------- | ||
90 | tests/qemu-iotests/213 | 113 ++++++++++---------- | ||
91 | tests/qemu-iotests/220 | 6 +- | ||
92 | tests/qemu-iotests/237 | 139 ++++++++++++------------- | ||
93 | tests/qemu-iotests/255 | 10 -- | ||
94 | tests/qemu-iotests/266 | 69 ++++++------- | ||
95 | tests/qemu-iotests/266.out | 14 +++ | ||
96 | tests/qemu-iotests/267 | 1 + | ||
97 | tests/qemu-iotests/273 | 3 +- | ||
98 | tests/qemu-iotests/273.out | 27 ----- | ||
99 | tests/qemu-iotests/279 | 57 +++++++++++ | ||
100 | tests/qemu-iotests/279.out | 35 +++++++ | ||
101 | tests/qemu-iotests/280 | 83 +++++++++++++++ | ||
102 | tests/qemu-iotests/280.out | 50 +++++++++ | ||
103 | tests/qemu-iotests/common.rc | 13 ++- | ||
104 | tests/qemu-iotests/group | 2 + | ||
105 | tests/qemu-iotests/iotests.py | 25 ++++- | ||
106 | 36 files changed, 724 insertions(+), 518 deletions(-) | ||
107 | create mode 100755 tests/qemu-iotests/279 | ||
108 | create mode 100644 tests/qemu-iotests/279.out | ||
109 | create mode 100755 tests/qemu-iotests/280 | ||
110 | create mode 100644 tests/qemu-iotests/280.out | ||
111 | |||
112 | diff view generated by jsdifflib |
1 | This tests creating an external snapshot with VM state (which results in | 1 | From: Jinhao Fan <fanjinhao21s@ict.ac.cn> |
---|---|---|---|
2 | an active overlay over an inactive backing file, which is also the root | ||
3 | node of an inactive BlockBackend), re-activating the images and | ||
4 | performing some operations to test that the re-activation worked as | ||
5 | intended. | ||
6 | 2 | ||
3 | The commit "Use io_uring_register_ring_fd() to skip fd operations" uses | ||
4 | warn_report but did not include the header file "qemu/error-report.h". | ||
5 | This causes "error: implicit declaration of function ‘warn_report’". | ||
6 | Include this header file. | ||
7 | |||
8 | Fixes: e2848bc574 ("Use io_uring_register_ring_fd() to skip fd operations") | ||
9 | Signed-off-by: Jinhao Fan <fanjinhao21s@ict.ac.cn> | ||
10 | Message-Id: <20220721065645.577404-1-fanjinhao21s@ict.ac.cn> | ||
11 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | ||
7 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 12 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
8 | --- | 13 | --- |
9 | tests/qemu-iotests/280 | 83 ++++++++++++++++++++++++++++++++++++++ | 14 | block/io_uring.c | 1 + |
10 | tests/qemu-iotests/280.out | 50 +++++++++++++++++++++++ | 15 | 1 file changed, 1 insertion(+) |
11 | tests/qemu-iotests/group | 1 + | ||
12 | 3 files changed, 134 insertions(+) | ||
13 | create mode 100755 tests/qemu-iotests/280 | ||
14 | create mode 100644 tests/qemu-iotests/280.out | ||
15 | 16 | ||
16 | diff --git a/tests/qemu-iotests/280 b/tests/qemu-iotests/280 | 17 | diff --git a/block/io_uring.c b/block/io_uring.c |
17 | new file mode 100755 | 18 | index XXXXXXX..XXXXXXX 100644 |
18 | index XXXXXXX..XXXXXXX | 19 | --- a/block/io_uring.c |
19 | --- /dev/null | 20 | +++ b/block/io_uring.c |
20 | +++ b/tests/qemu-iotests/280 | ||
21 | @@ -XXX,XX +XXX,XX @@ | 21 | @@ -XXX,XX +XXX,XX @@ |
22 | +#!/usr/bin/env python | 22 | #include "qemu/osdep.h" |
23 | +# | 23 | #include <liburing.h> |
24 | +# Copyright (C) 2019 Red Hat, Inc. | 24 | #include "block/aio.h" |
25 | +# | 25 | +#include "qemu/error-report.h" |
26 | +# This program is free software; you can redistribute it and/or modify | 26 | #include "qemu/queue.h" |
27 | +# it under the terms of the GNU General Public License as published by | 27 | #include "block/block.h" |
28 | +# the Free Software Foundation; either version 2 of the License, or | 28 | #include "block/raw-aio.h" |
29 | +# (at your option) any later version. | ||
30 | +# | ||
31 | +# This program is distributed in the hope that it will be useful, | ||
32 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
33 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
34 | +# GNU General Public License for more details. | ||
35 | +# | ||
36 | +# You should have received a copy of the GNU General Public License | ||
37 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
38 | +# | ||
39 | +# Creator/Owner: Kevin Wolf <kwolf@redhat.com> | ||
40 | +# | ||
41 | +# Test migration to file for taking an external snapshot with VM state. | ||
42 | + | ||
43 | +import iotests | ||
44 | +import os | ||
45 | + | ||
46 | +iotests.verify_image_format(supported_fmts=['qcow2']) | ||
47 | +iotests.verify_protocol(supported=['file']) | ||
48 | +iotests.verify_platform(['linux']) | ||
49 | + | ||
50 | +with iotests.FilePath('base') as base_path , \ | ||
51 | + iotests.FilePath('top') as top_path, \ | ||
52 | + iotests.VM() as vm: | ||
53 | + | ||
54 | + iotests.qemu_img_log('create', '-f', iotests.imgfmt, base_path, '64M') | ||
55 | + | ||
56 | + iotests.log('=== Launch VM ===') | ||
57 | + vm.add_object('iothread,id=iothread0') | ||
58 | + vm.add_blockdev('file,filename=%s,node-name=base-file' % (base_path)) | ||
59 | + vm.add_blockdev('%s,file=base-file,node-name=base-fmt' % (iotests.imgfmt)) | ||
60 | + vm.add_device('virtio-blk,drive=base-fmt,iothread=iothread0,id=vda') | ||
61 | + vm.launch() | ||
62 | + | ||
63 | + vm.enable_migration_events('VM') | ||
64 | + | ||
65 | + iotests.log('\n=== Migrate to file ===') | ||
66 | + vm.qmp_log('migrate', uri='exec:cat > /dev/null') | ||
67 | + | ||
68 | + with iotests.Timeout(3, 'Migration does not complete'): | ||
69 | + vm.wait_migration() | ||
70 | + | ||
71 | + iotests.log('\nVM is now stopped:') | ||
72 | + iotests.log(vm.qmp('query-migrate')['return']['status']) | ||
73 | + vm.qmp_log('query-status') | ||
74 | + | ||
75 | + iotests.log('\n=== Create a snapshot of the disk image ===') | ||
76 | + vm.blockdev_create({ | ||
77 | + 'driver': 'file', | ||
78 | + 'filename': top_path, | ||
79 | + 'size': 0, | ||
80 | + }) | ||
81 | + vm.qmp_log('blockdev-add', node_name='top-file', | ||
82 | + driver='file', filename=top_path, | ||
83 | + filters=[iotests.filter_qmp_testfiles]) | ||
84 | + | ||
85 | + vm.blockdev_create({ | ||
86 | + 'driver': iotests.imgfmt, | ||
87 | + 'file': 'top-file', | ||
88 | + 'size': 1024 * 1024, | ||
89 | + }) | ||
90 | + vm.qmp_log('blockdev-add', node_name='top-fmt', | ||
91 | + driver=iotests.imgfmt, file='top-file') | ||
92 | + | ||
93 | + vm.qmp_log('blockdev-snapshot', node='base-fmt', overlay='top-fmt') | ||
94 | + | ||
95 | + iotests.log('\n=== Resume the VM and simulate a write request ===') | ||
96 | + vm.qmp_log('cont') | ||
97 | + iotests.log(vm.hmp_qemu_io('-d vda/virtio-backend', 'write 4k 4k')) | ||
98 | + | ||
99 | + iotests.log('\n=== Commit it to the backing file ===') | ||
100 | + result = vm.qmp_log('block-commit', job_id='job0', auto_dismiss=False, | ||
101 | + device='top-fmt', top_node='top-fmt', | ||
102 | + filters=[iotests.filter_qmp_testfiles]) | ||
103 | + if 'return' in result: | ||
104 | + vm.run_job('job0') | ||
105 | diff --git a/tests/qemu-iotests/280.out b/tests/qemu-iotests/280.out | ||
106 | new file mode 100644 | ||
107 | index XXXXXXX..XXXXXXX | ||
108 | --- /dev/null | ||
109 | +++ b/tests/qemu-iotests/280.out | ||
110 | @@ -XXX,XX +XXX,XX @@ | ||
111 | +Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=67108864 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
112 | + | ||
113 | +=== Launch VM === | ||
114 | +Enabling migration QMP events on VM... | ||
115 | +{"return": {}} | ||
116 | + | ||
117 | +=== Migrate to file === | ||
118 | +{"execute": "migrate", "arguments": {"uri": "exec:cat > /dev/null"}} | ||
119 | +{"return": {}} | ||
120 | +{"data": {"status": "setup"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} | ||
121 | +{"data": {"status": "active"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} | ||
122 | +{"data": {"status": "completed"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} | ||
123 | + | ||
124 | +VM is now stopped: | ||
125 | +completed | ||
126 | +{"execute": "query-status", "arguments": {}} | ||
127 | +{"return": {"running": false, "singlestep": false, "status": "postmigrate"}} | ||
128 | + | ||
129 | +=== Create a snapshot of the disk image === | ||
130 | +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "file", "filename": "TEST_DIR/PID-top", "size": 0}}} | ||
131 | +{"return": {}} | ||
132 | +{"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
133 | +{"return": {}} | ||
134 | + | ||
135 | +{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-top", "node-name": "top-file"}} | ||
136 | +{"return": {}} | ||
137 | +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "qcow2", "file": "top-file", "size": 1048576}}} | ||
138 | +{"return": {}} | ||
139 | +{"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
140 | +{"return": {}} | ||
141 | + | ||
142 | +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": "top-file", "node-name": "top-fmt"}} | ||
143 | +{"return": {}} | ||
144 | +{"execute": "blockdev-snapshot", "arguments": {"node": "base-fmt", "overlay": "top-fmt"}} | ||
145 | +{"return": {}} | ||
146 | + | ||
147 | +=== Resume the VM and simulate a write request === | ||
148 | +{"execute": "cont", "arguments": {}} | ||
149 | +{"return": {}} | ||
150 | +{"return": ""} | ||
151 | + | ||
152 | +=== Commit it to the backing file === | ||
153 | +{"execute": "block-commit", "arguments": {"auto-dismiss": false, "device": "top-fmt", "job-id": "job0", "top-node": "top-fmt"}} | ||
154 | +{"return": {}} | ||
155 | +{"execute": "job-complete", "arguments": {"id": "job0"}} | ||
156 | +{"return": {}} | ||
157 | +{"data": {"device": "job0", "len": 65536, "offset": 65536, "speed": 0, "type": "commit"}, "event": "BLOCK_JOB_READY", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} | ||
158 | +{"data": {"device": "job0", "len": 65536, "offset": 65536, "speed": 0, "type": "commit"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} | ||
159 | +{"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
160 | +{"return": {}} | ||
161 | diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group | ||
162 | index XXXXXXX..XXXXXXX 100644 | ||
163 | --- a/tests/qemu-iotests/group | ||
164 | +++ b/tests/qemu-iotests/group | ||
165 | @@ -XXX,XX +XXX,XX @@ | ||
166 | 273 backing quick | ||
167 | 277 rw quick | ||
168 | 279 rw backing quick | ||
169 | +280 rw migration quick | ||
170 | -- | 29 | -- |
171 | 2.20.1 | 30 | 2.35.3 |
172 | 31 | ||
173 | 32 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: Xie Yongji <xieyongji@bytedance.com> |
---|---|---|---|
2 | 2 | ||
3 | Some tests create huge (but sparse) files, and to be able to run those | 3 | In vduse_name_is_valid(), we actually check whether |
4 | tests in certain limited environments (like CI containers), we have to | 4 | the name is invalid or not. So let's change the |
5 | check for the possibility to create such files first. Thus let's introduce | 5 | function name to vduse_name_is_invalid() to match |
6 | a common function to check for large files, and replace the already | 6 | the behavior. |
7 | existing checks in the iotests 005 and 220 with this function. | ||
8 | 7 | ||
9 | Signed-off-by: Thomas Huth <thuth@redhat.com> | 8 | Signed-off-by: Xie Yongji <xieyongji@bytedance.com> |
10 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 9 | Reviewed-by: Markus Armbruster <armbru@redhat.com> |
10 | Message-Id: <20220706095624.328-2-xieyongji@bytedance.com> | ||
11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
12 | --- | 12 | --- |
13 | tests/qemu-iotests/005 | 5 +---- | 13 | subprojects/libvduse/libvduse.c | 6 +++--- |
14 | tests/qemu-iotests/220 | 6 ++---- | 14 | 1 file changed, 3 insertions(+), 3 deletions(-) |
15 | tests/qemu-iotests/common.rc | 10 ++++++++++ | ||
16 | 3 files changed, 13 insertions(+), 8 deletions(-) | ||
17 | 15 | ||
18 | diff --git a/tests/qemu-iotests/005 b/tests/qemu-iotests/005 | 16 | diff --git a/subprojects/libvduse/libvduse.c b/subprojects/libvduse/libvduse.c |
19 | index XXXXXXX..XXXXXXX 100755 | ||
20 | --- a/tests/qemu-iotests/005 | ||
21 | +++ b/tests/qemu-iotests/005 | ||
22 | @@ -XXX,XX +XXX,XX @@ fi | ||
23 | # Sanity check: For raw, we require a file system that permits the creation | ||
24 | # of a HUGE (but very sparse) file. Check we can create it before continuing. | ||
25 | if [ "$IMGFMT" = "raw" ]; then | ||
26 | - if ! truncate --size=5T "$TEST_IMG"; then | ||
27 | - _notrun "file system on $TEST_DIR does not support large enough files" | ||
28 | - fi | ||
29 | - rm "$TEST_IMG" | ||
30 | + _require_large_file 5T | ||
31 | fi | ||
32 | |||
33 | echo | ||
34 | diff --git a/tests/qemu-iotests/220 b/tests/qemu-iotests/220 | ||
35 | index XXXXXXX..XXXXXXX 100755 | ||
36 | --- a/tests/qemu-iotests/220 | ||
37 | +++ b/tests/qemu-iotests/220 | ||
38 | @@ -XXX,XX +XXX,XX @@ echo "== Creating huge file ==" | ||
39 | |||
40 | # Sanity check: We require a file system that permits the creation | ||
41 | # of a HUGE (but very sparse) file. tmpfs works, ext4 does not. | ||
42 | -if ! truncate --size=513T "$TEST_IMG"; then | ||
43 | - _notrun "file system on $TEST_DIR does not support large enough files" | ||
44 | -fi | ||
45 | -rm "$TEST_IMG" | ||
46 | +_require_large_file 513T | ||
47 | + | ||
48 | IMGOPTS='cluster_size=2M,refcount_bits=1' _make_test_img 513T | ||
49 | |||
50 | echo "== Populating refcounts ==" | ||
51 | diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc | ||
52 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
53 | --- a/tests/qemu-iotests/common.rc | 18 | --- a/subprojects/libvduse/libvduse.c |
54 | +++ b/tests/qemu-iotests/common.rc | 19 | +++ b/subprojects/libvduse/libvduse.c |
55 | @@ -XXX,XX +XXX,XX @@ _require_drivers() | 20 | @@ -XXX,XX +XXX,XX @@ static int vduse_dev_init(VduseDev *dev, const char *name, |
56 | done | 21 | return 0; |
57 | } | 22 | } |
58 | 23 | ||
59 | +# Check that we have a file system that allows huge (but very sparse) files | 24 | -static inline bool vduse_name_is_valid(const char *name) |
60 | +# | 25 | +static inline bool vduse_name_is_invalid(const char *name) |
61 | +_require_large_file() | 26 | { |
62 | +{ | 27 | return strlen(name) >= VDUSE_NAME_MAX || strstr(name, ".."); |
63 | + if ! truncate --size="$1" "$TEST_IMG"; then | 28 | } |
64 | + _notrun "file system on $TEST_DIR does not support large enough files" | 29 | @@ -XXX,XX +XXX,XX @@ VduseDev *vduse_dev_create_by_name(const char *name, uint16_t num_queues, |
65 | + fi | 30 | VduseDev *dev; |
66 | + rm "$TEST_IMG" | 31 | int ret; |
67 | +} | 32 | |
68 | + | 33 | - if (!name || vduse_name_is_valid(name) || !ops || |
69 | # make sure this script returns success | 34 | + if (!name || vduse_name_is_invalid(name) || !ops || |
70 | true | 35 | !ops->enable_queue || !ops->disable_queue) { |
36 | fprintf(stderr, "Invalid parameter for vduse\n"); | ||
37 | return NULL; | ||
38 | @@ -XXX,XX +XXX,XX @@ VduseDev *vduse_dev_create(const char *name, uint32_t device_id, | ||
39 | struct vduse_dev_config *dev_config; | ||
40 | size_t size = offsetof(struct vduse_dev_config, config); | ||
41 | |||
42 | - if (!name || vduse_name_is_valid(name) || | ||
43 | + if (!name || vduse_name_is_invalid(name) || | ||
44 | !has_feature(features, VIRTIO_F_VERSION_1) || !config || | ||
45 | !config_size || !ops || !ops->enable_queue || !ops->disable_queue) { | ||
46 | fprintf(stderr, "Invalid parameter for vduse\n"); | ||
71 | -- | 47 | -- |
72 | 2.20.1 | 48 | 2.35.3 |
73 | |||
74 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Thomas Huth <thuth@redhat.com> | ||
2 | 1 | ||
3 | Test 060 fails in the arm64, s390x and ppc64le LXD containers on Travis | ||
4 | (which we will hopefully enable in our CI soon). These containers | ||
5 | apparently do not allow large files to be created. The repair process | ||
6 | in test 060 creates a file of 64 GiB, so test first whether such large | ||
7 | files are possible and skip the test if that's not the case. | ||
8 | |||
9 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
10 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
11 | --- | ||
12 | tests/qemu-iotests/060 | 3 +++ | ||
13 | 1 file changed, 3 insertions(+) | ||
14 | |||
15 | diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060 | ||
16 | index XXXXXXX..XXXXXXX 100755 | ||
17 | --- a/tests/qemu-iotests/060 | ||
18 | +++ b/tests/qemu-iotests/060 | ||
19 | @@ -XXX,XX +XXX,XX @@ _supported_fmt qcow2 | ||
20 | _supported_proto file | ||
21 | _supported_os Linux | ||
22 | |||
23 | +# The repair process will create a large file - so check for availability first | ||
24 | +_require_large_file 64G | ||
25 | + | ||
26 | rt_offset=65536 # 0x10000 (XXX: just an assumption) | ||
27 | rb_offset=131072 # 0x20000 (XXX: just an assumption) | ||
28 | l1_offset=196608 # 0x30000 (XXX: just an assumption) | ||
29 | -- | ||
30 | 2.20.1 | ||
31 | |||
32 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Thomas Huth <thuth@redhat.com> | ||
2 | 1 | ||
3 | Test 079 fails in the arm64, s390x and ppc64le LXD containers on Travis | ||
4 | (which we will hopefully enable in our CI soon). These containers | ||
5 | apparently do not allow large files to be created. Test 079 tries to | ||
6 | create a 4G sparse file, which is apparently already too big for these | ||
7 | containers, so check first whether we can really create such files before | ||
8 | executing the test. | ||
9 | |||
10 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
12 | --- | ||
13 | tests/qemu-iotests/079 | 3 +++ | ||
14 | 1 file changed, 3 insertions(+) | ||
15 | |||
16 | diff --git a/tests/qemu-iotests/079 b/tests/qemu-iotests/079 | ||
17 | index XXXXXXX..XXXXXXX 100755 | ||
18 | --- a/tests/qemu-iotests/079 | ||
19 | +++ b/tests/qemu-iotests/079 | ||
20 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
21 | _supported_fmt qcow2 | ||
22 | _supported_proto file nfs | ||
23 | |||
24 | +# Some containers (e.g. non-x86 on Travis) do not allow large files | ||
25 | +_require_large_file 4G | ||
26 | + | ||
27 | echo "=== Check option preallocation and cluster_size ===" | ||
28 | echo | ||
29 | cluster_sizes="16384 32768 65536 131072 262144 524288 1048576 2097152 4194304" | ||
30 | -- | ||
31 | 2.20.1 | ||
32 | |||
33 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Daniel P. Berrangé <berrange@redhat.com> | ||
2 | 1 | ||
3 | Mention that this is a PCI device address & give the format it is | ||
4 | expected in. Also mention that it must be first unbound from any | ||
5 | host kernel driver. | ||
6 | |||
7 | Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> | ||
8 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
9 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
10 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
11 | --- | ||
12 | qapi/block-core.json | 6 +++++- | ||
13 | 1 file changed, 5 insertions(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/qapi/block-core.json b/qapi/block-core.json | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/qapi/block-core.json | ||
18 | +++ b/qapi/block-core.json | ||
19 | @@ -XXX,XX +XXX,XX @@ | ||
20 | # | ||
21 | # Driver specific block device options for the NVMe backend. | ||
22 | # | ||
23 | -# @device: controller address of the NVMe device. | ||
24 | +# @device: PCI controller address of the NVMe device in | ||
25 | +# format hhhh:bb:ss.f (host:bus:slot.function) | ||
26 | # @namespace: namespace number of the device, starting from 1. | ||
27 | # | ||
28 | +# Note that the PCI @device must have been unbound from any host | ||
29 | +# kernel driver before instructing QEMU to add the blockdev. | ||
30 | +# | ||
31 | # Since: 2.12 | ||
32 | ## | ||
33 | { 'struct': 'BlockdevOptionsNVMe', | ||
34 | -- | ||
35 | 2.20.1 | ||
36 | |||
37 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Stefan Hajnoczi <stefanha@redhat.com> | ||
2 | 1 | ||
3 | Only apply --image-opts to the topmost image when listing an entire | ||
4 | backing chain. It is incorrect to treat backing filenames as image | ||
5 | options. Assuming we have the backing chain t.IMGFMT.base <- | ||
6 | t.IMGFMT.mid <- t.IMGFMT, qemu-img info fails as follows: | ||
7 | |||
8 | $ qemu-img info --backing-chain --image-opts \ | ||
9 | driver=qcow2,file.driver=file,file.filename=t.IMGFMT | ||
10 | qemu-img: Could not open 'TEST_DIR/t.IMGFMT.mid': Cannot find device=TEST_DIR/t.IMGFMT.mid nor node_name=TEST_DIR/t.IMGFMT.mid | ||
11 | |||
12 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
13 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
14 | Reviewed-by: Alberto Garcia <berto@igalia.com> | ||
15 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
16 | --- | ||
17 | qemu-img.c | 3 ++ | ||
18 | tests/qemu-iotests/279 | 57 ++++++++++++++++++++++++++++++++++++++ | ||
19 | tests/qemu-iotests/279.out | 35 +++++++++++++++++++++++ | ||
20 | tests/qemu-iotests/group | 1 + | ||
21 | 4 files changed, 96 insertions(+) | ||
22 | create mode 100755 tests/qemu-iotests/279 | ||
23 | create mode 100644 tests/qemu-iotests/279.out | ||
24 | |||
25 | diff --git a/qemu-img.c b/qemu-img.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/qemu-img.c | ||
28 | +++ b/qemu-img.c | ||
29 | @@ -XXX,XX +XXX,XX @@ static ImageInfoList *collect_image_info_list(bool image_opts, | ||
30 | |||
31 | blk_unref(blk); | ||
32 | |||
33 | + /* Clear parameters that only apply to the topmost image */ | ||
34 | filename = fmt = NULL; | ||
35 | + image_opts = false; | ||
36 | + | ||
37 | if (chain) { | ||
38 | if (info->has_full_backing_filename) { | ||
39 | filename = info->full_backing_filename; | ||
40 | diff --git a/tests/qemu-iotests/279 b/tests/qemu-iotests/279 | ||
41 | new file mode 100755 | ||
42 | index XXXXXXX..XXXXXXX | ||
43 | --- /dev/null | ||
44 | +++ b/tests/qemu-iotests/279 | ||
45 | @@ -XXX,XX +XXX,XX @@ | ||
46 | +#!/usr/bin/env bash | ||
47 | +# | ||
48 | +# Test qemu-img --backing-chain --image-opts | ||
49 | +# | ||
50 | +# Copyright (C) 2019 Red Hat, Inc. | ||
51 | +# | ||
52 | +# This program is free software; you can redistribute it and/or modify | ||
53 | +# it under the terms of the GNU General Public License as published by | ||
54 | +# the Free Software Foundation; either version 2 of the License, or | ||
55 | +# (at your option) any later version. | ||
56 | +# | ||
57 | +# This program is distributed in the hope that it will be useful, | ||
58 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
59 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
60 | +# GNU General Public License for more details. | ||
61 | +# | ||
62 | +# You should have received a copy of the GNU General Public License | ||
63 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
64 | +# | ||
65 | + | ||
66 | +seq=$(basename "$0") | ||
67 | +echo "QA output created by $seq" | ||
68 | + | ||
69 | +status=1 # failure is the default! | ||
70 | + | ||
71 | +_cleanup() | ||
72 | +{ | ||
73 | + _cleanup_test_img | ||
74 | + rm -f "$TEST_IMG.mid" | ||
75 | +} | ||
76 | +trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
77 | + | ||
78 | +# get standard environment, filters and checks | ||
79 | +. ./common.rc | ||
80 | +. ./common.filter | ||
81 | + | ||
82 | +# Backing files are required... | ||
83 | +_supported_fmt qcow qcow2 vmdk qed | ||
84 | +_supported_proto file | ||
85 | +_supported_os Linux | ||
86 | + | ||
87 | +TEST_IMG="$TEST_IMG.base" _make_test_img 64M | ||
88 | +TEST_IMG="$TEST_IMG.mid" _make_test_img -b "$TEST_IMG.base" | ||
89 | +_make_test_img -b "$TEST_IMG.mid" | ||
90 | + | ||
91 | +echo | ||
92 | +echo '== qemu-img info --backing-chain ==' | ||
93 | +_img_info --backing-chain | _filter_img_info | ||
94 | + | ||
95 | +echo | ||
96 | +echo '== qemu-img info --backing-chain --image-opts ==' | ||
97 | +TEST_IMG="driver=qcow2,file.driver=file,file.filename=$TEST_IMG" _img_info --backing-chain --image-opts | _filter_img_info | ||
98 | + | ||
99 | +# success, all done | ||
100 | +echo "*** done" | ||
101 | +rm -f $seq.full | ||
102 | +status=0 | ||
103 | diff --git a/tests/qemu-iotests/279.out b/tests/qemu-iotests/279.out | ||
104 | new file mode 100644 | ||
105 | index XXXXXXX..XXXXXXX | ||
106 | --- /dev/null | ||
107 | +++ b/tests/qemu-iotests/279.out | ||
108 | @@ -XXX,XX +XXX,XX @@ | ||
109 | +QA output created by 279 | ||
110 | +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864 | ||
111 | +Formatting 'TEST_DIR/t.IMGFMT.mid', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.base | ||
112 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.mid | ||
113 | + | ||
114 | +== qemu-img info --backing-chain == | ||
115 | +image: TEST_DIR/t.IMGFMT | ||
116 | +file format: IMGFMT | ||
117 | +virtual size: 64 MiB (67108864 bytes) | ||
118 | +backing file: TEST_DIR/t.IMGFMT.mid | ||
119 | + | ||
120 | +image: TEST_DIR/t.IMGFMT.mid | ||
121 | +file format: IMGFMT | ||
122 | +virtual size: 64 MiB (67108864 bytes) | ||
123 | +backing file: TEST_DIR/t.IMGFMT.base | ||
124 | + | ||
125 | +image: TEST_DIR/t.IMGFMT.base | ||
126 | +file format: IMGFMT | ||
127 | +virtual size: 64 MiB (67108864 bytes) | ||
128 | + | ||
129 | +== qemu-img info --backing-chain --image-opts == | ||
130 | +image: TEST_DIR/t.IMGFMT | ||
131 | +file format: IMGFMT | ||
132 | +virtual size: 64 MiB (67108864 bytes) | ||
133 | +backing file: TEST_DIR/t.IMGFMT.mid | ||
134 | + | ||
135 | +image: TEST_DIR/t.IMGFMT.mid | ||
136 | +file format: IMGFMT | ||
137 | +virtual size: 64 MiB (67108864 bytes) | ||
138 | +backing file: TEST_DIR/t.IMGFMT.base | ||
139 | + | ||
140 | +image: TEST_DIR/t.IMGFMT.base | ||
141 | +file format: IMGFMT | ||
142 | +virtual size: 64 MiB (67108864 bytes) | ||
143 | +*** done | ||
144 | diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group | ||
145 | index XXXXXXX..XXXXXXX 100644 | ||
146 | --- a/tests/qemu-iotests/group | ||
147 | +++ b/tests/qemu-iotests/group | ||
148 | @@ -XXX,XX +XXX,XX @@ | ||
149 | 272 rw | ||
150 | 273 backing quick | ||
151 | 277 rw quick | ||
152 | +279 rw backing quick | ||
153 | -- | ||
154 | 2.20.1 | ||
155 | |||
156 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | If both the create options (qemu-img create -o ...) and the size | ||
2 | parameter were given, the size parameter was silently ignored. Instead, | ||
3 | make specifying two sizes an error. | ||
4 | 1 | ||
5 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
6 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
7 | --- | ||
8 | block.c | 10 ++++++++-- | ||
9 | tests/qemu-iotests/049 | 5 +++++ | ||
10 | tests/qemu-iotests/049.out | 5 +++++ | ||
11 | 3 files changed, 18 insertions(+), 2 deletions(-) | ||
12 | |||
13 | diff --git a/block.c b/block.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/block.c | ||
16 | +++ b/block.c | ||
17 | @@ -XXX,XX +XXX,XX @@ void bdrv_img_create(const char *filename, const char *fmt, | ||
18 | return; | ||
19 | } | ||
20 | |||
21 | + /* Create parameter list */ | ||
22 | create_opts = qemu_opts_append(create_opts, drv->create_opts); | ||
23 | create_opts = qemu_opts_append(create_opts, proto_drv->create_opts); | ||
24 | |||
25 | - /* Create parameter list with default values */ | ||
26 | opts = qemu_opts_create(create_opts, NULL, 0, &error_abort); | ||
27 | - qemu_opt_set_number(opts, BLOCK_OPT_SIZE, img_size, &error_abort); | ||
28 | |||
29 | /* Parse -o options */ | ||
30 | if (options) { | ||
31 | @@ -XXX,XX +XXX,XX @@ void bdrv_img_create(const char *filename, const char *fmt, | ||
32 | } | ||
33 | } | ||
34 | |||
35 | + if (!qemu_opt_get(opts, BLOCK_OPT_SIZE)) { | ||
36 | + qemu_opt_set_number(opts, BLOCK_OPT_SIZE, img_size, &error_abort); | ||
37 | + } else if (img_size != UINT64_C(-1)) { | ||
38 | + error_setg(errp, "The image size must be specified only once"); | ||
39 | + goto out; | ||
40 | + } | ||
41 | + | ||
42 | if (base_filename) { | ||
43 | qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, base_filename, &local_err); | ||
44 | if (local_err) { | ||
45 | diff --git a/tests/qemu-iotests/049 b/tests/qemu-iotests/049 | ||
46 | index XXXXXXX..XXXXXXX 100755 | ||
47 | --- a/tests/qemu-iotests/049 | ||
48 | +++ b/tests/qemu-iotests/049 | ||
49 | @@ -XXX,XX +XXX,XX @@ for s in $sizes; do | ||
50 | test_qemu_img create -f $IMGFMT -o size=$s "$TEST_IMG" | ||
51 | done | ||
52 | |||
53 | +echo "== 4. Specify size twice (-o and traditional parameter) ==" | ||
54 | +echo | ||
55 | + | ||
56 | +test_qemu_img create -f $IMGFMT -o size=10M "$TEST_IMG" 20M | ||
57 | + | ||
58 | echo "== Check correct interpretation of suffixes for cluster size ==" | ||
59 | echo | ||
60 | sizes="1024 1024b 1k 1K 1M " | ||
61 | diff --git a/tests/qemu-iotests/049.out b/tests/qemu-iotests/049.out | ||
62 | index XXXXXXX..XXXXXXX 100644 | ||
63 | --- a/tests/qemu-iotests/049.out | ||
64 | +++ b/tests/qemu-iotests/049.out | ||
65 | @@ -XXX,XX +XXX,XX @@ qemu-img: TEST_DIR/t.qcow2: Parameter 'size' expects a non-negative number below | ||
66 | Optional suffix k, M, G, T, P or E means kilo-, mega-, giga-, tera-, peta- | ||
67 | and exabytes, respectively. | ||
68 | |||
69 | +== 4. Specify size twice (-o and traditional parameter) == | ||
70 | + | ||
71 | +qemu-img create -f qcow2 -o size=10M TEST_DIR/t.qcow2 20M | ||
72 | +qemu-img: TEST_DIR/t.qcow2: The image size must be specified only once | ||
73 | + | ||
74 | == Check correct interpretation of suffixes for cluster size == | ||
75 | |||
76 | qemu-img create -f qcow2 -o cluster_size=1024 TEST_DIR/t.qcow2 64M | ||
77 | -- | ||
78 | 2.20.1 | ||
79 | |||
80 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The error message for a negative speed uses QERR_INVALID_PARAMETER, | ||
2 | which implies that the 'speed' option doesn't even exist: | ||
3 | 1 | ||
4 | {"error": {"class": "GenericError", "desc": "Invalid parameter 'speed'"}} | ||
5 | |||
6 | Make it use QERR_INVALID_PARAMETER_VALUE instead: | ||
7 | |||
8 | {"error": {"class": "GenericError", "desc": "Parameter 'speed' expects a non-negative value"}} | ||
9 | |||
10 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
11 | Reviewed-by: Alberto Garcia <berto@igalia.com> | ||
12 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
13 | --- | ||
14 | blockjob.c | 3 ++- | ||
15 | tests/qemu-iotests/030 | 4 ++-- | ||
16 | 2 files changed, 4 insertions(+), 3 deletions(-) | ||
17 | |||
18 | diff --git a/blockjob.c b/blockjob.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/blockjob.c | ||
21 | +++ b/blockjob.c | ||
22 | @@ -XXX,XX +XXX,XX @@ void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp) | ||
23 | return; | ||
24 | } | ||
25 | if (speed < 0) { | ||
26 | - error_setg(errp, QERR_INVALID_PARAMETER, "speed"); | ||
27 | + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "speed", | ||
28 | + "a non-negative value"); | ||
29 | return; | ||
30 | } | ||
31 | |||
32 | diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 | ||
33 | index XXXXXXX..XXXXXXX 100755 | ||
34 | --- a/tests/qemu-iotests/030 | ||
35 | +++ b/tests/qemu-iotests/030 | ||
36 | @@ -XXX,XX +XXX,XX @@ class TestSetSpeed(iotests.QMPTestCase): | ||
37 | self.assert_no_active_block_jobs() | ||
38 | |||
39 | result = self.vm.qmp('block-stream', device='drive0', speed=-1) | ||
40 | - self.assert_qmp(result, 'error/desc', "Invalid parameter 'speed'") | ||
41 | + self.assert_qmp(result, 'error/desc', "Parameter 'speed' expects a non-negative value") | ||
42 | |||
43 | self.assert_no_active_block_jobs() | ||
44 | |||
45 | @@ -XXX,XX +XXX,XX @@ class TestSetSpeed(iotests.QMPTestCase): | ||
46 | self.assert_qmp(result, 'return', {}) | ||
47 | |||
48 | result = self.vm.qmp('block-job-set-speed', device='drive0', speed=-1) | ||
49 | - self.assert_qmp(result, 'error/desc', "Invalid parameter 'speed'") | ||
50 | + self.assert_qmp(result, 'error/desc', "Parameter 'speed' expects a non-negative value") | ||
51 | |||
52 | self.cancel_and_wait(resume=True) | ||
53 | |||
54 | -- | ||
55 | 2.20.1 | ||
56 | |||
57 | diff view generated by jsdifflib |
1 | In the common case, qcow2_co_pwrite_zeroes() already only modifies | 1 | From: Xie Yongji <xieyongji@bytedance.com> |
---|---|---|---|
2 | metadata case, so we're fine with or without BDRV_REQ_NO_FALLBACK set. | ||
3 | 2 | ||
4 | The only exception is when using an external data file, where the | 3 | Coverity reported a string overflow issue since we copied |
5 | request is passed down to the block driver of the external data file. We | 4 | "name" to "dev_config->name" without checking the length. |
6 | are forwarding the BDRV_REQ_NO_FALLBACK flag there, though, so this is | 5 | This should be a false positive since we already checked |
7 | fine, too. | 6 | the length of "name" in vduse_name_is_invalid(). But anyway, |
7 | let's replace strcpy() with strncpy() (as a general library, | ||
8 | we'd like to minimize dependencies on other libraries, so we | ||
9 | didn't use g_strlcpy() here) to fix the coverity complaint. | ||
8 | 10 | ||
9 | Declare the flag supported therefore. | 11 | Fixes: Coverity CID 1490224 |
10 | 12 | Signed-off-by: Xie Yongji <xieyongji@bytedance.com> | |
13 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | ||
14 | Message-Id: <20220706095624.328-3-xieyongji@bytedance.com> | ||
11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 15 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
12 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
13 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
14 | Reviewed-by: Alberto Garcia <berto@igalia.com> | ||
15 | --- | 16 | --- |
16 | block/qcow2.c | 3 ++- | 17 | subprojects/libvduse/libvduse.c | 3 ++- |
17 | 1 file changed, 2 insertions(+), 1 deletion(-) | 18 | 1 file changed, 2 insertions(+), 1 deletion(-) |
18 | 19 | ||
19 | diff --git a/block/qcow2.c b/block/qcow2.c | 20 | diff --git a/subprojects/libvduse/libvduse.c b/subprojects/libvduse/libvduse.c |
20 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/block/qcow2.c | 22 | --- a/subprojects/libvduse/libvduse.c |
22 | +++ b/block/qcow2.c | 23 | +++ b/subprojects/libvduse/libvduse.c |
23 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, | 24 | @@ -XXX,XX +XXX,XX @@ VduseDev *vduse_dev_create(const char *name, uint32_t device_id, |
24 | } | 25 | goto err_dev; |
25 | } | 26 | } |
26 | 27 | ||
27 | - bs->supported_zero_flags = header.version >= 3 ? BDRV_REQ_MAY_UNMAP : 0; | 28 | - strcpy(dev_config->name, name); |
28 | + bs->supported_zero_flags = header.version >= 3 ? | 29 | + strncpy(dev_config->name, name, VDUSE_NAME_MAX); |
29 | + BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK : 0; | 30 | + dev_config->name[VDUSE_NAME_MAX - 1] = '\0'; |
30 | 31 | dev_config->device_id = device_id; | |
31 | /* Repair image if dirty */ | 32 | dev_config->vendor_id = vendor_id; |
32 | if (!(flags & (BDRV_O_CHECK | BDRV_O_INACTIVE)) && !bs->read_only && | 33 | dev_config->features = features; |
33 | -- | 34 | -- |
34 | 2.20.1 | 35 | 2.35.3 |
35 | |||
36 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Add a function that runs qemu-io and logs the output with the | ||
2 | appropriate filters applied. | ||
3 | 1 | ||
4 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
5 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
6 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
7 | Reviewed-by: Alberto Garcia <berto@igalia.com> | ||
8 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
9 | --- | ||
10 | tests/qemu-iotests/iotests.py | 5 +++++ | ||
11 | 1 file changed, 5 insertions(+) | ||
12 | |||
13 | diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/tests/qemu-iotests/iotests.py | ||
16 | +++ b/tests/qemu-iotests/iotests.py | ||
17 | @@ -XXX,XX +XXX,XX @@ def qemu_io(*args): | ||
18 | sys.stderr.write('qemu-io received signal %i: %s\n' % (-exitcode, ' '.join(args))) | ||
19 | return subp.communicate()[0] | ||
20 | |||
21 | +def qemu_io_log(*args): | ||
22 | + result = qemu_io(*args) | ||
23 | + log(result, filters=[filter_testfiles, filter_qemu_io]) | ||
24 | + return result | ||
25 | + | ||
26 | def qemu_io_silent(*args): | ||
27 | '''Run qemu-io and return the exit code, suppressing stdout''' | ||
28 | args = qemu_io_args + list(args) | ||
29 | -- | ||
30 | 2.20.1 | ||
31 | |||
32 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | run_job() accepts a wait parameter for a timeout, but it doesn't | ||
2 | actually use it. The only thing that is missing is passing it to | ||
3 | events_wait(), so do that now. | ||
4 | 1 | ||
5 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
6 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
7 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
8 | Reviewed-by: Alberto Garcia <berto@igalia.com> | ||
9 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
10 | --- | ||
11 | tests/qemu-iotests/iotests.py | 2 +- | ||
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/tests/qemu-iotests/iotests.py | ||
17 | +++ b/tests/qemu-iotests/iotests.py | ||
18 | @@ -XXX,XX +XXX,XX @@ class VM(qtest.QEMUQtestMachine): | ||
19 | ] | ||
20 | error = None | ||
21 | while True: | ||
22 | - ev = filter_qmp_event(self.events_wait(events)) | ||
23 | + ev = filter_qmp_event(self.events_wait(events, timeout=wait)) | ||
24 | if ev['event'] != 'JOB_STATUS_CHANGE': | ||
25 | if use_log: | ||
26 | log(ev) | ||
27 | -- | ||
28 | 2.20.1 | ||
29 | |||
30 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Automatically complete jobs that have a 'ready' state and need an | ||
2 | explicit job-complete. Without this, run_job() would hang for such | ||
3 | jobs. | ||
4 | 1 | ||
5 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
6 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
7 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
8 | Reviewed-by: Alberto Garcia <berto@igalia.com> | ||
9 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
10 | --- | ||
11 | tests/qemu-iotests/iotests.py | 2 ++ | ||
12 | 1 file changed, 2 insertions(+) | ||
13 | |||
14 | diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/tests/qemu-iotests/iotests.py | ||
17 | +++ b/tests/qemu-iotests/iotests.py | ||
18 | @@ -XXX,XX +XXX,XX @@ class VM(qtest.QEMUQtestMachine): | ||
19 | error = j['error'] | ||
20 | if use_log: | ||
21 | log('Job failed: %s' % (j['error'])) | ||
22 | + elif status == 'ready': | ||
23 | + self.qmp_log('job-complete', id=job) | ||
24 | elif status == 'pending' and not auto_finalize: | ||
25 | if pre_finalize: | ||
26 | pre_finalize() | ||
27 | -- | ||
28 | 2.20.1 | ||
29 | |||
30 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alberto Garcia <berto@igalia.com> | ||
2 | 1 | ||
3 | There's a couple of places left in the qcow2 code that still do the | ||
4 | calculation manually, so let's replace them. | ||
5 | |||
6 | Signed-off-by: Alberto Garcia <berto@igalia.com> | ||
7 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
8 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
9 | --- | ||
10 | block/qcow2.c | 8 +++----- | ||
11 | 1 file changed, 3 insertions(+), 5 deletions(-) | ||
12 | |||
13 | diff --git a/block/qcow2.c b/block/qcow2.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/block/qcow2.c | ||
16 | +++ b/block/qcow2.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, | ||
18 | return -EINVAL; | ||
19 | } | ||
20 | |||
21 | - if (bitmaps_ext.bitmap_directory_offset & (s->cluster_size - 1)) { | ||
22 | + if (offset_into_cluster(s, bitmaps_ext.bitmap_directory_offset)) { | ||
23 | error_setg(errp, "bitmaps_ext: " | ||
24 | "invalid bitmap directory offset"); | ||
25 | return -EINVAL; | ||
26 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_block_status(BlockDriverState *bs, | ||
27 | { | ||
28 | BDRVQcow2State *s = bs->opaque; | ||
29 | uint64_t cluster_offset; | ||
30 | - int index_in_cluster, ret; | ||
31 | unsigned int bytes; | ||
32 | - int status = 0; | ||
33 | + int ret, status = 0; | ||
34 | |||
35 | qemu_co_mutex_lock(&s->lock); | ||
36 | |||
37 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_block_status(BlockDriverState *bs, | ||
38 | |||
39 | if ((ret == QCOW2_CLUSTER_NORMAL || ret == QCOW2_CLUSTER_ZERO_ALLOC) && | ||
40 | !s->crypto) { | ||
41 | - index_in_cluster = offset & (s->cluster_size - 1); | ||
42 | - *map = cluster_offset | index_in_cluster; | ||
43 | + *map = cluster_offset | offset_into_cluster(s, offset); | ||
44 | *file = s->data_file->bs; | ||
45 | status |= BDRV_BLOCK_OFFSET_VALID; | ||
46 | } | ||
47 | -- | ||
48 | 2.20.1 | ||
49 | |||
50 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
2 | 1 | ||
3 | Somehow I wrote not full path to the file. Fix that. | ||
4 | |||
5 | Also, while being here, rearrange entries, so that includes go first, | ||
6 | then block, than migration, than util. | ||
7 | |||
8 | Fixes: 052db8e71444d | ||
9 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
10 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
11 | --- | ||
12 | MAINTAINERS | 6 +++--- | ||
13 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
14 | |||
15 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/MAINTAINERS | ||
18 | +++ b/MAINTAINERS | ||
19 | @@ -XXX,XX +XXX,XX @@ M: John Snow <jsnow@redhat.com> | ||
20 | R: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
21 | L: qemu-block@nongnu.org | ||
22 | S: Supported | ||
23 | -F: util/hbitmap.c | ||
24 | -F: block/dirty-bitmap.c | ||
25 | F: include/qemu/hbitmap.h | ||
26 | F: include/block/dirty-bitmap.h | ||
27 | -F: qcow2-bitmap.c | ||
28 | +F: block/dirty-bitmap.c | ||
29 | +F: block/qcow2-bitmap.c | ||
30 | F: migration/block-dirty-bitmap.c | ||
31 | +F: util/hbitmap.c | ||
32 | F: tests/test-hbitmap.c | ||
33 | F: docs/interop/bitmaps.rst | ||
34 | T: git https://github.com/jnsnow/qemu.git bitmaps | ||
35 | -- | ||
36 | 2.20.1 | ||
37 | |||
38 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Thomas Huth <thuth@redhat.com> | ||
2 | 1 | ||
3 | Test 051 should be skipped if nbd is not available, and 267 should | ||
4 | be skipped if copy-on-read is not enabled. | ||
5 | |||
6 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
7 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
8 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
9 | --- | ||
10 | tests/qemu-iotests/051 | 1 + | ||
11 | tests/qemu-iotests/267 | 1 + | ||
12 | 2 files changed, 2 insertions(+) | ||
13 | |||
14 | diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051 | ||
15 | index XXXXXXX..XXXXXXX 100755 | ||
16 | --- a/tests/qemu-iotests/051 | ||
17 | +++ b/tests/qemu-iotests/051 | ||
18 | @@ -XXX,XX +XXX,XX @@ _supported_proto file | ||
19 | # A compat=0.10 image is created in this test which does not support anything | ||
20 | # other than refcount_bits=16 | ||
21 | _unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' | ||
22 | +_require_drivers nbd | ||
23 | |||
24 | do_run_qemu() | ||
25 | { | ||
26 | diff --git a/tests/qemu-iotests/267 b/tests/qemu-iotests/267 | ||
27 | index XXXXXXX..XXXXXXX 100755 | ||
28 | --- a/tests/qemu-iotests/267 | ||
29 | +++ b/tests/qemu-iotests/267 | ||
30 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
31 | _supported_fmt qcow2 | ||
32 | _supported_proto file | ||
33 | _supported_os Linux | ||
34 | +_require_drivers copy-on-read | ||
35 | |||
36 | # Internal snapshots are (currently) impossible with refcount_bits=1 | ||
37 | _unsupported_imgopts 'refcount_bits=1[^0-9]' | ||
38 | -- | ||
39 | 2.20.1 | ||
40 | |||
41 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Max Reitz <mreitz@redhat.com> | ||
2 | 1 | ||
3 | Doing this allows running this test with e.g. -o compat=0.10 or | ||
4 | -o compat=refcount_bits=1. | ||
5 | |||
6 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
7 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
8 | --- | ||
9 | tests/qemu-iotests/273 | 3 ++- | ||
10 | tests/qemu-iotests/273.out | 27 --------------------------- | ||
11 | 2 files changed, 2 insertions(+), 28 deletions(-) | ||
12 | |||
13 | diff --git a/tests/qemu-iotests/273 b/tests/qemu-iotests/273 | ||
14 | index XXXXXXX..XXXXXXX 100755 | ||
15 | --- a/tests/qemu-iotests/273 | ||
16 | +++ b/tests/qemu-iotests/273 | ||
17 | @@ -XXX,XX +XXX,XX @@ do_run_qemu() | ||
18 | run_qemu() | ||
19 | { | ||
20 | do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp | | ||
21 | - _filter_generated_node_ids | _filter_imgfmt | _filter_actual_image_size | ||
22 | + _filter_generated_node_ids | _filter_imgfmt | | ||
23 | + _filter_actual_image_size | _filter_img_info | ||
24 | } | ||
25 | |||
26 | TEST_IMG="$TEST_IMG.base" _make_test_img 64M | ||
27 | diff --git a/tests/qemu-iotests/273.out b/tests/qemu-iotests/273.out | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/tests/qemu-iotests/273.out | ||
30 | +++ b/tests/qemu-iotests/273.out | ||
31 | @@ -XXX,XX +XXX,XX @@ Testing: -blockdev file,node-name=base,filename=TEST_DIR/t.IMGFMT.base -blockdev | ||
32 | "cluster-size": 65536, | ||
33 | "format": "IMGFMT", | ||
34 | "actual-size": SIZE, | ||
35 | - "format-specific": { | ||
36 | - "type": "IMGFMT", | ||
37 | - "data": { | ||
38 | - "compat": "1.1", | ||
39 | - "lazy-refcounts": false, | ||
40 | - "refcount-bits": 16, | ||
41 | - "corrupt": false | ||
42 | - } | ||
43 | - }, | ||
44 | "full-backing-filename": "TEST_DIR/t.IMGFMT.base", | ||
45 | "backing-filename": "TEST_DIR/t.IMGFMT.base", | ||
46 | "dirty-flag": false | ||
47 | @@ -XXX,XX +XXX,XX @@ Testing: -blockdev file,node-name=base,filename=TEST_DIR/t.IMGFMT.base -blockdev | ||
48 | "cluster-size": 65536, | ||
49 | "format": "IMGFMT", | ||
50 | "actual-size": SIZE, | ||
51 | - "format-specific": { | ||
52 | - "type": "IMGFMT", | ||
53 | - "data": { | ||
54 | - "compat": "1.1", | ||
55 | - "lazy-refcounts": false, | ||
56 | - "refcount-bits": 16, | ||
57 | - "corrupt": false | ||
58 | - } | ||
59 | - }, | ||
60 | "full-backing-filename": "TEST_DIR/t.IMGFMT.mid", | ||
61 | "backing-filename": "TEST_DIR/t.IMGFMT.mid", | ||
62 | "dirty-flag": false | ||
63 | @@ -XXX,XX +XXX,XX @@ Testing: -blockdev file,node-name=base,filename=TEST_DIR/t.IMGFMT.base -blockdev | ||
64 | "cluster-size": 65536, | ||
65 | "format": "IMGFMT", | ||
66 | "actual-size": SIZE, | ||
67 | - "format-specific": { | ||
68 | - "type": "IMGFMT", | ||
69 | - "data": { | ||
70 | - "compat": "1.1", | ||
71 | - "lazy-refcounts": false, | ||
72 | - "refcount-bits": 16, | ||
73 | - "corrupt": false | ||
74 | - } | ||
75 | - }, | ||
76 | "full-backing-filename": "TEST_DIR/t.IMGFMT.base", | ||
77 | "backing-filename": "TEST_DIR/t.IMGFMT.base", | ||
78 | "dirty-flag": false | ||
79 | -- | ||
80 | 2.20.1 | ||
81 | |||
82 | diff view generated by jsdifflib |
1 | In order to issue requests on an existing BlockBackend with the | 1 | From: Xie Yongji <xieyongji@bytedance.com> |
---|---|---|---|
2 | 'qemu-io' HMP command, allow specifying the BlockBackend not only with a | ||
3 | BlockBackend name, but also with a qdev ID/QOM path for a device that | ||
4 | owns the (possibly anonymous) BlockBackend. | ||
5 | 2 | ||
6 | Because qdev names could be conflicting with BlockBackend and node | 3 | The value passed to strerror() should be positive. |
7 | names, introduce a -d option to explicitly address a device. If the | 4 | So let's fix it. |
8 | option is not given, a BlockBackend or a node is addressed. | ||
9 | 5 | ||
6 | Fixes: Coverity CID 1490226, 1490223 | ||
7 | Signed-off-by: Xie Yongji <xieyongji@bytedance.com> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | ||
10 | Message-Id: <20220706095624.328-4-xieyongji@bytedance.com> | ||
10 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
11 | --- | 12 | --- |
12 | monitor/hmp-cmds.c | 28 ++++++++++++++++++---------- | 13 | subprojects/libvduse/libvduse.c | 4 ++-- |
13 | hmp-commands.hx | 8 +++++--- | 14 | 1 file changed, 2 insertions(+), 2 deletions(-) |
14 | 2 files changed, 23 insertions(+), 13 deletions(-) | ||
15 | 15 | ||
16 | diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c | 16 | diff --git a/subprojects/libvduse/libvduse.c b/subprojects/libvduse/libvduse.c |
17 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/monitor/hmp-cmds.c | 18 | --- a/subprojects/libvduse/libvduse.c |
19 | +++ b/monitor/hmp-cmds.c | 19 | +++ b/subprojects/libvduse/libvduse.c |
20 | @@ -XXX,XX +XXX,XX @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict) | 20 | @@ -XXX,XX +XXX,XX @@ VduseDev *vduse_dev_create_by_name(const char *name, uint16_t num_queues, |
21 | { | 21 | ret = vduse_dev_init(dev, name, num_queues, ops, priv); |
22 | BlockBackend *blk; | 22 | if (ret < 0) { |
23 | BlockBackend *local_blk = NULL; | 23 | fprintf(stderr, "Failed to init vduse device %s: %s\n", |
24 | + bool qdev = qdict_get_try_bool(qdict, "qdev", false); | 24 | - name, strerror(ret)); |
25 | const char* device = qdict_get_str(qdict, "device"); | 25 | + name, strerror(-ret)); |
26 | const char* command = qdict_get_str(qdict, "command"); | 26 | free(dev); |
27 | Error *err = NULL; | 27 | return NULL; |
28 | int ret; | ||
29 | |||
30 | - blk = blk_by_name(device); | ||
31 | - if (!blk) { | ||
32 | - BlockDriverState *bs = bdrv_lookup_bs(NULL, device, &err); | ||
33 | - if (bs) { | ||
34 | - blk = local_blk = blk_new(bdrv_get_aio_context(bs), | ||
35 | - 0, BLK_PERM_ALL); | ||
36 | - ret = blk_insert_bs(blk, bs, &err); | ||
37 | - if (ret < 0) { | ||
38 | + if (qdev) { | ||
39 | + blk = blk_by_qdev_id(device, &err); | ||
40 | + if (!blk) { | ||
41 | + goto fail; | ||
42 | + } | ||
43 | + } else { | ||
44 | + blk = blk_by_name(device); | ||
45 | + if (!blk) { | ||
46 | + BlockDriverState *bs = bdrv_lookup_bs(NULL, device, &err); | ||
47 | + if (bs) { | ||
48 | + blk = local_blk = blk_new(bdrv_get_aio_context(bs), | ||
49 | + 0, BLK_PERM_ALL); | ||
50 | + ret = blk_insert_bs(blk, bs, &err); | ||
51 | + if (ret < 0) { | ||
52 | + goto fail; | ||
53 | + } | ||
54 | + } else { | ||
55 | goto fail; | ||
56 | } | ||
57 | - } else { | ||
58 | - goto fail; | ||
59 | } | ||
60 | } | 28 | } |
61 | 29 | @@ -XXX,XX +XXX,XX @@ VduseDev *vduse_dev_create(const char *name, uint32_t device_id, | |
62 | diff --git a/hmp-commands.hx b/hmp-commands.hx | 30 | ret = vduse_dev_init(dev, name, num_queues, ops, priv); |
63 | index XXXXXXX..XXXXXXX 100644 | 31 | if (ret < 0) { |
64 | --- a/hmp-commands.hx | 32 | fprintf(stderr, "Failed to init vduse device %s: %s\n", |
65 | +++ b/hmp-commands.hx | 33 | - name, strerror(ret)); |
66 | @@ -XXX,XX +XXX,XX @@ ETEXI | 34 | + name, strerror(-ret)); |
67 | 35 | goto err; | |
68 | { | 36 | } |
69 | .name = "qemu-io", | ||
70 | - .args_type = "device:B,command:s", | ||
71 | - .params = "[device] \"[command]\"", | ||
72 | - .help = "run a qemu-io command on a block device", | ||
73 | + .args_type = "qdev:-d,device:B,command:s", | ||
74 | + .params = "[-d] [device] \"[command]\"", | ||
75 | + .help = "run a qemu-io command on a block device\n\t\t\t" | ||
76 | + "-d: [device] is a device ID rather than a " | ||
77 | + "drive ID or node name", | ||
78 | .cmd = hmp_qemu_io, | ||
79 | }, | ||
80 | 37 | ||
81 | -- | 38 | -- |
82 | 2.20.1 | 39 | 2.35.3 |
83 | |||
84 | diff view generated by jsdifflib |
1 | bdrv_invalidate_cache_all() assumes that all nodes in a given subtree | 1 | From: Lev Kujawski <lkujaw@member.fsf.org> |
---|---|---|---|
2 | are either active or inactive when it starts. Therefore, as soon as it | ||
3 | arrives at an already active node, it stops. | ||
4 | 2 | ||
5 | However, this assumption is wrong. For example, it's possible to take a | 3 | For small disk images (<4 GiB), QEMU and SeaBIOS default to the |
6 | snapshot of an inactive node, which results in an active overlay over an | 4 | LARGE/ECHS disk translation method, but it is not uncommon for other |
7 | inactive backing file. The active overlay is probably also the root node | 5 | BIOS software to use LBA in these cases as well. Some operating |
8 | of an inactive BlockBackend (blk->disable_perm == true). | 6 | system boot loaders (e.g., NT 4) do not handle LARGE translations |
7 | outside of fixed configurations. See, e.g., Q154052: | ||
9 | 8 | ||
10 | In this case, bdrv_invalidate_cache_all() does not need to do anything | 9 | "When starting an x86 based computer, Ntdetect.com retrieves and |
11 | to activate the overlay node, but it still needs to recurse into the | 10 | stores Interrupt 13 information. . . If the disk controller is using a |
12 | children and the parents to make sure that after returning success, | 11 | 32 sector/64 head translation scheme, this boundary will be 1 GB. If |
13 | really everything is activated. | 12 | the controller uses 63 sector/255 head translation [AUTHOR: i.e., |
13 | LBA], the limit will be 4 GB." | ||
14 | 14 | ||
15 | Cc: qemu-stable@nongnu.org | 15 | To accommodate these situations, hd_geometry_guess() now follows the |
16 | disk translation specified by the user even when the ATA disk geometry | ||
17 | is guessed. | ||
18 | |||
19 | hd_geometry_guess(): | ||
20 | * Only set the disk translation when translation is AUTO. | ||
21 | * Show the soon-to-be active translation (*ptrans) in the trace rather | ||
22 | than what was guessed. | ||
23 | |||
24 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/56 | ||
25 | Buglink: https://bugs.launchpad.net/qemu/+bug/1745312 | ||
26 | |||
27 | Signed-off-by: Lev Kujawski <lkujaw@member.fsf.org> | ||
28 | Message-Id: <20220707204045.999544-1-lkujaw@member.fsf.org> | ||
16 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 29 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
17 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
18 | --- | 30 | --- |
19 | block.c | 50 ++++++++++++++++++++++++-------------------------- | 31 | hw/block/hd-geometry.c | 7 ++++++- |
20 | 1 file changed, 24 insertions(+), 26 deletions(-) | 32 | 1 file changed, 6 insertions(+), 1 deletion(-) |
21 | 33 | ||
22 | diff --git a/block.c b/block.c | 34 | diff --git a/hw/block/hd-geometry.c b/hw/block/hd-geometry.c |
23 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/block.c | 36 | --- a/hw/block/hd-geometry.c |
25 | +++ b/block.c | 37 | +++ b/hw/block/hd-geometry.c |
26 | @@ -XXX,XX +XXX,XX @@ static void coroutine_fn bdrv_co_invalidate_cache(BlockDriverState *bs, | 38 | @@ -XXX,XX +XXX,XX @@ void hd_geometry_guess(BlockBackend *blk, |
27 | return; | 39 | translation = BIOS_ATA_TRANSLATION_NONE; |
28 | } | 40 | } |
29 | 41 | if (ptrans) { | |
30 | - if (!(bs->open_flags & BDRV_O_INACTIVE)) { | 42 | - *ptrans = translation; |
31 | - return; | 43 | + if (*ptrans == BIOS_ATA_TRANSLATION_AUTO) { |
32 | - } | 44 | + *ptrans = translation; |
33 | - | 45 | + } else { |
34 | QLIST_FOREACH(child, &bs->children, next) { | 46 | + /* Defer to the translation specified by the user. */ |
35 | bdrv_co_invalidate_cache(child->bs, &local_err); | 47 | + translation = *ptrans; |
36 | if (local_err) { | ||
37 | @@ -XXX,XX +XXX,XX @@ static void coroutine_fn bdrv_co_invalidate_cache(BlockDriverState *bs, | ||
38 | * just keep the extended permissions for the next time that an activation | ||
39 | * of the image is tried. | ||
40 | */ | ||
41 | - bs->open_flags &= ~BDRV_O_INACTIVE; | ||
42 | - bdrv_get_cumulative_perm(bs, &perm, &shared_perm); | ||
43 | - ret = bdrv_check_perm(bs, NULL, perm, shared_perm, NULL, NULL, &local_err); | ||
44 | - if (ret < 0) { | ||
45 | - bs->open_flags |= BDRV_O_INACTIVE; | ||
46 | - error_propagate(errp, local_err); | ||
47 | - return; | ||
48 | - } | ||
49 | - bdrv_set_perm(bs, perm, shared_perm); | ||
50 | - | ||
51 | - if (bs->drv->bdrv_co_invalidate_cache) { | ||
52 | - bs->drv->bdrv_co_invalidate_cache(bs, &local_err); | ||
53 | - if (local_err) { | ||
54 | + if (bs->open_flags & BDRV_O_INACTIVE) { | ||
55 | + bs->open_flags &= ~BDRV_O_INACTIVE; | ||
56 | + bdrv_get_cumulative_perm(bs, &perm, &shared_perm); | ||
57 | + ret = bdrv_check_perm(bs, NULL, perm, shared_perm, NULL, NULL, &local_err); | ||
58 | + if (ret < 0) { | ||
59 | bs->open_flags |= BDRV_O_INACTIVE; | ||
60 | error_propagate(errp, local_err); | ||
61 | return; | ||
62 | } | ||
63 | - } | ||
64 | + bdrv_set_perm(bs, perm, shared_perm); | ||
65 | |||
66 | - FOR_EACH_DIRTY_BITMAP(bs, bm) { | ||
67 | - bdrv_dirty_bitmap_skip_store(bm, false); | ||
68 | - } | ||
69 | + if (bs->drv->bdrv_co_invalidate_cache) { | ||
70 | + bs->drv->bdrv_co_invalidate_cache(bs, &local_err); | ||
71 | + if (local_err) { | ||
72 | + bs->open_flags |= BDRV_O_INACTIVE; | ||
73 | + error_propagate(errp, local_err); | ||
74 | + return; | ||
75 | + } | ||
76 | + } | ||
77 | |||
78 | - ret = refresh_total_sectors(bs, bs->total_sectors); | ||
79 | - if (ret < 0) { | ||
80 | - bs->open_flags |= BDRV_O_INACTIVE; | ||
81 | - error_setg_errno(errp, -ret, "Could not refresh total sector count"); | ||
82 | - return; | ||
83 | + FOR_EACH_DIRTY_BITMAP(bs, bm) { | ||
84 | + bdrv_dirty_bitmap_skip_store(bm, false); | ||
85 | + } | ||
86 | + | ||
87 | + ret = refresh_total_sectors(bs, bs->total_sectors); | ||
88 | + if (ret < 0) { | ||
89 | + bs->open_flags |= BDRV_O_INACTIVE; | ||
90 | + error_setg_errno(errp, -ret, "Could not refresh total sector count"); | ||
91 | + return; | ||
92 | + } | 48 | + } |
93 | } | 49 | } |
94 | 50 | trace_hd_geometry_guess(blk, *pcyls, *pheads, *psecs, translation); | |
95 | QLIST_FOREACH(parent, &bs->parents, next_parent) { | 51 | } |
96 | -- | 52 | -- |
97 | 2.20.1 | 53 | 2.35.3 |
98 | |||
99 | diff view generated by jsdifflib |
1 | From: Max Reitz <mreitz@redhat.com> | 1 | From: Cole Robinson <crobinso@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | There is no $SOCKDIR, only $SOCK_DIR. | 3 | qemu-iotests fails in the following setup: |
4 | 4 | ||
5 | Fixes: f3923a72f199b2c63747a7032db74730546f55c6 | 5 | ./configure --enable-modules --enable-smartcard \ |
6 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 6 | --target-list=x86_64-softmmu,s390x-softmmu |
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 7 | make |
8 | cd build | ||
9 | QEMU_PROG=`pwd`/s390x-softmmu/qemu-system-s390x \ | ||
10 | ../tests/check-block.sh qcow2 | ||
11 | ... | ||
12 | --- /home/crobinso/src/qemu/tests/qemu-iotests/127.out | ||
13 | +++ /home/crobinso/src/qemu/build/tests/qemu-iotests/scratch/127.out.bad | ||
14 | @@ -1,4 +1,18 @@ | ||
15 | QA output created by 127 | ||
16 | +Failed to open module: /home/crobinso/src/qemu/build/hw-usb-smartcard.so: undefined symbol: ccid_card_ccid_attach | ||
17 | ... | ||
18 | --- /home/crobinso/src/qemu/tests/qemu-iotests/267.out | ||
19 | +++ /home/crobinso/src/qemu/build/tests/qemu-iotests/scratch/267.out.bad | ||
20 | @@ -1,4 +1,11 @@ | ||
21 | QA output created by 267 | ||
22 | +Failed to open module: /home/crobinso/src/qemu/build/hw-usb-smartcard.so: undefined symbol: ccid_card_ccid_attach | ||
23 | |||
24 | The stderr spew is its own known issue, but seems like iotests should | ||
25 | be discarding stderr in this case. | ||
26 | |||
27 | Signed-off-by: Cole Robinson <crobinso@redhat.com> | ||
28 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
8 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 29 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
9 | --- | 30 | --- |
10 | tests/qemu-iotests/common.rc | 3 ++- | 31 | tests/qemu-iotests/common.rc | 4 ++-- |
11 | 1 file changed, 2 insertions(+), 1 deletion(-) | 32 | 1 file changed, 2 insertions(+), 2 deletions(-) |
12 | 33 | ||
13 | diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc | 34 | diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc |
14 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/tests/qemu-iotests/common.rc | 36 | --- a/tests/qemu-iotests/common.rc |
16 | +++ b/tests/qemu-iotests/common.rc | 37 | +++ b/tests/qemu-iotests/common.rc |
17 | @@ -XXX,XX +XXX,XX @@ if [ "$IMGOPTSSYNTAX" = "true" ]; then | 38 | @@ -XXX,XX +XXX,XX @@ _require_large_file() |
18 | TEST_IMG="$DRIVER,file.filename=$TEST_DIR/t.$IMGFMT" | 39 | # |
19 | elif [ "$IMGPROTO" = "nbd" ]; then | 40 | _require_devices() |
20 | TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT | 41 | { |
21 | - TEST_IMG="$DRIVER,file.driver=nbd,file.type=unix,file.path=$SOCKDIR/nbd" | 42 | - available=$($QEMU -M none -device help | \ |
22 | + TEST_IMG="$DRIVER,file.driver=nbd,file.type=unix" | 43 | + available=$($QEMU -M none -device help 2> /dev/null | \ |
23 | + TEST_IMG="$TEST_IMG,file.path=$SOCK_DIR/nbd" | 44 | grep ^name | sed -e 's/^name "//' -e 's/".*$//') |
24 | elif [ "$IMGPROTO" = "ssh" ]; then | 45 | for device |
25 | TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT | 46 | do |
26 | TEST_IMG="$DRIVER,file.driver=ssh,file.host=127.0.0.1,file.path=$TEST_IMG_FILE" | 47 | @@ -XXX,XX +XXX,XX @@ _require_devices() |
48 | |||
49 | _require_one_device_of() | ||
50 | { | ||
51 | - available=$($QEMU -M none -device help | \ | ||
52 | + available=$($QEMU -M none -device help 2> /dev/null | \ | ||
53 | grep ^name | sed -e 's/^name "//' -e 's/".*$//') | ||
54 | for device | ||
55 | do | ||
27 | -- | 56 | -- |
28 | 2.20.1 | 57 | 2.35.3 |
29 | |||
30 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Tuguoyi <tu.guoyi@h3c.com> | ||
2 | 1 | ||
3 | The local_err check outside of the if block was necessary | ||
4 | when it was introduced in commit d1258dd0c87 because it needed to be | ||
5 | executed even if qcow2_load_autoloading_dirty_bitmaps() returned false. | ||
6 | |||
7 | After some modifications that all required the error check to remain | ||
8 | where it is, commit 9c98f145dfb finally moved the | ||
9 | qcow2_load_dirty_bitmaps() call into the if block, so now the error | ||
10 | check should be there, too. | ||
11 | |||
12 | Signed-off-by: Guoyi Tu <tu.guoyi@h3c.com> | ||
13 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
14 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
15 | --- | ||
16 | block/qcow2.c | 10 +++++----- | ||
17 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
18 | |||
19 | diff --git a/block/qcow2.c b/block/qcow2.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/block/qcow2.c | ||
22 | +++ b/block/qcow2.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, | ||
24 | if (!(bdrv_get_flags(bs) & BDRV_O_INACTIVE)) { | ||
25 | /* It's case 1, 2 or 3.2. Or 3.1 which is BUG in management layer. */ | ||
26 | bool header_updated = qcow2_load_dirty_bitmaps(bs, &local_err); | ||
27 | + if (local_err != NULL) { | ||
28 | + error_propagate(errp, local_err); | ||
29 | + ret = -EINVAL; | ||
30 | + goto fail; | ||
31 | + } | ||
32 | |||
33 | update_header = update_header && !header_updated; | ||
34 | } | ||
35 | - if (local_err != NULL) { | ||
36 | - error_propagate(errp, local_err); | ||
37 | - ret = -EINVAL; | ||
38 | - goto fail; | ||
39 | - } | ||
40 | |||
41 | if (update_header) { | ||
42 | ret = qcow2_update_header(bs); | ||
43 | -- | ||
44 | 2.20.1 | ||
45 | |||
46 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | We have several almost identical copies of a blockdev_create() function | ||
2 | in different test cases. Time to create one unified function in | ||
3 | iotests.py. | ||
4 | 1 | ||
5 | To keep the diff managable, this patch only creates the function and | ||
6 | follow-up patches will convert the individual test cases. | ||
7 | |||
8 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
9 | --- | ||
10 | tests/qemu-iotests/iotests.py | 16 ++++++++++++++++ | ||
11 | 1 file changed, 16 insertions(+) | ||
12 | |||
13 | diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/tests/qemu-iotests/iotests.py | ||
16 | +++ b/tests/qemu-iotests/iotests.py | ||
17 | @@ -XXX,XX +XXX,XX @@ class VM(qtest.QEMUQtestMachine): | ||
18 | elif status == 'null': | ||
19 | return error | ||
20 | |||
21 | + # Returns None on success, and an error string on failure | ||
22 | + def blockdev_create(self, options, job_id='job0', filters=None): | ||
23 | + if filters is None: | ||
24 | + filters = [filter_qmp_testfiles] | ||
25 | + result = self.qmp_log('blockdev-create', filters=filters, | ||
26 | + job_id=job_id, options=options) | ||
27 | + | ||
28 | + if 'return' in result: | ||
29 | + assert result['return'] == {} | ||
30 | + job_result = self.run_job(job_id) | ||
31 | + else: | ||
32 | + job_result = result['error'] | ||
33 | + | ||
34 | + log("") | ||
35 | + return job_result | ||
36 | + | ||
37 | def enable_migration_events(self, name): | ||
38 | log('Enabling migration QMP events on %s...' % name) | ||
39 | log(self.qmp('migrate-set-capabilities', capabilities=[ | ||
40 | -- | ||
41 | 2.20.1 | ||
42 | |||
43 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | blockdev_create() is completely unused in this test case, so we can just | ||
2 | drop it. | ||
3 | 1 | ||
4 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
5 | --- | ||
6 | tests/qemu-iotests/255 | 10 ---------- | ||
7 | 1 file changed, 10 deletions(-) | ||
8 | |||
9 | diff --git a/tests/qemu-iotests/255 b/tests/qemu-iotests/255 | ||
10 | index XXXXXXX..XXXXXXX 100755 | ||
11 | --- a/tests/qemu-iotests/255 | ||
12 | +++ b/tests/qemu-iotests/255 | ||
13 | @@ -XXX,XX +XXX,XX @@ from iotests import imgfmt | ||
14 | |||
15 | iotests.verify_image_format(supported_fmts=['qcow2']) | ||
16 | |||
17 | -def blockdev_create(vm, options): | ||
18 | - result = vm.qmp_log('blockdev-create', | ||
19 | - filters=[iotests.filter_qmp_testfiles], | ||
20 | - job_id='job0', options=options) | ||
21 | - | ||
22 | - if 'return' in result: | ||
23 | - assert result['return'] == {} | ||
24 | - vm.run_job('job0') | ||
25 | - iotests.log("") | ||
26 | - | ||
27 | iotests.log('Finishing a commit job with background reads') | ||
28 | iotests.log('============================================') | ||
29 | iotests.log('') | ||
30 | -- | ||
31 | 2.20.1 | ||
32 | |||
33 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Instead of having a separate blockdev_create() function, make use of the | ||
2 | VM.blockdev_create() offered by iotests.py. | ||
3 | 1 | ||
4 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
5 | --- | ||
6 | tests/qemu-iotests/206 | 232 ++++++++++++++++++++--------------------- | ||
7 | 1 file changed, 111 insertions(+), 121 deletions(-) | ||
8 | |||
9 | diff --git a/tests/qemu-iotests/206 b/tests/qemu-iotests/206 | ||
10 | index XXXXXXX..XXXXXXX 100755 | ||
11 | --- a/tests/qemu-iotests/206 | ||
12 | +++ b/tests/qemu-iotests/206 | ||
13 | @@ -XXX,XX +XXX,XX @@ from iotests import imgfmt | ||
14 | |||
15 | iotests.verify_image_format(supported_fmts=['qcow2']) | ||
16 | |||
17 | -def blockdev_create(vm, options): | ||
18 | - result = vm.qmp_log('blockdev-create', | ||
19 | - filters=[iotests.filter_qmp_testfiles], | ||
20 | - job_id='job0', options=options) | ||
21 | - | ||
22 | - if 'return' in result: | ||
23 | - assert result['return'] == {} | ||
24 | - vm.run_job('job0') | ||
25 | - iotests.log("") | ||
26 | - | ||
27 | with iotests.FilePath('t.qcow2') as disk_path, \ | ||
28 | iotests.FilePath('t.qcow2.base') as backing_path, \ | ||
29 | iotests.VM() as vm: | ||
30 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.qcow2') as disk_path, \ | ||
31 | size = 128 * 1024 * 1024 | ||
32 | |||
33 | vm.launch() | ||
34 | - blockdev_create(vm, { 'driver': 'file', | ||
35 | - 'filename': disk_path, | ||
36 | - 'size': 0 }) | ||
37 | + vm.blockdev_create({ 'driver': 'file', | ||
38 | + 'filename': disk_path, | ||
39 | + 'size': 0 }) | ||
40 | |||
41 | vm.qmp_log('blockdev-add', | ||
42 | filters=[iotests.filter_qmp_testfiles], | ||
43 | driver='file', filename=disk_path, | ||
44 | node_name='imgfile') | ||
45 | |||
46 | - blockdev_create(vm, { 'driver': imgfmt, | ||
47 | - 'file': 'imgfile', | ||
48 | - 'size': size }) | ||
49 | + vm.blockdev_create({ 'driver': imgfmt, | ||
50 | + 'file': 'imgfile', | ||
51 | + 'size': size }) | ||
52 | vm.shutdown() | ||
53 | |||
54 | iotests.img_info_log(disk_path) | ||
55 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.qcow2') as disk_path, \ | ||
56 | size = 64 * 1024 * 1024 | ||
57 | |||
58 | vm.launch() | ||
59 | - blockdev_create(vm, { 'driver': 'file', | ||
60 | - 'filename': disk_path, | ||
61 | - 'size': 0, | ||
62 | - 'preallocation': 'off', | ||
63 | - 'nocow': False }) | ||
64 | - | ||
65 | - blockdev_create(vm, { 'driver': imgfmt, | ||
66 | - 'file': { | ||
67 | - 'driver': 'file', | ||
68 | - 'filename': disk_path, | ||
69 | - }, | ||
70 | - 'size': size, | ||
71 | - 'version': 'v3', | ||
72 | - 'cluster-size': 65536, | ||
73 | - 'preallocation': 'off', | ||
74 | - 'lazy-refcounts': False, | ||
75 | - 'refcount-bits': 16 }) | ||
76 | + vm.blockdev_create({ 'driver': 'file', | ||
77 | + 'filename': disk_path, | ||
78 | + 'size': 0, | ||
79 | + 'preallocation': 'off', | ||
80 | + 'nocow': False }) | ||
81 | + | ||
82 | + vm.blockdev_create({ 'driver': imgfmt, | ||
83 | + 'file': { | ||
84 | + 'driver': 'file', | ||
85 | + 'filename': disk_path, | ||
86 | + }, | ||
87 | + 'size': size, | ||
88 | + 'version': 'v3', | ||
89 | + 'cluster-size': 65536, | ||
90 | + 'preallocation': 'off', | ||
91 | + 'lazy-refcounts': False, | ||
92 | + 'refcount-bits': 16 }) | ||
93 | vm.shutdown() | ||
94 | |||
95 | iotests.img_info_log(disk_path) | ||
96 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.qcow2') as disk_path, \ | ||
97 | size = 32 * 1024 * 1024 | ||
98 | |||
99 | vm.launch() | ||
100 | - blockdev_create(vm, { 'driver': 'file', | ||
101 | - 'filename': disk_path, | ||
102 | - 'size': 0, | ||
103 | - 'preallocation': 'falloc', | ||
104 | - 'nocow': True }) | ||
105 | - | ||
106 | - blockdev_create(vm, { 'driver': imgfmt, | ||
107 | - 'file': { | ||
108 | - 'driver': 'file', | ||
109 | - 'filename': disk_path, | ||
110 | - }, | ||
111 | - 'size': size, | ||
112 | - 'version': 'v3', | ||
113 | - 'cluster-size': 2097152, | ||
114 | - 'preallocation': 'metadata', | ||
115 | - 'lazy-refcounts': True, | ||
116 | - 'refcount-bits': 1 }) | ||
117 | + vm.blockdev_create({ 'driver': 'file', | ||
118 | + 'filename': disk_path, | ||
119 | + 'size': 0, | ||
120 | + 'preallocation': 'falloc', | ||
121 | + 'nocow': True }) | ||
122 | + | ||
123 | + vm.blockdev_create({ 'driver': imgfmt, | ||
124 | + 'file': { | ||
125 | + 'driver': 'file', | ||
126 | + 'filename': disk_path, | ||
127 | + }, | ||
128 | + 'size': size, | ||
129 | + 'version': 'v3', | ||
130 | + 'cluster-size': 2097152, | ||
131 | + 'preallocation': 'metadata', | ||
132 | + 'lazy-refcounts': True, | ||
133 | + 'refcount-bits': 1 }) | ||
134 | vm.shutdown() | ||
135 | |||
136 | iotests.img_info_log(disk_path) | ||
137 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.qcow2') as disk_path, \ | ||
138 | iotests.log("") | ||
139 | |||
140 | vm.launch() | ||
141 | - blockdev_create(vm, { 'driver': 'file', | ||
142 | - 'filename': disk_path, | ||
143 | - 'size': 0 }) | ||
144 | - | ||
145 | - blockdev_create(vm, { 'driver': imgfmt, | ||
146 | - 'file': { | ||
147 | - 'driver': 'file', | ||
148 | - 'filename': disk_path, | ||
149 | - }, | ||
150 | - 'size': size, | ||
151 | - 'backing-file': backing_path, | ||
152 | - 'backing-fmt': 'qcow2', | ||
153 | - 'version': 'v2', | ||
154 | - 'cluster-size': 512 }) | ||
155 | + vm.blockdev_create({ 'driver': 'file', | ||
156 | + 'filename': disk_path, | ||
157 | + 'size': 0 }) | ||
158 | + | ||
159 | + vm.blockdev_create({ 'driver': imgfmt, | ||
160 | + 'file': { | ||
161 | + 'driver': 'file', | ||
162 | + 'filename': disk_path, | ||
163 | + }, | ||
164 | + 'size': size, | ||
165 | + 'backing-file': backing_path, | ||
166 | + 'backing-fmt': 'qcow2', | ||
167 | + 'version': 'v2', | ||
168 | + 'cluster-size': 512 }) | ||
169 | vm.shutdown() | ||
170 | |||
171 | iotests.img_info_log(disk_path) | ||
172 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.qcow2') as disk_path, \ | ||
173 | iotests.log("") | ||
174 | |||
175 | vm.launch() | ||
176 | - blockdev_create(vm, { 'driver': imgfmt, | ||
177 | - 'file': { | ||
178 | - 'driver': 'file', | ||
179 | - 'filename': disk_path, | ||
180 | - }, | ||
181 | - 'size': size, | ||
182 | - 'encrypt': { | ||
183 | - 'format': 'luks', | ||
184 | - 'key-secret': 'keysec0', | ||
185 | - 'cipher-alg': 'twofish-128', | ||
186 | - 'cipher-mode': 'ctr', | ||
187 | - 'ivgen-alg': 'plain64', | ||
188 | - 'ivgen-hash-alg': 'md5', | ||
189 | - 'hash-alg': 'sha1', | ||
190 | - 'iter-time': 10, | ||
191 | - }}) | ||
192 | + vm.blockdev_create({ 'driver': imgfmt, | ||
193 | + 'file': { | ||
194 | + 'driver': 'file', | ||
195 | + 'filename': disk_path, | ||
196 | + }, | ||
197 | + 'size': size, | ||
198 | + 'encrypt': { | ||
199 | + 'format': 'luks', | ||
200 | + 'key-secret': 'keysec0', | ||
201 | + 'cipher-alg': 'twofish-128', | ||
202 | + 'cipher-mode': 'ctr', | ||
203 | + 'ivgen-alg': 'plain64', | ||
204 | + 'ivgen-hash-alg': 'md5', | ||
205 | + 'hash-alg': 'sha1', | ||
206 | + 'iter-time': 10, | ||
207 | + }}) | ||
208 | vm.shutdown() | ||
209 | |||
210 | iotests.img_info_log(disk_path) | ||
211 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.qcow2') as disk_path, \ | ||
212 | iotests.log("") | ||
213 | |||
214 | vm.launch() | ||
215 | - blockdev_create(vm, { 'driver': imgfmt, | ||
216 | - 'file': "this doesn't exist", | ||
217 | - 'size': size }) | ||
218 | + vm.blockdev_create({ 'driver': imgfmt, | ||
219 | + 'file': "this doesn't exist", | ||
220 | + 'size': size }) | ||
221 | vm.shutdown() | ||
222 | |||
223 | # | ||
224 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.qcow2') as disk_path, \ | ||
225 | vm.launch() | ||
226 | for size in [ 1234, 18446744073709551104, 9223372036854775808, | ||
227 | 9223372036854775296 ]: | ||
228 | - blockdev_create(vm, { 'driver': imgfmt, | ||
229 | - 'file': 'node0', | ||
230 | - 'size': size }) | ||
231 | + vm.blockdev_create({ 'driver': imgfmt, | ||
232 | + 'file': 'node0', | ||
233 | + 'size': size }) | ||
234 | vm.shutdown() | ||
235 | |||
236 | # | ||
237 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.qcow2') as disk_path, \ | ||
238 | iotests.log("=== Invalid version ===") | ||
239 | |||
240 | vm.launch() | ||
241 | - blockdev_create(vm, { 'driver': imgfmt, | ||
242 | - 'file': 'node0', | ||
243 | - 'size': 67108864, | ||
244 | - 'version': 'v1' }) | ||
245 | - blockdev_create(vm, { 'driver': imgfmt, | ||
246 | - 'file': 'node0', | ||
247 | - 'size': 67108864, | ||
248 | - 'version': 'v2', | ||
249 | - 'lazy-refcounts': True }) | ||
250 | - blockdev_create(vm, { 'driver': imgfmt, | ||
251 | - 'file': 'node0', | ||
252 | - 'size': 67108864, | ||
253 | - 'version': 'v2', | ||
254 | - 'refcount-bits': 8 }) | ||
255 | + vm.blockdev_create({ 'driver': imgfmt, | ||
256 | + 'file': 'node0', | ||
257 | + 'size': 67108864, | ||
258 | + 'version': 'v1' }) | ||
259 | + vm.blockdev_create({ 'driver': imgfmt, | ||
260 | + 'file': 'node0', | ||
261 | + 'size': 67108864, | ||
262 | + 'version': 'v2', | ||
263 | + 'lazy-refcounts': True }) | ||
264 | + vm.blockdev_create({ 'driver': imgfmt, | ||
265 | + 'file': 'node0', | ||
266 | + 'size': 67108864, | ||
267 | + 'version': 'v2', | ||
268 | + 'refcount-bits': 8 }) | ||
269 | vm.shutdown() | ||
270 | |||
271 | # | ||
272 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.qcow2') as disk_path, \ | ||
273 | iotests.log("=== Invalid backing file options ===") | ||
274 | |||
275 | vm.launch() | ||
276 | - blockdev_create(vm, { 'driver': imgfmt, | ||
277 | - 'file': 'node0', | ||
278 | - 'size': 67108864, | ||
279 | - 'backing-file': '/dev/null', | ||
280 | - 'preallocation': 'full' }) | ||
281 | - blockdev_create(vm, { 'driver': imgfmt, | ||
282 | - 'file': 'node0', | ||
283 | - 'size': 67108864, | ||
284 | - 'backing-fmt': imgfmt }) | ||
285 | + vm.blockdev_create({ 'driver': imgfmt, | ||
286 | + 'file': 'node0', | ||
287 | + 'size': 67108864, | ||
288 | + 'backing-file': '/dev/null', | ||
289 | + 'preallocation': 'full' }) | ||
290 | + vm.blockdev_create({ 'driver': imgfmt, | ||
291 | + 'file': 'node0', | ||
292 | + 'size': 67108864, | ||
293 | + 'backing-fmt': imgfmt }) | ||
294 | vm.shutdown() | ||
295 | |||
296 | # | ||
297 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.qcow2') as disk_path, \ | ||
298 | |||
299 | vm.launch() | ||
300 | for csize in [ 1234, 128, 4194304, 0 ]: | ||
301 | - blockdev_create(vm, { 'driver': imgfmt, | ||
302 | - 'file': 'node0', | ||
303 | - 'size': 67108864, | ||
304 | - 'cluster-size': csize }) | ||
305 | - blockdev_create(vm, { 'driver': imgfmt, | ||
306 | - 'file': 'node0', | ||
307 | - 'size': 281474976710656, | ||
308 | - 'cluster-size': 512 }) | ||
309 | + vm.blockdev_create({ 'driver': imgfmt, | ||
310 | + 'file': 'node0', | ||
311 | + 'size': 67108864, | ||
312 | + 'cluster-size': csize }) | ||
313 | + vm.blockdev_create({ 'driver': imgfmt, | ||
314 | + 'file': 'node0', | ||
315 | + 'size': 281474976710656, | ||
316 | + 'cluster-size': 512 }) | ||
317 | vm.shutdown() | ||
318 | |||
319 | # | ||
320 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.qcow2') as disk_path, \ | ||
321 | |||
322 | vm.launch() | ||
323 | for refcount_bits in [ 128, 0, 7 ]: | ||
324 | - blockdev_create(vm, { 'driver': imgfmt, | ||
325 | - 'file': 'node0', | ||
326 | - 'size': 67108864, | ||
327 | - 'refcount-bits': refcount_bits }) | ||
328 | + vm.blockdev_create({ 'driver': imgfmt, | ||
329 | + 'file': 'node0', | ||
330 | + 'size': 67108864, | ||
331 | + 'refcount-bits': refcount_bits }) | ||
332 | vm.shutdown() | ||
333 | -- | ||
334 | 2.20.1 | ||
335 | |||
336 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Instead of having a separate blockdev_create() function, make use of the | ||
2 | VM.blockdev_create() offered by iotests.py. | ||
3 | 1 | ||
4 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
5 | --- | ||
6 | tests/qemu-iotests/210 | 81 +++++++++++++++++++----------------------- | ||
7 | 1 file changed, 36 insertions(+), 45 deletions(-) | ||
8 | |||
9 | diff --git a/tests/qemu-iotests/210 b/tests/qemu-iotests/210 | ||
10 | index XXXXXXX..XXXXXXX 100755 | ||
11 | --- a/tests/qemu-iotests/210 | ||
12 | +++ b/tests/qemu-iotests/210 | ||
13 | @@ -XXX,XX +XXX,XX @@ from iotests import imgfmt | ||
14 | iotests.verify_image_format(supported_fmts=['luks']) | ||
15 | iotests.verify_protocol(supported=['file']) | ||
16 | |||
17 | -def blockdev_create(vm, options): | ||
18 | - result = vm.qmp_log('blockdev-create', job_id='job0', options=options, | ||
19 | - filters=[iotests.filter_qmp_testfiles]) | ||
20 | - | ||
21 | - if 'return' in result: | ||
22 | - assert result['return'] == {} | ||
23 | - vm.run_job('job0') | ||
24 | - iotests.log("") | ||
25 | - | ||
26 | with iotests.FilePath('t.luks') as disk_path, \ | ||
27 | iotests.VM() as vm: | ||
28 | |||
29 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.luks') as disk_path, \ | ||
30 | size = 128 * 1024 * 1024 | ||
31 | |||
32 | vm.launch() | ||
33 | - blockdev_create(vm, { 'driver': 'file', | ||
34 | - 'filename': disk_path, | ||
35 | - 'size': 0 }) | ||
36 | + vm.blockdev_create({ 'driver': 'file', | ||
37 | + 'filename': disk_path, | ||
38 | + 'size': 0 }) | ||
39 | |||
40 | vm.qmp_log('blockdev-add', driver='file', filename=disk_path, | ||
41 | node_name='imgfile', filters=[iotests.filter_qmp_testfiles]) | ||
42 | |||
43 | - blockdev_create(vm, { 'driver': imgfmt, | ||
44 | - 'file': 'imgfile', | ||
45 | - 'key-secret': 'keysec0', | ||
46 | - 'size': size, | ||
47 | - 'iter-time': 10 }) | ||
48 | + vm.blockdev_create({ 'driver': imgfmt, | ||
49 | + 'file': 'imgfile', | ||
50 | + 'key-secret': 'keysec0', | ||
51 | + 'size': size, | ||
52 | + 'iter-time': 10 }) | ||
53 | vm.shutdown() | ||
54 | |||
55 | # TODO Proper support for images to be used with imgopts and/or protocols | ||
56 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.luks') as disk_path, \ | ||
57 | size = 64 * 1024 * 1024 | ||
58 | |||
59 | vm.launch() | ||
60 | - blockdev_create(vm, { 'driver': 'file', | ||
61 | - 'filename': disk_path, | ||
62 | - 'size': 0 }) | ||
63 | - blockdev_create(vm, { 'driver': imgfmt, | ||
64 | - 'file': { | ||
65 | - 'driver': 'file', | ||
66 | - 'filename': disk_path, | ||
67 | - }, | ||
68 | - 'size': size, | ||
69 | - 'key-secret': 'keysec0', | ||
70 | - 'cipher-alg': 'twofish-128', | ||
71 | - 'cipher-mode': 'ctr', | ||
72 | - 'ivgen-alg': 'plain64', | ||
73 | - 'ivgen-hash-alg': 'md5', | ||
74 | - 'hash-alg': 'sha1', | ||
75 | - 'iter-time': 10 }) | ||
76 | + vm.blockdev_create({ 'driver': 'file', | ||
77 | + 'filename': disk_path, | ||
78 | + 'size': 0 }) | ||
79 | + vm.blockdev_create({ 'driver': imgfmt, | ||
80 | + 'file': { | ||
81 | + 'driver': 'file', | ||
82 | + 'filename': disk_path, | ||
83 | + }, | ||
84 | + 'size': size, | ||
85 | + 'key-secret': 'keysec0', | ||
86 | + 'cipher-alg': 'twofish-128', | ||
87 | + 'cipher-mode': 'ctr', | ||
88 | + 'ivgen-alg': 'plain64', | ||
89 | + 'ivgen-hash-alg': 'md5', | ||
90 | + 'hash-alg': 'sha1', | ||
91 | + 'iter-time': 10 }) | ||
92 | vm.shutdown() | ||
93 | |||
94 | # TODO Proper support for images to be used with imgopts and/or protocols | ||
95 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.luks') as disk_path, \ | ||
96 | size = 64 * 1024 * 1024 | ||
97 | |||
98 | vm.launch() | ||
99 | - blockdev_create(vm, { 'driver': imgfmt, | ||
100 | - 'file': "this doesn't exist", | ||
101 | - 'size': size }) | ||
102 | + vm.blockdev_create({ 'driver': imgfmt, | ||
103 | + 'file': "this doesn't exist", | ||
104 | + 'size': size }) | ||
105 | vm.shutdown() | ||
106 | |||
107 | # | ||
108 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.luks') as disk_path, \ | ||
109 | |||
110 | vm.add_blockdev('driver=file,filename=%s,node-name=node0' % (disk_path)) | ||
111 | vm.launch() | ||
112 | - blockdev_create(vm, { 'driver': imgfmt, | ||
113 | - 'file': 'node0', | ||
114 | - 'key-secret': 'keysec0', | ||
115 | - 'size': 0, | ||
116 | - 'iter-time': 10 }) | ||
117 | + vm.blockdev_create({ 'driver': imgfmt, | ||
118 | + 'file': 'node0', | ||
119 | + 'key-secret': 'keysec0', | ||
120 | + 'size': 0, | ||
121 | + 'iter-time': 10 }) | ||
122 | vm.shutdown() | ||
123 | |||
124 | # TODO Proper support for images to be used with imgopts and/or protocols | ||
125 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.luks') as disk_path, \ | ||
126 | |||
127 | vm.launch() | ||
128 | for size in [ 18446744073709551104, 9223372036854775808, 9223372036854775296 ]: | ||
129 | - blockdev_create(vm, { 'driver': imgfmt, | ||
130 | - 'file': 'node0', | ||
131 | - 'key-secret': 'keysec0', | ||
132 | - 'size': size }) | ||
133 | + vm.blockdev_create({ 'driver': imgfmt, | ||
134 | + 'file': 'node0', | ||
135 | + 'key-secret': 'keysec0', | ||
136 | + 'size': size }) | ||
137 | vm.shutdown() | ||
138 | |||
139 | # | ||
140 | -- | ||
141 | 2.20.1 | ||
142 | |||
143 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Instead of having a separate blockdev_create() function, make use of the | ||
2 | VM.blockdev_create() offered by iotests.py. | ||
3 | 1 | ||
4 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
5 | --- | ||
6 | tests/qemu-iotests/212 | 101 +++++++++++++++++++---------------------- | ||
7 | 1 file changed, 46 insertions(+), 55 deletions(-) | ||
8 | |||
9 | diff --git a/tests/qemu-iotests/212 b/tests/qemu-iotests/212 | ||
10 | index XXXXXXX..XXXXXXX 100755 | ||
11 | --- a/tests/qemu-iotests/212 | ||
12 | +++ b/tests/qemu-iotests/212 | ||
13 | @@ -XXX,XX +XXX,XX @@ from iotests import imgfmt | ||
14 | iotests.verify_image_format(supported_fmts=['parallels']) | ||
15 | iotests.verify_protocol(supported=['file']) | ||
16 | |||
17 | -def blockdev_create(vm, options): | ||
18 | - result = vm.qmp_log('blockdev-create', job_id='job0', options=options, | ||
19 | - filters=[iotests.filter_qmp_testfiles]) | ||
20 | - | ||
21 | - if 'return' in result: | ||
22 | - assert result['return'] == {} | ||
23 | - vm.run_job('job0') | ||
24 | - iotests.log("") | ||
25 | - | ||
26 | with iotests.FilePath('t.parallels') as disk_path, \ | ||
27 | iotests.VM() as vm: | ||
28 | |||
29 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.parallels') as disk_path, \ | ||
30 | size = 128 * 1024 * 1024 | ||
31 | |||
32 | vm.launch() | ||
33 | - blockdev_create(vm, { 'driver': 'file', | ||
34 | - 'filename': disk_path, | ||
35 | - 'size': 0 }) | ||
36 | + vm.blockdev_create({ 'driver': 'file', | ||
37 | + 'filename': disk_path, | ||
38 | + 'size': 0 }) | ||
39 | |||
40 | vm.qmp_log('blockdev-add', driver='file', filename=disk_path, | ||
41 | node_name='imgfile', filters=[iotests.filter_qmp_testfiles]) | ||
42 | |||
43 | - blockdev_create(vm, { 'driver': imgfmt, | ||
44 | - 'file': 'imgfile', | ||
45 | - 'size': size }) | ||
46 | + vm.blockdev_create({ 'driver': imgfmt, | ||
47 | + 'file': 'imgfile', | ||
48 | + 'size': size }) | ||
49 | vm.shutdown() | ||
50 | |||
51 | iotests.img_info_log(disk_path) | ||
52 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.parallels') as disk_path, \ | ||
53 | size = 64 * 1024 * 1024 | ||
54 | |||
55 | vm.launch() | ||
56 | - blockdev_create(vm, { 'driver': 'file', | ||
57 | - 'filename': disk_path, | ||
58 | - 'size': 0 }) | ||
59 | - blockdev_create(vm, { 'driver': imgfmt, | ||
60 | - 'file': { | ||
61 | - 'driver': 'file', | ||
62 | - 'filename': disk_path, | ||
63 | - }, | ||
64 | - 'size': size, | ||
65 | - 'cluster-size': 1048576 }) | ||
66 | + vm.blockdev_create({ 'driver': 'file', | ||
67 | + 'filename': disk_path, | ||
68 | + 'size': 0 }) | ||
69 | + vm.blockdev_create({ 'driver': imgfmt, | ||
70 | + 'file': { | ||
71 | + 'driver': 'file', | ||
72 | + 'filename': disk_path, | ||
73 | + }, | ||
74 | + 'size': size, | ||
75 | + 'cluster-size': 1048576 }) | ||
76 | vm.shutdown() | ||
77 | |||
78 | iotests.img_info_log(disk_path) | ||
79 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.parallels') as disk_path, \ | ||
80 | size = 32 * 1024 * 1024 | ||
81 | |||
82 | vm.launch() | ||
83 | - blockdev_create(vm, { 'driver': 'file', | ||
84 | - 'filename': disk_path, | ||
85 | - 'size': 0 }) | ||
86 | - blockdev_create(vm, { 'driver': imgfmt, | ||
87 | - 'file': { | ||
88 | - 'driver': 'file', | ||
89 | - 'filename': disk_path, | ||
90 | - }, | ||
91 | - 'size': size, | ||
92 | - 'cluster-size': 65536 }) | ||
93 | + vm.blockdev_create({ 'driver': 'file', | ||
94 | + 'filename': disk_path, | ||
95 | + 'size': 0 }) | ||
96 | + vm.blockdev_create({ 'driver': imgfmt, | ||
97 | + 'file': { | ||
98 | + 'driver': 'file', | ||
99 | + 'filename': disk_path, | ||
100 | + }, | ||
101 | + 'size': size, | ||
102 | + 'cluster-size': 65536 }) | ||
103 | vm.shutdown() | ||
104 | |||
105 | iotests.img_info_log(disk_path) | ||
106 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.parallels') as disk_path, \ | ||
107 | iotests.log("") | ||
108 | |||
109 | vm.launch() | ||
110 | - blockdev_create(vm, { 'driver': imgfmt, | ||
111 | - 'file': "this doesn't exist", | ||
112 | - 'size': size }) | ||
113 | + vm.blockdev_create({ 'driver': imgfmt, | ||
114 | + 'file': "this doesn't exist", | ||
115 | + 'size': size }) | ||
116 | vm.shutdown() | ||
117 | |||
118 | # | ||
119 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.parallels') as disk_path, \ | ||
120 | |||
121 | vm.add_blockdev('driver=file,filename=%s,node-name=node0' % (disk_path)) | ||
122 | vm.launch() | ||
123 | - blockdev_create(vm, { 'driver': imgfmt, | ||
124 | - 'file': 'node0', | ||
125 | - 'size': 0 }) | ||
126 | + vm.blockdev_create({ 'driver': imgfmt, | ||
127 | + 'file': 'node0', | ||
128 | + 'size': 0 }) | ||
129 | vm.shutdown() | ||
130 | |||
131 | iotests.img_info_log(disk_path) | ||
132 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.parallels') as disk_path, \ | ||
133 | iotests.log("") | ||
134 | |||
135 | vm.launch() | ||
136 | - blockdev_create(vm, { 'driver': imgfmt, | ||
137 | - 'file': 'node0', | ||
138 | - 'size': 4503599627369984}) | ||
139 | + vm.blockdev_create({ 'driver': imgfmt, | ||
140 | + 'file': 'node0', | ||
141 | + 'size': 4503599627369984}) | ||
142 | vm.shutdown() | ||
143 | |||
144 | iotests.img_info_log(disk_path) | ||
145 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.parallels') as disk_path, \ | ||
146 | vm.launch() | ||
147 | for size in [ 1234, 18446744073709551104, 9223372036854775808, | ||
148 | 9223372036854775296, 4503599627370497 ]: | ||
149 | - blockdev_create(vm, { 'driver': imgfmt, | ||
150 | - 'file': 'node0', | ||
151 | - 'size': size }) | ||
152 | + vm.blockdev_create({ 'driver': imgfmt, | ||
153 | + 'file': 'node0', | ||
154 | + 'size': size }) | ||
155 | vm.shutdown() | ||
156 | |||
157 | # | ||
158 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.parallels') as disk_path, \ | ||
159 | vm.launch() | ||
160 | for csize in [ 1234, 128, 4294967296, 9223372036854775808, | ||
161 | 18446744073709551104, 0 ]: | ||
162 | - blockdev_create(vm, { 'driver': imgfmt, | ||
163 | - 'file': 'node0', | ||
164 | - 'size': 67108864, | ||
165 | - 'cluster-size': csize }) | ||
166 | - blockdev_create(vm, { 'driver': imgfmt, | ||
167 | - 'file': 'node0', | ||
168 | - 'size': 281474976710656, | ||
169 | - 'cluster-size': 512 }) | ||
170 | + vm.blockdev_create({ 'driver': imgfmt, | ||
171 | + 'file': 'node0', | ||
172 | + 'size': 67108864, | ||
173 | + 'cluster-size': csize }) | ||
174 | + vm.blockdev_create({ 'driver': imgfmt, | ||
175 | + 'file': 'node0', | ||
176 | + 'size': 281474976710656, | ||
177 | + 'cluster-size': 512 }) | ||
178 | vm.shutdown() | ||
179 | -- | ||
180 | 2.20.1 | ||
181 | |||
182 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Instead of having a separate blockdev_create() function, make use of the | ||
2 | VM.blockdev_create() offered by iotests.py. | ||
3 | 1 | ||
4 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
5 | --- | ||
6 | tests/qemu-iotests/213 | 113 +++++++++++++++++++---------------------- | ||
7 | 1 file changed, 52 insertions(+), 61 deletions(-) | ||
8 | |||
9 | diff --git a/tests/qemu-iotests/213 b/tests/qemu-iotests/213 | ||
10 | index XXXXXXX..XXXXXXX 100755 | ||
11 | --- a/tests/qemu-iotests/213 | ||
12 | +++ b/tests/qemu-iotests/213 | ||
13 | @@ -XXX,XX +XXX,XX @@ from iotests import imgfmt | ||
14 | iotests.verify_image_format(supported_fmts=['vhdx']) | ||
15 | iotests.verify_protocol(supported=['file']) | ||
16 | |||
17 | -def blockdev_create(vm, options): | ||
18 | - result = vm.qmp_log('blockdev-create', job_id='job0', options=options, | ||
19 | - filters=[iotests.filter_qmp_testfiles]) | ||
20 | - | ||
21 | - if 'return' in result: | ||
22 | - assert result['return'] == {} | ||
23 | - vm.run_job('job0') | ||
24 | - iotests.log("") | ||
25 | - | ||
26 | with iotests.FilePath('t.vhdx') as disk_path, \ | ||
27 | iotests.VM() as vm: | ||
28 | |||
29 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vhdx') as disk_path, \ | ||
30 | size = 128 * 1024 * 1024 | ||
31 | |||
32 | vm.launch() | ||
33 | - blockdev_create(vm, { 'driver': 'file', | ||
34 | - 'filename': disk_path, | ||
35 | - 'size': 0 }) | ||
36 | + vm.blockdev_create({ 'driver': 'file', | ||
37 | + 'filename': disk_path, | ||
38 | + 'size': 0 }) | ||
39 | |||
40 | vm.qmp_log('blockdev-add', driver='file', filename=disk_path, | ||
41 | node_name='imgfile', filters=[iotests.filter_qmp_testfiles]) | ||
42 | |||
43 | - blockdev_create(vm, { 'driver': imgfmt, | ||
44 | - 'file': 'imgfile', | ||
45 | - 'size': size }) | ||
46 | + vm.blockdev_create({ 'driver': imgfmt, | ||
47 | + 'file': 'imgfile', | ||
48 | + 'size': size }) | ||
49 | vm.shutdown() | ||
50 | |||
51 | iotests.img_info_log(disk_path) | ||
52 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vhdx') as disk_path, \ | ||
53 | size = 64 * 1024 * 1024 | ||
54 | |||
55 | vm.launch() | ||
56 | - blockdev_create(vm, { 'driver': 'file', | ||
57 | - 'filename': disk_path, | ||
58 | - 'size': 0 }) | ||
59 | - blockdev_create(vm, { 'driver': imgfmt, | ||
60 | - 'file': { | ||
61 | - 'driver': 'file', | ||
62 | - 'filename': disk_path, | ||
63 | - }, | ||
64 | - 'size': size, | ||
65 | - 'log-size': 1048576, | ||
66 | - 'block-size': 8388608, | ||
67 | - 'subformat': 'dynamic', | ||
68 | - 'block-state-zero': True }) | ||
69 | + vm.blockdev_create({ 'driver': 'file', | ||
70 | + 'filename': disk_path, | ||
71 | + 'size': 0 }) | ||
72 | + vm.blockdev_create({ 'driver': imgfmt, | ||
73 | + 'file': { | ||
74 | + 'driver': 'file', | ||
75 | + 'filename': disk_path, | ||
76 | + }, | ||
77 | + 'size': size, | ||
78 | + 'log-size': 1048576, | ||
79 | + 'block-size': 8388608, | ||
80 | + 'subformat': 'dynamic', | ||
81 | + 'block-state-zero': True }) | ||
82 | vm.shutdown() | ||
83 | |||
84 | iotests.img_info_log(disk_path) | ||
85 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vhdx') as disk_path, \ | ||
86 | size = 32 * 1024 * 1024 | ||
87 | |||
88 | vm.launch() | ||
89 | - blockdev_create(vm, { 'driver': 'file', | ||
90 | - 'filename': disk_path, | ||
91 | - 'size': 0 }) | ||
92 | - blockdev_create(vm, { 'driver': imgfmt, | ||
93 | - 'file': { | ||
94 | - 'driver': 'file', | ||
95 | - 'filename': disk_path, | ||
96 | - }, | ||
97 | - 'size': size, | ||
98 | - 'log-size': 8388608, | ||
99 | - 'block-size': 268435456, | ||
100 | - 'subformat': 'fixed', | ||
101 | - 'block-state-zero': False }) | ||
102 | + vm.blockdev_create({ 'driver': 'file', | ||
103 | + 'filename': disk_path, | ||
104 | + 'size': 0 }) | ||
105 | + vm.blockdev_create({ 'driver': imgfmt, | ||
106 | + 'file': { | ||
107 | + 'driver': 'file', | ||
108 | + 'filename': disk_path, | ||
109 | + }, | ||
110 | + 'size': size, | ||
111 | + 'log-size': 8388608, | ||
112 | + 'block-size': 268435456, | ||
113 | + 'subformat': 'fixed', | ||
114 | + 'block-state-zero': False }) | ||
115 | vm.shutdown() | ||
116 | |||
117 | iotests.img_info_log(disk_path) | ||
118 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vhdx') as disk_path, \ | ||
119 | iotests.log("") | ||
120 | |||
121 | vm.launch() | ||
122 | - blockdev_create(vm, { 'driver': imgfmt, | ||
123 | - 'file': "this doesn't exist", | ||
124 | - 'size': size }) | ||
125 | + vm.blockdev_create({ 'driver': imgfmt, | ||
126 | + 'file': "this doesn't exist", | ||
127 | + 'size': size }) | ||
128 | vm.shutdown() | ||
129 | |||
130 | # | ||
131 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vhdx') as disk_path, \ | ||
132 | |||
133 | vm.add_blockdev('driver=file,filename=%s,node-name=node0' % (disk_path)) | ||
134 | vm.launch() | ||
135 | - blockdev_create(vm, { 'driver': imgfmt, | ||
136 | - 'file': 'node0', | ||
137 | - 'size': 0 }) | ||
138 | + vm.blockdev_create({ 'driver': imgfmt, | ||
139 | + 'file': 'node0', | ||
140 | + 'size': 0 }) | ||
141 | vm.shutdown() | ||
142 | |||
143 | iotests.img_info_log(disk_path) | ||
144 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vhdx') as disk_path, \ | ||
145 | iotests.log("") | ||
146 | |||
147 | vm.launch() | ||
148 | - blockdev_create(vm, { 'driver': imgfmt, | ||
149 | - 'file': 'node0', | ||
150 | - 'size': 70368744177664 }) | ||
151 | + vm.blockdev_create({ 'driver': imgfmt, | ||
152 | + 'file': 'node0', | ||
153 | + 'size': 70368744177664 }) | ||
154 | vm.shutdown() | ||
155 | |||
156 | iotests.img_info_log(disk_path) | ||
157 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vhdx') as disk_path, \ | ||
158 | vm.launch() | ||
159 | for size in [ 18446744073709551104, 9223372036854775808, | ||
160 | 9223372036854775296, 70368744177665 ]: | ||
161 | - blockdev_create(vm, { 'driver': imgfmt, | ||
162 | - 'file': 'node0', | ||
163 | - 'size': size }) | ||
164 | + vm.blockdev_create({ 'driver': imgfmt, | ||
165 | + 'file': 'node0', | ||
166 | + 'size': size }) | ||
167 | vm.shutdown() | ||
168 | |||
169 | # | ||
170 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vhdx') as disk_path, \ | ||
171 | |||
172 | vm.launch() | ||
173 | for bsize in [ 1234567, 128, 3145728, 536870912, 0 ]: | ||
174 | - blockdev_create(vm, { 'driver': imgfmt, | ||
175 | - 'file': 'node0', | ||
176 | - 'size': 67108864, | ||
177 | - 'block-size': bsize }) | ||
178 | + vm.blockdev_create({ 'driver': imgfmt, | ||
179 | + 'file': 'node0', | ||
180 | + 'size': 67108864, | ||
181 | + 'block-size': bsize }) | ||
182 | vm.shutdown() | ||
183 | |||
184 | # | ||
185 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vhdx') as disk_path, \ | ||
186 | |||
187 | vm.launch() | ||
188 | for lsize in [ 1234567, 128, 4294967296, 0 ]: | ||
189 | - blockdev_create(vm, { 'driver': imgfmt, | ||
190 | - 'file': 'node0', | ||
191 | - 'size': 67108864, | ||
192 | - 'log-size': lsize }) | ||
193 | + vm.blockdev_create({ 'driver': imgfmt, | ||
194 | + 'file': 'node0', | ||
195 | + 'size': 67108864, | ||
196 | + 'log-size': lsize }) | ||
197 | vm.shutdown() | ||
198 | -- | ||
199 | 2.20.1 | ||
200 | |||
201 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Instead of having a separate blockdev_create() function, make use of the | ||
2 | VM.blockdev_create() offered by iotests.py. | ||
3 | 1 | ||
4 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
5 | --- | ||
6 | tests/qemu-iotests/237 | 139 +++++++++++++++++++---------------------- | ||
7 | 1 file changed, 65 insertions(+), 74 deletions(-) | ||
8 | |||
9 | diff --git a/tests/qemu-iotests/237 b/tests/qemu-iotests/237 | ||
10 | index XXXXXXX..XXXXXXX 100755 | ||
11 | --- a/tests/qemu-iotests/237 | ||
12 | +++ b/tests/qemu-iotests/237 | ||
13 | @@ -XXX,XX +XXX,XX @@ from iotests import imgfmt | ||
14 | |||
15 | iotests.verify_image_format(supported_fmts=['vmdk']) | ||
16 | |||
17 | -def blockdev_create(vm, options): | ||
18 | - result = vm.qmp_log('blockdev-create', job_id='job0', options=options, | ||
19 | - filters=[iotests.filter_qmp_testfiles]) | ||
20 | - | ||
21 | - if 'return' in result: | ||
22 | - assert result['return'] == {} | ||
23 | - vm.run_job('job0') | ||
24 | - iotests.log("") | ||
25 | - | ||
26 | with iotests.FilePath('t.vmdk') as disk_path, \ | ||
27 | iotests.FilePath('t.vmdk.1') as extent1_path, \ | ||
28 | iotests.FilePath('t.vmdk.2') as extent2_path, \ | ||
29 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vmdk') as disk_path, \ | ||
30 | size = 5 * 1024 * 1024 * 1024 | ||
31 | |||
32 | vm.launch() | ||
33 | - blockdev_create(vm, { 'driver': 'file', | ||
34 | - 'filename': disk_path, | ||
35 | - 'size': 0 }) | ||
36 | + vm.blockdev_create({ 'driver': 'file', | ||
37 | + 'filename': disk_path, | ||
38 | + 'size': 0 }) | ||
39 | |||
40 | vm.qmp_log('blockdev-add', driver='file', filename=disk_path, | ||
41 | node_name='imgfile', filters=[iotests.filter_qmp_testfiles]) | ||
42 | |||
43 | - blockdev_create(vm, { 'driver': imgfmt, | ||
44 | - 'file': 'imgfile', | ||
45 | - 'size': size }) | ||
46 | + vm.blockdev_create({ 'driver': imgfmt, | ||
47 | + 'file': 'imgfile', | ||
48 | + 'size': size }) | ||
49 | vm.shutdown() | ||
50 | |||
51 | iotests.img_info_log(disk_path) | ||
52 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vmdk') as disk_path, \ | ||
53 | size = 64 * 1024 * 1024 | ||
54 | |||
55 | vm.launch() | ||
56 | - blockdev_create(vm, { 'driver': 'file', | ||
57 | - 'filename': disk_path, | ||
58 | - 'size': 0 }) | ||
59 | - | ||
60 | - blockdev_create(vm, { 'driver': imgfmt, | ||
61 | - 'file': { | ||
62 | - 'driver': 'file', | ||
63 | - 'filename': disk_path, | ||
64 | - }, | ||
65 | - 'size': size, | ||
66 | - 'extents': [], | ||
67 | - 'subformat': 'monolithicSparse', | ||
68 | - 'adapter-type': 'ide', | ||
69 | - 'hwversion': '4', | ||
70 | - 'zeroed-grain': False }) | ||
71 | + vm.blockdev_create({ 'driver': 'file', | ||
72 | + 'filename': disk_path, | ||
73 | + 'size': 0 }) | ||
74 | + | ||
75 | + vm.blockdev_create({ 'driver': imgfmt, | ||
76 | + 'file': { | ||
77 | + 'driver': 'file', | ||
78 | + 'filename': disk_path, | ||
79 | + }, | ||
80 | + 'size': size, | ||
81 | + 'extents': [], | ||
82 | + 'subformat': 'monolithicSparse', | ||
83 | + 'adapter-type': 'ide', | ||
84 | + 'hwversion': '4', | ||
85 | + 'zeroed-grain': False }) | ||
86 | vm.shutdown() | ||
87 | |||
88 | iotests.img_info_log(disk_path) | ||
89 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vmdk') as disk_path, \ | ||
90 | size = 32 * 1024 * 1024 | ||
91 | |||
92 | vm.launch() | ||
93 | - blockdev_create(vm, { 'driver': 'file', | ||
94 | - 'filename': disk_path, | ||
95 | - 'size': 0 }) | ||
96 | - | ||
97 | - blockdev_create(vm, { 'driver': imgfmt, | ||
98 | - 'file': { | ||
99 | - 'driver': 'file', | ||
100 | - 'filename': disk_path, | ||
101 | - }, | ||
102 | - 'size': size, | ||
103 | - 'extents': [], | ||
104 | - 'subformat': 'monolithicSparse', | ||
105 | - 'adapter-type': 'buslogic', | ||
106 | - 'zeroed-grain': True }) | ||
107 | + vm.blockdev_create({ 'driver': 'file', | ||
108 | + 'filename': disk_path, | ||
109 | + 'size': 0 }) | ||
110 | + | ||
111 | + vm.blockdev_create({ 'driver': imgfmt, | ||
112 | + 'file': { | ||
113 | + 'driver': 'file', | ||
114 | + 'filename': disk_path, | ||
115 | + }, | ||
116 | + 'size': size, | ||
117 | + 'extents': [], | ||
118 | + 'subformat': 'monolithicSparse', | ||
119 | + 'adapter-type': 'buslogic', | ||
120 | + 'zeroed-grain': True }) | ||
121 | vm.shutdown() | ||
122 | |||
123 | iotests.img_info_log(disk_path) | ||
124 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vmdk') as disk_path, \ | ||
125 | iotests.log("") | ||
126 | |||
127 | vm.launch() | ||
128 | - blockdev_create(vm, { 'driver': imgfmt, | ||
129 | - 'file': "this doesn't exist", | ||
130 | - 'size': size }) | ||
131 | + vm.blockdev_create({ 'driver': imgfmt, | ||
132 | + 'file': "this doesn't exist", | ||
133 | + 'size': size }) | ||
134 | vm.shutdown() | ||
135 | |||
136 | # | ||
137 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vmdk') as disk_path, \ | ||
138 | |||
139 | vm.launch() | ||
140 | for adapter_type in [ 'ide', 'buslogic', 'lsilogic', 'legacyESX' ]: | ||
141 | - blockdev_create(vm, { 'driver': imgfmt, | ||
142 | - 'file': 'node0', | ||
143 | - 'size': size, | ||
144 | - 'adapter-type': adapter_type }) | ||
145 | + vm.blockdev_create({ 'driver': imgfmt, | ||
146 | + 'file': 'node0', | ||
147 | + 'size': size, | ||
148 | + 'adapter-type': adapter_type }) | ||
149 | vm.shutdown() | ||
150 | |||
151 | # Invalid | ||
152 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vmdk') as disk_path, \ | ||
153 | |||
154 | vm.launch() | ||
155 | for adapter_type in [ 'foo', 'IDE', 'legacyesx', 1 ]: | ||
156 | - blockdev_create(vm, { 'driver': imgfmt, | ||
157 | - 'file': 'node0', | ||
158 | - 'size': size, | ||
159 | - 'adapter-type': adapter_type }) | ||
160 | + vm.blockdev_create({ 'driver': imgfmt, | ||
161 | + 'file': 'node0', | ||
162 | + 'size': size, | ||
163 | + 'adapter-type': adapter_type }) | ||
164 | vm.shutdown() | ||
165 | |||
166 | # | ||
167 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vmdk') as disk_path, \ | ||
168 | iotests.log("") | ||
169 | |||
170 | vm.launch() | ||
171 | - blockdev_create(vm, { 'driver': imgfmt, | ||
172 | - 'file': 'node0', | ||
173 | - 'size': size, | ||
174 | - 'subformat': 'monolithicFlat' }) | ||
175 | + vm.blockdev_create({ 'driver': imgfmt, | ||
176 | + 'file': 'node0', | ||
177 | + 'size': size, | ||
178 | + 'subformat': 'monolithicFlat' }) | ||
179 | vm.shutdown() | ||
180 | |||
181 | # Correct extent | ||
182 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vmdk') as disk_path, \ | ||
183 | iotests.log("") | ||
184 | |||
185 | vm.launch() | ||
186 | - blockdev_create(vm, { 'driver': imgfmt, | ||
187 | - 'file': 'node0', | ||
188 | - 'size': size, | ||
189 | - 'subformat': 'monolithicFlat', | ||
190 | - 'extents': ['ext1'] }) | ||
191 | + vm.blockdev_create({ 'driver': imgfmt, | ||
192 | + 'file': 'node0', | ||
193 | + 'size': size, | ||
194 | + 'subformat': 'monolithicFlat', | ||
195 | + 'extents': ['ext1'] }) | ||
196 | vm.shutdown() | ||
197 | |||
198 | # Extra extent | ||
199 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vmdk') as disk_path, \ | ||
200 | iotests.log("") | ||
201 | |||
202 | vm.launch() | ||
203 | - blockdev_create(vm, { 'driver': imgfmt, | ||
204 | - 'file': 'node0', | ||
205 | - 'size': 512, | ||
206 | - 'subformat': 'monolithicFlat', | ||
207 | - 'extents': ['ext1', 'ext2', 'ext3'] }) | ||
208 | + vm.blockdev_create({ 'driver': imgfmt, | ||
209 | + 'file': 'node0', | ||
210 | + 'size': 512, | ||
211 | + 'subformat': 'monolithicFlat', | ||
212 | + 'extents': ['ext1', 'ext2', 'ext3'] }) | ||
213 | vm.shutdown() | ||
214 | |||
215 | # Split formats | ||
216 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.vmdk') as disk_path, \ | ||
217 | extents = [ "ext%d" % (i) for i in range(1, num_extents + 1) ] | ||
218 | |||
219 | vm.launch() | ||
220 | - blockdev_create(vm, { 'driver': imgfmt, | ||
221 | - 'file': 'node0', | ||
222 | - 'size': size, | ||
223 | - 'subformat': subfmt, | ||
224 | - 'extents': extents }) | ||
225 | + vm.blockdev_create({ 'driver': imgfmt, | ||
226 | + 'file': 'node0', | ||
227 | + 'size': size, | ||
228 | + 'subformat': subfmt, | ||
229 | + 'extents': extents }) | ||
230 | vm.shutdown() | ||
231 | |||
232 | iotests.img_info_log(disk_path) | ||
233 | -- | ||
234 | 2.20.1 | ||
235 | |||
236 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Instead of having a separate blockdev_create() function, make use of the | ||
2 | VM.blockdev_create() offered by iotests.py. | ||
3 | 1 | ||
4 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
5 | --- | ||
6 | tests/qemu-iotests/266 | 69 +++++++++++++++++--------------------- | ||
7 | tests/qemu-iotests/266.out | 14 ++++++++ | ||
8 | 2 files changed, 44 insertions(+), 39 deletions(-) | ||
9 | |||
10 | diff --git a/tests/qemu-iotests/266 b/tests/qemu-iotests/266 | ||
11 | index XXXXXXX..XXXXXXX 100755 | ||
12 | --- a/tests/qemu-iotests/266 | ||
13 | +++ b/tests/qemu-iotests/266 | ||
14 | @@ -XXX,XX +XXX,XX @@ import iotests | ||
15 | from iotests import imgfmt | ||
16 | |||
17 | |||
18 | -def blockdev_create(vm, options): | ||
19 | - result = vm.qmp_log('blockdev-create', job_id='job0', options=options, | ||
20 | - filters=[iotests.filter_qmp_testfiles]) | ||
21 | - | ||
22 | - if 'return' in result: | ||
23 | - assert result['return'] == {} | ||
24 | - vm.run_job('job0') | ||
25 | - | ||
26 | - | ||
27 | # Successful image creation (defaults) | ||
28 | def implicit_defaults(vm, file_path): | ||
29 | iotests.log("=== Successful image creation (defaults) ===") | ||
30 | @@ -XXX,XX +XXX,XX @@ def implicit_defaults(vm, file_path): | ||
31 | # (Close to 64 MB) | ||
32 | size = 8 * 964 * 17 * 512 | ||
33 | |||
34 | - blockdev_create(vm, { 'driver': imgfmt, | ||
35 | - 'file': 'protocol-node', | ||
36 | - 'size': size }) | ||
37 | + vm.blockdev_create({ 'driver': imgfmt, | ||
38 | + 'file': 'protocol-node', | ||
39 | + 'size': size }) | ||
40 | |||
41 | |||
42 | # Successful image creation (explicit defaults) | ||
43 | @@ -XXX,XX +XXX,XX @@ def explicit_defaults(vm, file_path): | ||
44 | # (Close to 128 MB) | ||
45 | size = 16 * 964 * 17 * 512 | ||
46 | |||
47 | - blockdev_create(vm, { 'driver': imgfmt, | ||
48 | - 'file': 'protocol-node', | ||
49 | - 'size': size, | ||
50 | - 'subformat': 'dynamic', | ||
51 | - 'force-size': False }) | ||
52 | + vm.blockdev_create({ 'driver': imgfmt, | ||
53 | + 'file': 'protocol-node', | ||
54 | + 'size': size, | ||
55 | + 'subformat': 'dynamic', | ||
56 | + 'force-size': False }) | ||
57 | |||
58 | |||
59 | # Successful image creation (non-default options) | ||
60 | @@ -XXX,XX +XXX,XX @@ def non_defaults(vm, file_path): | ||
61 | # Not representable in CHS (fine with force-size=True) | ||
62 | size = 1048576 | ||
63 | |||
64 | - blockdev_create(vm, { 'driver': imgfmt, | ||
65 | - 'file': 'protocol-node', | ||
66 | - 'size': size, | ||
67 | - 'subformat': 'fixed', | ||
68 | - 'force-size': True }) | ||
69 | + vm.blockdev_create({ 'driver': imgfmt, | ||
70 | + 'file': 'protocol-node', | ||
71 | + 'size': size, | ||
72 | + 'subformat': 'fixed', | ||
73 | + 'force-size': True }) | ||
74 | |||
75 | |||
76 | # Size not representable in CHS with force-size=False | ||
77 | @@ -XXX,XX +XXX,XX @@ def non_chs_size_without_force(vm, file_path): | ||
78 | # Not representable in CHS (will not work with force-size=False) | ||
79 | size = 1048576 | ||
80 | |||
81 | - blockdev_create(vm, { 'driver': imgfmt, | ||
82 | - 'file': 'protocol-node', | ||
83 | - 'size': size, | ||
84 | - 'force-size': False }) | ||
85 | + vm.blockdev_create({ 'driver': imgfmt, | ||
86 | + 'file': 'protocol-node', | ||
87 | + 'size': size, | ||
88 | + 'force-size': False }) | ||
89 | |||
90 | |||
91 | # Zero size | ||
92 | @@ -XXX,XX +XXX,XX @@ def zero_size(vm, file_path): | ||
93 | iotests.log("=== Zero size===") | ||
94 | iotests.log("") | ||
95 | |||
96 | - blockdev_create(vm, { 'driver': imgfmt, | ||
97 | - 'file': 'protocol-node', | ||
98 | - 'size': 0 }) | ||
99 | + vm.blockdev_create({ 'driver': imgfmt, | ||
100 | + 'file': 'protocol-node', | ||
101 | + 'size': 0 }) | ||
102 | |||
103 | |||
104 | # Maximum CHS size | ||
105 | @@ -XXX,XX +XXX,XX @@ def maximum_chs_size(vm, file_path): | ||
106 | iotests.log("=== Maximum CHS size===") | ||
107 | iotests.log("") | ||
108 | |||
109 | - blockdev_create(vm, { 'driver': imgfmt, | ||
110 | - 'file': 'protocol-node', | ||
111 | - 'size': 16 * 65535 * 255 * 512 }) | ||
112 | + vm.blockdev_create({ 'driver': imgfmt, | ||
113 | + 'file': 'protocol-node', | ||
114 | + 'size': 16 * 65535 * 255 * 512 }) | ||
115 | |||
116 | |||
117 | # Actual maximum size | ||
118 | @@ -XXX,XX +XXX,XX @@ def maximum_size(vm, file_path): | ||
119 | iotests.log("=== Actual maximum size===") | ||
120 | iotests.log("") | ||
121 | |||
122 | - blockdev_create(vm, { 'driver': imgfmt, | ||
123 | - 'file': 'protocol-node', | ||
124 | - 'size': 0xff000000 * 512, | ||
125 | - 'force-size': True }) | ||
126 | + vm.blockdev_create({ 'driver': imgfmt, | ||
127 | + 'file': 'protocol-node', | ||
128 | + 'size': 0xff000000 * 512, | ||
129 | + 'force-size': True }) | ||
130 | |||
131 | |||
132 | def main(): | ||
133 | @@ -XXX,XX +XXX,XX @@ def main(): | ||
134 | vm.launch() | ||
135 | |||
136 | iotests.log('--- Creating empty file ---') | ||
137 | - blockdev_create(vm, { 'driver': 'file', | ||
138 | - 'filename': file_path, | ||
139 | - 'size': 0 }) | ||
140 | + vm.blockdev_create({ 'driver': 'file', | ||
141 | + 'filename': file_path, | ||
142 | + 'size': 0 }) | ||
143 | |||
144 | vm.qmp_log('blockdev-add', driver='file', filename=file_path, | ||
145 | node_name='protocol-node', | ||
146 | diff --git a/tests/qemu-iotests/266.out b/tests/qemu-iotests/266.out | ||
147 | index XXXXXXX..XXXXXXX 100644 | ||
148 | --- a/tests/qemu-iotests/266.out | ||
149 | +++ b/tests/qemu-iotests/266.out | ||
150 | @@ -XXX,XX +XXX,XX @@ | ||
151 | {"return": {}} | ||
152 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
153 | {"return": {}} | ||
154 | + | ||
155 | {"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}} | ||
156 | {"return": {}} | ||
157 | |||
158 | @@ -XXX,XX +XXX,XX @@ | ||
159 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
160 | {"return": {}} | ||
161 | |||
162 | + | ||
163 | image: TEST_IMG | ||
164 | file format: IMGFMT | ||
165 | virtual size: 64 MiB (67125248 bytes) | ||
166 | @@ -XXX,XX +XXX,XX @@ cluster_size: 2097152 | ||
167 | {"return": {}} | ||
168 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
169 | {"return": {}} | ||
170 | + | ||
171 | {"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}} | ||
172 | {"return": {}} | ||
173 | |||
174 | @@ -XXX,XX +XXX,XX @@ cluster_size: 2097152 | ||
175 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
176 | {"return": {}} | ||
177 | |||
178 | + | ||
179 | image: TEST_IMG | ||
180 | file format: IMGFMT | ||
181 | virtual size: 128 MiB (134250496 bytes) | ||
182 | @@ -XXX,XX +XXX,XX @@ cluster_size: 2097152 | ||
183 | {"return": {}} | ||
184 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
185 | {"return": {}} | ||
186 | + | ||
187 | {"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}} | ||
188 | {"return": {}} | ||
189 | |||
190 | @@ -XXX,XX +XXX,XX @@ cluster_size: 2097152 | ||
191 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
192 | {"return": {}} | ||
193 | |||
194 | + | ||
195 | image: TEST_IMG | ||
196 | file format: IMGFMT | ||
197 | virtual size: 1 MiB (1048576 bytes) | ||
198 | @@ -XXX,XX +XXX,XX @@ virtual size: 1 MiB (1048576 bytes) | ||
199 | {"return": {}} | ||
200 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
201 | {"return": {}} | ||
202 | + | ||
203 | {"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}} | ||
204 | {"return": {}} | ||
205 | |||
206 | @@ -XXX,XX +XXX,XX @@ Job failed: The requested image size cannot be represented in CHS geometry | ||
207 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
208 | {"return": {}} | ||
209 | |||
210 | + | ||
211 | qemu-img: Could not open 'TEST_IMG': File too small for a VHD header | ||
212 | |||
213 | --- Creating empty file --- | ||
214 | @@ -XXX,XX +XXX,XX @@ qemu-img: Could not open 'TEST_IMG': File too small for a VHD header | ||
215 | {"return": {}} | ||
216 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
217 | {"return": {}} | ||
218 | + | ||
219 | {"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}} | ||
220 | {"return": {}} | ||
221 | |||
222 | @@ -XXX,XX +XXX,XX @@ qemu-img: Could not open 'TEST_IMG': File too small for a VHD header | ||
223 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
224 | {"return": {}} | ||
225 | |||
226 | + | ||
227 | image: TEST_IMG | ||
228 | file format: IMGFMT | ||
229 | virtual size: 0 B (0 bytes) | ||
230 | @@ -XXX,XX +XXX,XX @@ cluster_size: 2097152 | ||
231 | {"return": {}} | ||
232 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
233 | {"return": {}} | ||
234 | + | ||
235 | {"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}} | ||
236 | {"return": {}} | ||
237 | |||
238 | @@ -XXX,XX +XXX,XX @@ cluster_size: 2097152 | ||
239 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
240 | {"return": {}} | ||
241 | |||
242 | + | ||
243 | image: TEST_IMG | ||
244 | file format: IMGFMT | ||
245 | virtual size: 127 GiB (136899993600 bytes) | ||
246 | @@ -XXX,XX +XXX,XX @@ cluster_size: 2097152 | ||
247 | {"return": {}} | ||
248 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
249 | {"return": {}} | ||
250 | + | ||
251 | {"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}} | ||
252 | {"return": {}} | ||
253 | |||
254 | @@ -XXX,XX +XXX,XX @@ cluster_size: 2097152 | ||
255 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
256 | {"return": {}} | ||
257 | |||
258 | + | ||
259 | image: TEST_IMG | ||
260 | file format: IMGFMT | ||
261 | virtual size: 1.99 TiB (2190433320960 bytes) | ||
262 | -- | ||
263 | 2.20.1 | ||
264 | |||
265 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The blockdev_create() function in this test case adds another filter to | ||
2 | the logging, but provides otherwise the same functionality as | ||
3 | VM.blockdev_create() from iotests.py. Make it a thin wrapper around the | ||
4 | iotests.py function. | ||
5 | 1 | ||
6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
7 | --- | ||
8 | tests/qemu-iotests/207 | 8 +------- | ||
9 | 1 file changed, 1 insertion(+), 7 deletions(-) | ||
10 | |||
11 | diff --git a/tests/qemu-iotests/207 b/tests/qemu-iotests/207 | ||
12 | index XXXXXXX..XXXXXXX 100755 | ||
13 | --- a/tests/qemu-iotests/207 | ||
14 | +++ b/tests/qemu-iotests/207 | ||
15 | @@ -XXX,XX +XXX,XX @@ def filter_hash(qmsg): | ||
16 | return iotests.filter_qmp(qmsg, _filter) | ||
17 | |||
18 | def blockdev_create(vm, options): | ||
19 | - result = vm.qmp_log('blockdev-create', job_id='job0', options=options, | ||
20 | - filters=[iotests.filter_qmp_testfiles, filter_hash]) | ||
21 | - | ||
22 | - if 'return' in result: | ||
23 | - assert result['return'] == {} | ||
24 | - vm.run_job('job0') | ||
25 | - iotests.log("") | ||
26 | + vm.blockdev_create(options, filters=[iotests.filter_qmp_testfiles, filter_hash]) | ||
27 | |||
28 | with iotests.FilePath('t.img') as disk_path, \ | ||
29 | iotests.VM() as vm: | ||
30 | -- | ||
31 | 2.20.1 | ||
32 | |||
33 | diff view generated by jsdifflib |
1 | The blockdev_create() function in this test case adds an error check | 1 | From: Emanuele Giuseppe Esposito <eesposit@redhat.com> |
---|---|---|---|
2 | that skips the test in case of failure because of memory shortage, but | ||
3 | provides otherwise the same functionality as VM.blockdev_create() from | ||
4 | iotests.py. Make it a thin wrapper around the iotests.py function. | ||
5 | 2 | ||
3 | If we go directly to GLOBAL_STATE_CODE, IO_CODE or IO_OR_GS_CODE | ||
4 | definition, we just find that they "mark and check that the function | ||
5 | is part of the {category} API". | ||
6 | However, ther is no definition on what {category} API is, they are | ||
7 | in include/block/block-*.h | ||
8 | Therefore, add a comment that refers to such documentation. | ||
9 | |||
10 | Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> | ||
11 | Message-Id: <20220609122206.1016936-1-eesposit@redhat.com> | ||
12 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 13 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
7 | --- | 14 | --- |
8 | tests/qemu-iotests/211 | 12 +++--------- | 15 | include/qemu/main-loop.h | 18 +++++++++++++++--- |
9 | 1 file changed, 3 insertions(+), 9 deletions(-) | 16 | 1 file changed, 15 insertions(+), 3 deletions(-) |
10 | 17 | ||
11 | diff --git a/tests/qemu-iotests/211 b/tests/qemu-iotests/211 | 18 | diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h |
12 | index XXXXXXX..XXXXXXX 100755 | 19 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/tests/qemu-iotests/211 | 20 | --- a/include/qemu/main-loop.h |
14 | +++ b/tests/qemu-iotests/211 | 21 | +++ b/include/qemu/main-loop.h |
15 | @@ -XXX,XX +XXX,XX @@ iotests.verify_image_format(supported_fmts=['vdi']) | 22 | @@ -XXX,XX +XXX,XX @@ bool qemu_mutex_iothread_locked(void); |
16 | iotests.verify_protocol(supported=['file']) | 23 | */ |
17 | 24 | bool qemu_in_main_thread(void); | |
18 | def blockdev_create(vm, options): | 25 | |
19 | - result = vm.qmp_log('blockdev-create', job_id='job0', options=options, | 26 | -/* Mark and check that the function is part of the global state API. */ |
20 | - filters=[iotests.filter_qmp_testfiles]) | 27 | +/* |
21 | - | 28 | + * Mark and check that the function is part of the Global State API. |
22 | - if 'return' in result: | 29 | + * Please refer to include/block/block-global-state.h for more |
23 | - assert result['return'] == {} | 30 | + * information about GS API. |
24 | - error = vm.run_job('job0') | 31 | + */ |
25 | - if error and 'Could not allocate bmap' in error: | 32 | #ifdef CONFIG_COCOA |
26 | - iotests.notrun('Insufficient memory') | 33 | /* |
27 | - iotests.log("") | 34 | * When using the Cocoa UI, addRemovableDevicesMenuItems() is called from |
28 | + error = vm.blockdev_create(options) | 35 | @@ -XXX,XX +XXX,XX @@ bool qemu_in_main_thread(void); |
29 | + if error and 'Could not allocate bmap' in error: | 36 | } while (0) |
30 | + iotests.notrun('Insufficient memory') | 37 | #endif /* CONFIG_COCOA */ |
31 | 38 | ||
32 | with iotests.FilePath('t.vdi') as disk_path, \ | 39 | -/* Mark and check that the function is part of the I/O API. */ |
33 | iotests.VM() as vm: | 40 | +/* |
41 | + * Mark and check that the function is part of the I/O API. | ||
42 | + * Please refer to include/block/block-io.h for more | ||
43 | + * information about IO API. | ||
44 | + */ | ||
45 | #define IO_CODE() \ | ||
46 | do { \ | ||
47 | /* nop */ \ | ||
48 | } while (0) | ||
49 | |||
50 | -/* Mark and check that the function is part of the "I/O OR GS" API. */ | ||
51 | +/* | ||
52 | + * Mark and check that the function is part of the "I/O OR GS" API. | ||
53 | + * Please refer to include/block/block-io.h for more | ||
54 | + * information about "IO or GS" API. | ||
55 | + */ | ||
56 | #define IO_OR_GS_CODE() \ | ||
57 | do { \ | ||
58 | /* nop */ \ | ||
34 | -- | 59 | -- |
35 | 2.20.1 | 60 | 2.35.3 |
36 | |||
37 | diff view generated by jsdifflib |