1 | The following changes since commit b2f7a038bb4c4fc5ce6b8486e8513dfd97665e2a: | 1 | The following changes since commit 22d96eac64877c4d96f9928babb6f2fcc68faacf: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/rth/tags/pull-softfloat-20181104' into staging (2018-11-05 10:32:49 +0000) | 3 | Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging (2019-04-29 19:11:15 +0100) |
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 1240ac558d348f6c7a5752b1a57c1da58e4efe3e: | 9 | for you to fetch changes up to 54277a2aab876aba7b55c7e88e2b372691849741: |
10 | 10 | ||
11 | include: Add a comment to explain the origin of sizes' lookup table (2018-11-05 15:29:59 +0100) | 11 | block/qed: add missed coroutine_fn markers (2019-04-30 15:29:00 +0200) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Block layer patches: | 14 | Block layer patches: |
15 | 15 | ||
16 | - auto-read-only option to fix commit job when used with -blockdev | 16 | - iotests: Fix output of qemu-io related tests |
17 | - Fix help text related qemu-iotests failure (by improving the help text | 17 | - Don't ignore bdrv_set_aio_context() for nodes with bs->drv = NUL |
18 | and updating the reference output) | 18 | - vmdk: Set vmdk parent backing_format to vmdk |
19 | - quorum: Add missing checks when adding/removing child nodes | 19 | - qcow2: Preallocation fixes (especially for external data files) |
20 | - Don't take address of fields in packed structs | 20 | - Add linear-buffer-based APIs (as wrappers around qiov-based ones) |
21 | - vvfat: Fix crash when reporting error about too many files in directory | 21 | - Various code cleanups and small corner case fixes |
22 | 22 | ||
23 | ---------------------------------------------------------------- | 23 | ---------------------------------------------------------------- |
24 | Alberto Garcia (7): | 24 | Alberto Garcia (3): |
25 | block: replace "discard" literal with BDRV_OPT_DISCARD macro | 25 | qcow2: Fix error handling in the compression code |
26 | qcow2: Get the request alignment for encrypted images from QCryptoBlock | 26 | commit: Make base read-only if there is an early failure |
27 | quorum: Remove quorum_err() | 27 | iotests: Check that images are in read-only mode after block-commit |
28 | quorum: Return an error if the blkverify mode has invalid settings | ||
29 | iotest: Test the blkverify mode of the Quorum driver | ||
30 | quorum: Forbid adding children in blkverify mode | ||
31 | iotest: Test x-blockdev-change on a Quorum | ||
32 | 28 | ||
33 | Cleber Rosa (1): | 29 | Eric Blake (2): |
34 | iotests: make 083 specific to raw | 30 | cutils: Fix size_to_str() on 32-bit platforms |
31 | qemu-img: Saner printing of large file sizes | ||
35 | 32 | ||
36 | Daniel P. Berrangé (1): | 33 | Kevin Wolf (5): |
37 | crypto: initialize sector size even when opening with no IO flag | 34 | block: Fix AioContext switch for bs->drv == NULL |
35 | qcow2: Avoid COW during metadata preallocation | ||
36 | qcow2: Add errp to preallocate_co() | ||
37 | qcow2: Fix full preallocation with external data file | ||
38 | qcow2: Fix qcow2_make_empty() with external data file | ||
38 | 39 | ||
39 | Kevin Wolf (12): | 40 | Max Reitz (2): |
40 | vpc: Don't leak opts in vpc_open() | 41 | iotests: Perform the correct test in 082 |
41 | block: Update flags in bdrv_set_read_only() | 42 | qemu-img: Make create hint at protocol options |
42 | block: Add auto-read-only option | ||
43 | rbd: Close image in qemu_rbd_open() error path | ||
44 | block: Require auto-read-only for existing fallbacks | ||
45 | nbd: Support auto-read-only option | ||
46 | file-posix: Support auto-read-only option | ||
47 | curl: Support auto-read-only option | ||
48 | gluster: Support auto-read-only option | ||
49 | iscsi: Support auto-read-only option | ||
50 | block: Make auto-read-only=on default for -drive | ||
51 | qemu-iotests: Test auto-read-only with -drive and -blockdev | ||
52 | 43 | ||
53 | Leonid Bloch (2): | 44 | Sam Eiderman (1): |
54 | vdi: Use a literal number of bytes for DEFAULT_CLUSTER_SIZE | 45 | vmdk: Set vmdk parent backing_format to vmdk |
55 | include: Add a comment to explain the origin of sizes' lookup table | ||
56 | 46 | ||
57 | Li Qiang (1): | 47 | Stefano Garzarella (2): |
58 | block: change some function return type to bool | 48 | block/vhdx: Remove redundant IEC binary prefixes definition |
59 | 49 | block/vhdx: Use IEC binary prefixes for size constants | |
60 | Max Reitz (5): | ||
61 | option: Make option help nicer to read | ||
62 | chardev: Indent list of chardevs | ||
63 | qdev-monitor: Make device options help nicer | ||
64 | object: Make option help nicer to read | ||
65 | fw_cfg: Drop newline in @file description | ||
66 | |||
67 | Peter Maydell (5): | ||
68 | block/qcow2: Don't take address of fields in packed structs | ||
69 | block/qcow: Don't take address of fields in packed structs | ||
70 | block/qcow2-bitmap: Don't take address of fields in packed structs | ||
71 | block/vhdx: Don't take address of fields in packed structs | ||
72 | block/vdi: Don't take address of fields in packed structs | ||
73 | |||
74 | Stefan Weil (1): | ||
75 | qemu-io-cmds: Fix two format strings | ||
76 | 50 | ||
77 | Thomas Huth (1): | 51 | Thomas Huth (1): |
78 | block/vvfat: Fix crash when reporting error about too many files in directory | 52 | tests/qemu-iotests: Fix output of qemu-io related tests |
79 | 53 | ||
80 | qapi/block-core.json | 7 + | 54 | Vladimir Sementsov-Ogievskiy (10): |
81 | block/vhdx.h | 12 +- | 55 | block: introduce byte-based io helpers |
82 | include/block/block.h | 5 +- | 56 | block/qcow2: use buffer-based io |
83 | include/qemu/option.h | 2 +- | 57 | block/qcow: use buffer-based io |
84 | include/qemu/units.h | 18 + | 58 | block/qed: use buffer-based io |
85 | include/sysemu/block-backend.h | 6 +- | 59 | block/parallels: use buffer-based io |
86 | block.c | 60 ++- | 60 | block/backup: use buffer-based io |
87 | block/block-backend.c | 8 +- | 61 | block/commit: use buffer-based io |
88 | block/bochs.c | 17 +- | 62 | block/stream: use buffer-based io |
89 | block/cloop.c | 16 +- | 63 | qemu-img: use buffer-based io |
90 | block/curl.c | 8 +- | 64 | block/qed: add missed coroutine_fn markers |
91 | block/dmg.c | 16 +- | 65 | |
92 | block/file-posix.c | 19 +- | 66 | Zhengui li (1): |
93 | block/gluster.c | 12 +- | 67 | vpc: unlock Coroutine lock to make IO submit Concurrently |
94 | block/iscsi.c | 8 +- | 68 | |
95 | block/nbd-client.c | 10 +- | 69 | block/qed.h | 28 ++++--- |
96 | block/qcow.c | 18 +- | 70 | block/vhdx.h | 16 ++-- |
97 | block/qcow2-bitmap.c | 24 +- | 71 | include/block/block_int.h | 16 ++++ |
98 | block/qcow2.c | 66 +-- | 72 | include/sysemu/block-backend.h | 19 +++++ |
99 | block/quorum.c | 45 +- | 73 | block.c | 12 +-- |
100 | block/rbd.c | 14 +- | 74 | block/backup.c | 14 ++-- |
101 | block/vdi.c | 68 +-- | 75 | block/commit.c | 8 +- |
102 | block/vhdx-endian.c | 118 ++--- | 76 | block/parallels.c | 14 ++-- |
103 | block/vhdx-log.c | 4 +- | 77 | block/qapi.c | 49 +++--------- |
104 | block/vhdx.c | 18 +- | 78 | block/qcow.c | 19 ++--- |
105 | block/vpc.c | 2 + | 79 | block/qcow2.c | 80 ++++++++++---------- |
106 | block/vvfat.c | 15 +- | 80 | block/qed-check.c | 4 +- |
107 | blockdev.c | 3 +- | 81 | block/qed-table.c | 45 ++++++----- |
108 | chardev/char.c | 2 +- | 82 | block/qed.c | 11 ++- |
109 | crypto/block-qcow.c | 2 + | 83 | block/stream.c | 4 +- |
110 | qdev-monitor.c | 13 +- | 84 | block/vhdx-log.c | 2 +- |
111 | qemu-img.c | 4 +- | 85 | block/vhdx.c | 7 +- |
112 | qemu-io-cmds.c | 4 +- | 86 | block/vmdk.c | 2 + |
113 | util/qemu-option.c | 32 +- | 87 | block/vpc.c | 4 + |
114 | vl.c | 15 +- | 88 | qemu-img.c | 26 ++++--- |
115 | tests/qemu-iotests/081 | 116 +++++ | 89 | util/cutils.c | 2 +- |
116 | tests/qemu-iotests/081.out | 70 +++ | 90 | tests/qemu-iotests/026.out | 168 ++++++++++++++++++++--------------------- |
117 | tests/qemu-iotests/082.out | 956 ++++++++++++++++++++--------------------- | 91 | tests/qemu-iotests/043.out | 6 +- |
118 | tests/qemu-iotests/083 | 2 +- | 92 | tests/qemu-iotests/053.out | 2 +- |
119 | tests/qemu-iotests/232 | 147 +++++++ | 93 | tests/qemu-iotests/059.out | 10 +-- |
120 | tests/qemu-iotests/232.out | 59 +++ | 94 | tests/qemu-iotests/060.out | 16 ++-- |
95 | tests/qemu-iotests/061.out | 12 +-- | ||
96 | tests/qemu-iotests/069.out | 2 +- | ||
97 | tests/qemu-iotests/070.out | 4 +- | ||
98 | tests/qemu-iotests/075.out | 14 ++-- | ||
99 | tests/qemu-iotests/076.out | 6 +- | ||
100 | tests/qemu-iotests/078.out | 12 +-- | ||
101 | tests/qemu-iotests/080.out | 40 +++++----- | ||
102 | tests/qemu-iotests/081.out | 2 +- | ||
103 | tests/qemu-iotests/082 | 5 +- | ||
104 | tests/qemu-iotests/082.out | 51 ++++++++----- | ||
105 | tests/qemu-iotests/084.out | 8 +- | ||
106 | tests/qemu-iotests/088.out | 12 +-- | ||
107 | tests/qemu-iotests/089.out | 2 +- | ||
108 | tests/qemu-iotests/095.out | 4 +- | ||
109 | tests/qemu-iotests/103.out | 14 ++-- | ||
110 | tests/qemu-iotests/104.out | 6 +- | ||
111 | tests/qemu-iotests/110.out | 6 +- | ||
112 | tests/qemu-iotests/114.out | 4 +- | ||
113 | tests/qemu-iotests/116.out | 14 ++-- | ||
114 | tests/qemu-iotests/126.out | 4 +- | ||
115 | tests/qemu-iotests/130.out | 10 +-- | ||
116 | tests/qemu-iotests/131.out | 2 +- | ||
117 | tests/qemu-iotests/133.out | 30 ++++---- | ||
118 | tests/qemu-iotests/137.out | 28 +++---- | ||
119 | tests/qemu-iotests/140.out | 2 +- | ||
120 | tests/qemu-iotests/143.out | 2 +- | ||
121 | tests/qemu-iotests/153.out | 32 ++++---- | ||
122 | tests/qemu-iotests/187.out | 6 +- | ||
123 | tests/qemu-iotests/188.out | 2 +- | ||
124 | tests/qemu-iotests/191.out | 8 +- | ||
125 | tests/qemu-iotests/195.out | 4 +- | ||
126 | tests/qemu-iotests/197.out | 2 +- | ||
127 | tests/qemu-iotests/198.out | 4 +- | ||
128 | tests/qemu-iotests/205 | 2 +- | ||
129 | tests/qemu-iotests/206.out | 10 +-- | ||
130 | tests/qemu-iotests/207.out | 12 +-- | ||
131 | tests/qemu-iotests/210.out | 8 +- | ||
132 | tests/qemu-iotests/211.out | 10 +-- | ||
133 | tests/qemu-iotests/212.out | 10 +-- | ||
134 | tests/qemu-iotests/213.out | 10 +-- | ||
135 | tests/qemu-iotests/215.out | 2 +- | ||
136 | tests/qemu-iotests/226.out | 16 ++-- | ||
137 | tests/qemu-iotests/233.out | 4 +- | ||
138 | tests/qemu-iotests/237.out | 22 +++--- | ||
139 | tests/qemu-iotests/242.out | 10 +-- | ||
140 | tests/qemu-iotests/244.out | 10 +-- | ||
141 | tests/qemu-iotests/249 | 115 ++++++++++++++++++++++++++++ | ||
142 | tests/qemu-iotests/249.out | 35 +++++++++ | ||
121 | tests/qemu-iotests/group | 1 + | 143 | tests/qemu-iotests/group | 1 + |
122 | 42 files changed, 1266 insertions(+), 776 deletions(-) | 144 | 75 files changed, 696 insertions(+), 519 deletions(-) |
123 | create mode 100755 tests/qemu-iotests/232 | 145 | create mode 100755 tests/qemu-iotests/249 |
124 | create mode 100644 tests/qemu-iotests/232.out | 146 | create mode 100644 tests/qemu-iotests/249.out |
125 | 147 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Thomas Huth <thuth@redhat.com> | ||
2 | 1 | ||
3 | When using the vvfat driver with a directory that contains too many files, | ||
4 | QEMU currently crashes. This can be triggered like this for example: | ||
5 | |||
6 | mkdir /tmp/vvfattest | ||
7 | cd /tmp/vvfattest | ||
8 | for ((x=0;x<=513;x++)); do mkdir $x; done | ||
9 | qemu-system-x86_64 -drive \ | ||
10 | file.driver=vvfat,file.dir=.,read-only=on,media=cdrom | ||
11 | |||
12 | Seems like read_directory() is changing the mapping->path variable. Make | ||
13 | sure we use the right pointer instead. | ||
14 | |||
15 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
16 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
17 | --- | ||
18 | block/vvfat.c | 4 ++-- | ||
19 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
20 | |||
21 | diff --git a/block/vvfat.c b/block/vvfat.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/block/vvfat.c | ||
24 | +++ b/block/vvfat.c | ||
25 | @@ -XXX,XX +XXX,XX @@ static int init_directories(BDRVVVFATState* s, | ||
26 | mapping = array_get(&(s->mapping), i); | ||
27 | |||
28 | if (mapping->mode & MODE_DIRECTORY) { | ||
29 | + char *path = mapping->path; | ||
30 | mapping->begin = cluster; | ||
31 | if(read_directory(s, i)) { | ||
32 | - error_setg(errp, "Could not read directory %s", | ||
33 | - mapping->path); | ||
34 | + error_setg(errp, "Could not read directory %s", path); | ||
35 | return -1; | ||
36 | } | ||
37 | mapping = array_get(&(s->mapping), i); | ||
38 | -- | ||
39 | 2.19.1 | ||
40 | |||
41 | diff view generated by jsdifflib |
1 | From: Alberto Garcia <berto@igalia.com> | 1 | From: Thomas Huth <thuth@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | This patch tests that you can add and remove drives from a Quorum | 3 | One of the recent commits changed the way qemu-io prints out its |
4 | using the x-blockdev-change command. | 4 | errors and warnings - they are now prefixed with the program name. |
5 | We've got to adapt the iotests accordingly to prevent that they | ||
6 | are failing. | ||
5 | 7 | ||
6 | Signed-off-by: Alberto Garcia <berto@igalia.com> | 8 | Fixes: 99e98d7c9fc1a1639fad ("qemu-io: Use error_[gs]et_progname()") |
9 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
7 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 10 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
8 | --- | 11 | --- |
9 | tests/qemu-iotests/081 | 86 ++++++++++++++++++++++++++++++++++++++ | 12 | tests/qemu-iotests/026.out | 168 ++++++++++++++++++------------------- |
10 | tests/qemu-iotests/081.out | 54 ++++++++++++++++++++++++ | 13 | tests/qemu-iotests/060.out | 6 +- |
11 | 2 files changed, 140 insertions(+) | 14 | tests/qemu-iotests/069.out | 2 +- |
15 | tests/qemu-iotests/070.out | 2 +- | ||
16 | tests/qemu-iotests/075.out | 14 ++-- | ||
17 | tests/qemu-iotests/076.out | 6 +- | ||
18 | tests/qemu-iotests/078.out | 12 +-- | ||
19 | tests/qemu-iotests/080.out | 40 ++++----- | ||
20 | tests/qemu-iotests/081.out | 2 +- | ||
21 | tests/qemu-iotests/088.out | 12 +-- | ||
22 | tests/qemu-iotests/103.out | 14 ++-- | ||
23 | tests/qemu-iotests/114.out | 2 +- | ||
24 | tests/qemu-iotests/116.out | 14 ++-- | ||
25 | tests/qemu-iotests/131.out | 2 +- | ||
26 | tests/qemu-iotests/133.out | 30 +++---- | ||
27 | tests/qemu-iotests/137.out | 28 +++---- | ||
28 | tests/qemu-iotests/140.out | 2 +- | ||
29 | tests/qemu-iotests/143.out | 2 +- | ||
30 | tests/qemu-iotests/153.out | 30 +++---- | ||
31 | tests/qemu-iotests/187.out | 6 +- | ||
32 | tests/qemu-iotests/188.out | 2 +- | ||
33 | tests/qemu-iotests/197.out | 2 +- | ||
34 | tests/qemu-iotests/205 | 2 +- | ||
35 | tests/qemu-iotests/215.out | 2 +- | ||
36 | tests/qemu-iotests/226.out | 16 ++-- | ||
37 | tests/qemu-iotests/244.out | 10 +-- | ||
38 | 26 files changed, 214 insertions(+), 214 deletions(-) | ||
12 | 39 | ||
13 | diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081 | 40 | diff --git a/tests/qemu-iotests/026.out b/tests/qemu-iotests/026.out |
14 | index XXXXXXX..XXXXXXX 100755 | 41 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/tests/qemu-iotests/081 | 42 | --- a/tests/qemu-iotests/026.out |
16 | +++ b/tests/qemu-iotests/081 | 43 | +++ b/tests/qemu-iotests/026.out |
17 | @@ -XXX,XX +XXX,XX @@ quorum="$quorum,file.children.2.driver=raw" | 44 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. |
18 | 45 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | |
19 | $QEMU_IO -c "open -o $quorum" | _filter_qemu_io | 46 | |
20 | 47 | Event: l1_update; errno: 5; imm: off; once: off; write | |
21 | +echo | 48 | -Failed to flush the L2 table cache: Input/output error |
22 | +echo "== dynamically adding a child to a quorum ==" | 49 | -Failed to flush the refcount block cache: Input/output error |
23 | + | 50 | +qemu-io: Failed to flush the L2 table cache: Input/output error |
24 | +for verify in false true; do | 51 | +qemu-io: Failed to flush the refcount block cache: Input/output error |
25 | + run_qemu <<EOF | 52 | write failed: Input/output error |
26 | + { "execute": "qmp_capabilities" } | 53 | |
27 | + { "execute": "blockdev-add", | 54 | 1 leaked clusters were found on the image. |
28 | + "arguments": { | 55 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. |
29 | + "driver": "quorum", | 56 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 |
30 | + "node-name": "drive0-quorum", | 57 | |
31 | + "vote-threshold": 2, | 58 | Event: l1_update; errno: 5; imm: off; once: off; write -b |
32 | + "blkverify": ${verify}, | 59 | -Failed to flush the L2 table cache: Input/output error |
33 | + "children": [ | 60 | -Failed to flush the refcount block cache: Input/output error |
34 | + { | 61 | +qemu-io: Failed to flush the L2 table cache: Input/output error |
35 | + "driver": "$IMGFMT", | 62 | +qemu-io: Failed to flush the refcount block cache: Input/output error |
36 | + "file": { | 63 | write failed: Input/output error |
37 | + "driver": "file", | 64 | |
38 | + "filename": "$TEST_DIR/1.raw" | 65 | 1 leaked clusters were found on the image. |
39 | + } | 66 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. |
40 | + }, | 67 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 |
41 | + { | 68 | |
42 | + "driver": "$IMGFMT", | 69 | Event: l1_update; errno: 28; imm: off; once: off; write |
43 | + "file": { | 70 | -Failed to flush the L2 table cache: No space left on device |
44 | + "driver": "file", | 71 | -Failed to flush the refcount block cache: No space left on device |
45 | + "filename": "$TEST_DIR/2.raw" | 72 | +qemu-io: Failed to flush the L2 table cache: No space left on device |
46 | + } | 73 | +qemu-io: Failed to flush the refcount block cache: No space left on device |
47 | + } | 74 | write failed: No space left on device |
48 | + ] | 75 | |
49 | + } | 76 | 1 leaked clusters were found on the image. |
50 | + } | 77 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. |
51 | + { "execute": "blockdev-add", | 78 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 |
52 | + "arguments": { | 79 | |
53 | + "node-name": "drive3", | 80 | Event: l1_update; errno: 28; imm: off; once: off; write -b |
54 | + "driver": "$IMGFMT", | 81 | -Failed to flush the L2 table cache: No space left on device |
55 | + "file": { | 82 | -Failed to flush the refcount block cache: No space left on device |
56 | + "driver": "file", | 83 | +qemu-io: Failed to flush the L2 table cache: No space left on device |
57 | + "filename": "$TEST_DIR/2.raw" | 84 | +qemu-io: Failed to flush the refcount block cache: No space left on device |
58 | + } | 85 | write failed: No space left on device |
59 | + } | 86 | |
60 | + } | 87 | 1 leaked clusters were found on the image. |
61 | + { "execute": "x-blockdev-change", | 88 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. |
62 | + "arguments": { "parent": "drive0-quorum", | 89 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 |
63 | + "node": "drive3" } } | 90 | |
64 | + { "execute": "quit" } | 91 | Event: l2_update; errno: 5; imm: off; once: off; write |
65 | +EOF | 92 | -Failed to flush the L2 table cache: Input/output error |
66 | +done | 93 | -Failed to flush the refcount block cache: Input/output error |
67 | + | 94 | +qemu-io: Failed to flush the L2 table cache: Input/output error |
68 | +echo | 95 | +qemu-io: Failed to flush the refcount block cache: Input/output error |
69 | +echo "== dynamically removing a child from a quorum ==" | 96 | write failed: Input/output error |
70 | + | 97 | |
71 | +for verify in false true; do | 98 | 127 leaked clusters were found on the image. |
72 | + for vote_threshold in 1 2; do | 99 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. |
73 | + run_qemu <<EOF | 100 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 |
74 | + { "execute": "qmp_capabilities" } | 101 | |
75 | + { "execute": "blockdev-add", | 102 | Event: l2_update; errno: 5; imm: off; once: off; write -b |
76 | + "arguments": { | 103 | -Failed to flush the L2 table cache: Input/output error |
77 | + "driver": "quorum", | 104 | -Failed to flush the refcount block cache: Input/output error |
78 | + "node-name": "drive0-quorum", | 105 | +qemu-io: Failed to flush the L2 table cache: Input/output error |
79 | + "vote-threshold": ${vote_threshold}, | 106 | +qemu-io: Failed to flush the refcount block cache: Input/output error |
80 | + "blkverify": ${verify}, | 107 | write failed: Input/output error |
81 | + "children": [ | 108 | |
82 | + { | 109 | 127 leaked clusters were found on the image. |
83 | + "driver": "$IMGFMT", | 110 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. |
84 | + "file": { | 111 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 |
85 | + "driver": "file", | 112 | |
86 | + "filename": "$TEST_DIR/1.raw" | 113 | Event: l2_update; errno: 28; imm: off; once: off; write |
87 | + } | 114 | -Failed to flush the L2 table cache: No space left on device |
88 | + }, | 115 | -Failed to flush the refcount block cache: No space left on device |
89 | + { | 116 | +qemu-io: Failed to flush the L2 table cache: No space left on device |
90 | + "driver": "$IMGFMT", | 117 | +qemu-io: Failed to flush the refcount block cache: No space left on device |
91 | + "file": { | 118 | write failed: No space left on device |
92 | + "driver": "file", | 119 | |
93 | + "filename": "$TEST_DIR/2.raw" | 120 | 127 leaked clusters were found on the image. |
94 | + } | 121 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. |
95 | + } | 122 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 |
96 | + ] | 123 | |
97 | + } | 124 | Event: l2_update; errno: 28; imm: off; once: off; write -b |
98 | + } | 125 | -Failed to flush the L2 table cache: No space left on device |
99 | + { "execute": "x-blockdev-change", | 126 | -Failed to flush the refcount block cache: No space left on device |
100 | + "arguments": { "parent": "drive0-quorum", | 127 | +qemu-io: Failed to flush the L2 table cache: No space left on device |
101 | + "child": "children.1" } } | 128 | +qemu-io: Failed to flush the refcount block cache: No space left on device |
102 | + { "execute": "quit" } | 129 | write failed: No space left on device |
103 | +EOF | 130 | |
104 | + done | 131 | 127 leaked clusters were found on the image. |
105 | +done | 132 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. |
106 | + | 133 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 |
107 | # success, all done | 134 | |
108 | echo "*** done" | 135 | Event: l2_alloc_write; errno: 5; imm: off; once: off; write |
109 | rm -f $seq.full | 136 | -Failed to flush the L2 table cache: Input/output error |
137 | -Failed to flush the refcount block cache: Input/output error | ||
138 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
139 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
140 | write failed: Input/output error | ||
141 | No errors were found on the image. | ||
142 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
143 | |||
144 | Event: l2_alloc_write; errno: 5; imm: off; once: off; write -b | ||
145 | -Failed to flush the L2 table cache: Input/output error | ||
146 | -Failed to flush the refcount block cache: Input/output error | ||
147 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
148 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
149 | write failed: Input/output error | ||
150 | |||
151 | 1 leaked clusters were found on the image. | ||
152 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
153 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
154 | |||
155 | Event: l2_alloc_write; errno: 28; imm: off; once: off; write | ||
156 | -Failed to flush the L2 table cache: No space left on device | ||
157 | -Failed to flush the refcount block cache: No space left on device | ||
158 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
159 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
160 | write failed: No space left on device | ||
161 | No errors were found on the image. | ||
162 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
163 | |||
164 | Event: l2_alloc_write; errno: 28; imm: off; once: off; write -b | ||
165 | -Failed to flush the L2 table cache: No space left on device | ||
166 | -Failed to flush the refcount block cache: No space left on device | ||
167 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
168 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
169 | write failed: No space left on device | ||
170 | |||
171 | 1 leaked clusters were found on the image. | ||
172 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
173 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
174 | |||
175 | Event: write_aio; errno: 5; imm: off; once: off; write | ||
176 | -Failed to flush the L2 table cache: Input/output error | ||
177 | -Failed to flush the refcount block cache: Input/output error | ||
178 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
179 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
180 | write failed: Input/output error | ||
181 | No errors were found on the image. | ||
182 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
183 | |||
184 | Event: write_aio; errno: 5; imm: off; once: off; write -b | ||
185 | -Failed to flush the L2 table cache: Input/output error | ||
186 | -Failed to flush the refcount block cache: Input/output error | ||
187 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
188 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
189 | write failed: Input/output error | ||
190 | No errors were found on the image. | ||
191 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
192 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
193 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
194 | |||
195 | Event: write_aio; errno: 28; imm: off; once: off; write | ||
196 | -Failed to flush the L2 table cache: No space left on device | ||
197 | -Failed to flush the refcount block cache: No space left on device | ||
198 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
199 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
200 | write failed: No space left on device | ||
201 | No errors were found on the image. | ||
202 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
203 | |||
204 | Event: write_aio; errno: 28; imm: off; once: off; write -b | ||
205 | -Failed to flush the L2 table cache: No space left on device | ||
206 | -Failed to flush the refcount block cache: No space left on device | ||
207 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
208 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
209 | write failed: No space left on device | ||
210 | No errors were found on the image. | ||
211 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
212 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
213 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
214 | |||
215 | Event: refblock_load; errno: 5; imm: off; once: off; write | ||
216 | -Failed to flush the L2 table cache: Input/output error | ||
217 | -Failed to flush the refcount block cache: Input/output error | ||
218 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
219 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
220 | write failed: Input/output error | ||
221 | No errors were found on the image. | ||
222 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
223 | |||
224 | Event: refblock_load; errno: 5; imm: off; once: off; write -b | ||
225 | -Failed to flush the L2 table cache: Input/output error | ||
226 | -Failed to flush the refcount block cache: Input/output error | ||
227 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
228 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
229 | write failed: Input/output error | ||
230 | No errors were found on the image. | ||
231 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
232 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
233 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
234 | |||
235 | Event: refblock_load; errno: 28; imm: off; once: off; write | ||
236 | -Failed to flush the L2 table cache: No space left on device | ||
237 | -Failed to flush the refcount block cache: No space left on device | ||
238 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
239 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
240 | write failed: No space left on device | ||
241 | No errors were found on the image. | ||
242 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
243 | |||
244 | Event: refblock_load; errno: 28; imm: off; once: off; write -b | ||
245 | -Failed to flush the L2 table cache: No space left on device | ||
246 | -Failed to flush the refcount block cache: No space left on device | ||
247 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
248 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
249 | write failed: No space left on device | ||
250 | No errors were found on the image. | ||
251 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
252 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
253 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
254 | |||
255 | Event: refblock_update_part; errno: 5; imm: off; once: off; write | ||
256 | -Failed to flush the L2 table cache: Input/output error | ||
257 | -Failed to flush the refcount block cache: Input/output error | ||
258 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
259 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
260 | write failed: Input/output error | ||
261 | No errors were found on the image. | ||
262 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
263 | |||
264 | Event: refblock_update_part; errno: 5; imm: off; once: off; write -b | ||
265 | -Failed to flush the L2 table cache: Input/output error | ||
266 | -Failed to flush the refcount block cache: Input/output error | ||
267 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
268 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
269 | write failed: Input/output error | ||
270 | No errors were found on the image. | ||
271 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
272 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
273 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
274 | |||
275 | Event: refblock_update_part; errno: 28; imm: off; once: off; write | ||
276 | -Failed to flush the L2 table cache: No space left on device | ||
277 | -Failed to flush the refcount block cache: No space left on device | ||
278 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
279 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
280 | write failed: No space left on device | ||
281 | No errors were found on the image. | ||
282 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
283 | |||
284 | Event: refblock_update_part; errno: 28; imm: off; once: off; write -b | ||
285 | -Failed to flush the L2 table cache: No space left on device | ||
286 | -Failed to flush the refcount block cache: No space left on device | ||
287 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
288 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
289 | write failed: No space left on device | ||
290 | No errors were found on the image. | ||
291 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
292 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
293 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
294 | |||
295 | Event: refblock_alloc; errno: 5; imm: off; once: off; write | ||
296 | -Failed to flush the L2 table cache: Input/output error | ||
297 | -Failed to flush the refcount block cache: Input/output error | ||
298 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
299 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
300 | write failed: Input/output error | ||
301 | No errors were found on the image. | ||
302 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
303 | |||
304 | Event: refblock_alloc; errno: 5; imm: off; once: off; write -b | ||
305 | -Failed to flush the L2 table cache: Input/output error | ||
306 | -Failed to flush the refcount block cache: Input/output error | ||
307 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
308 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
309 | write failed: Input/output error | ||
310 | No errors were found on the image. | ||
311 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
312 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
313 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
314 | |||
315 | Event: refblock_alloc; errno: 28; imm: off; once: off; write | ||
316 | -Failed to flush the L2 table cache: No space left on device | ||
317 | -Failed to flush the refcount block cache: No space left on device | ||
318 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
319 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
320 | write failed: No space left on device | ||
321 | No errors were found on the image. | ||
322 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
323 | |||
324 | Event: refblock_alloc; errno: 28; imm: off; once: off; write -b | ||
325 | -Failed to flush the L2 table cache: No space left on device | ||
326 | -Failed to flush the refcount block cache: No space left on device | ||
327 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
328 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
329 | write failed: No space left on device | ||
330 | No errors were found on the image. | ||
331 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
332 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
333 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
334 | |||
335 | Event: refblock_alloc_hookup; errno: 28; imm: off; once: off; write | ||
336 | -Failed to flush the L2 table cache: No space left on device | ||
337 | -Failed to flush the refcount block cache: No space left on device | ||
338 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
339 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
340 | write failed: No space left on device | ||
341 | |||
342 | 55 leaked clusters were found on the image. | ||
343 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
344 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
345 | |||
346 | Event: refblock_alloc_hookup; errno: 28; imm: off; once: off; write -b | ||
347 | -Failed to flush the L2 table cache: No space left on device | ||
348 | -Failed to flush the refcount block cache: No space left on device | ||
349 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
350 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
351 | write failed: No space left on device | ||
352 | |||
353 | 251 leaked clusters were found on the image. | ||
354 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
355 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
356 | |||
357 | Event: refblock_alloc_write; errno: 28; imm: off; once: off; write | ||
358 | -Failed to flush the L2 table cache: No space left on device | ||
359 | -Failed to flush the refcount block cache: No space left on device | ||
360 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
361 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
362 | write failed: No space left on device | ||
363 | No errors were found on the image. | ||
364 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
365 | |||
366 | Event: refblock_alloc_write; errno: 28; imm: off; once: off; write -b | ||
367 | -Failed to flush the L2 table cache: No space left on device | ||
368 | -Failed to flush the refcount block cache: No space left on device | ||
369 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
370 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
371 | write failed: No space left on device | ||
372 | No errors were found on the image. | ||
373 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
374 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
375 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
376 | |||
377 | Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: off; write | ||
378 | -Failed to flush the L2 table cache: No space left on device | ||
379 | -Failed to flush the refcount block cache: No space left on device | ||
380 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
381 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
382 | write failed: No space left on device | ||
383 | |||
384 | 10 leaked clusters were found on the image. | ||
385 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
386 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
387 | |||
388 | Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: off; write -b | ||
389 | -Failed to flush the L2 table cache: No space left on device | ||
390 | -Failed to flush the refcount block cache: No space left on device | ||
391 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
392 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
393 | write failed: No space left on device | ||
394 | |||
395 | 23 leaked clusters were found on the image. | ||
396 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
397 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
398 | |||
399 | Event: refblock_alloc_write_table; errno: 28; imm: off; once: off; write | ||
400 | -Failed to flush the L2 table cache: No space left on device | ||
401 | -Failed to flush the refcount block cache: No space left on device | ||
402 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
403 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
404 | write failed: No space left on device | ||
405 | |||
406 | 10 leaked clusters were found on the image. | ||
407 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
408 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
409 | |||
410 | Event: refblock_alloc_write_table; errno: 28; imm: off; once: off; write -b | ||
411 | -Failed to flush the L2 table cache: No space left on device | ||
412 | -Failed to flush the refcount block cache: No space left on device | ||
413 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
414 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
415 | write failed: No space left on device | ||
416 | |||
417 | 23 leaked clusters were found on the image. | ||
418 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
419 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
420 | |||
421 | Event: refblock_alloc_switch_table; errno: 28; imm: off; once: off; write | ||
422 | -Failed to flush the L2 table cache: No space left on device | ||
423 | -Failed to flush the refcount block cache: No space left on device | ||
424 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
425 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
426 | write failed: No space left on device | ||
427 | |||
428 | 10 leaked clusters were found on the image. | ||
429 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
430 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
431 | |||
432 | Event: refblock_alloc_switch_table; errno: 28; imm: off; once: off; write -b | ||
433 | -Failed to flush the L2 table cache: No space left on device | ||
434 | -Failed to flush the refcount block cache: No space left on device | ||
435 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
436 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
437 | write failed: No space left on device | ||
438 | |||
439 | 23 leaked clusters were found on the image. | ||
440 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
441 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
442 | |||
443 | Event: l1_grow_write_table; errno: 5; imm: off; once: off | ||
444 | -Failed to flush the L2 table cache: Input/output error | ||
445 | -Failed to flush the refcount block cache: Input/output error | ||
446 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
447 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
448 | write failed: Input/output error | ||
449 | No errors were found on the image. | ||
450 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
451 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
452 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
453 | |||
454 | Event: l1_grow_write_table; errno: 28; imm: off; once: off | ||
455 | -Failed to flush the L2 table cache: No space left on device | ||
456 | -Failed to flush the refcount block cache: No space left on device | ||
457 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
458 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
459 | write failed: No space left on device | ||
460 | No errors were found on the image. | ||
461 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
462 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
463 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
464 | |||
465 | Event: l1_grow_activate_table; errno: 5; imm: off; once: off | ||
466 | -Failed to flush the L2 table cache: Input/output error | ||
467 | -Failed to flush the refcount block cache: Input/output error | ||
468 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
469 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
470 | write failed: Input/output error | ||
471 | |||
472 | 96 leaked clusters were found on the image. | ||
473 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
474 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
475 | |||
476 | Event: l1_grow_activate_table; errno: 28; imm: off; once: off | ||
477 | -Failed to flush the L2 table cache: No space left on device | ||
478 | -Failed to flush the refcount block cache: No space left on device | ||
479 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
480 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
481 | write failed: No space left on device | ||
482 | |||
483 | 96 leaked clusters were found on the image. | ||
484 | diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out | ||
485 | index XXXXXXX..XXXXXXX 100644 | ||
486 | --- a/tests/qemu-iotests/060.out | ||
487 | +++ b/tests/qemu-iotests/060.out | ||
488 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
489 | lazy refcounts: false | ||
490 | refcount bits: 16 | ||
491 | corrupt: true | ||
492 | -can't open device TEST_DIR/t.IMGFMT: IMGFMT: Image is corrupt; cannot be opened read/write | ||
493 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: IMGFMT: Image is corrupt; cannot be opened read/write | ||
494 | no file open, try 'help open' | ||
495 | read 512/512 bytes at offset 0 | ||
496 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
497 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
498 | === Testing zero refcount table size === | ||
499 | |||
500 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
501 | -can't open device TEST_DIR/t.IMGFMT: Image does not contain a reference count table | ||
502 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: Image does not contain a reference count table | ||
503 | ERROR cluster 0 refcount=0 reference=1 | ||
504 | ERROR cluster 3 refcount=0 reference=1 | ||
505 | Rebuilding refcount structure | ||
506 | @@ -XXX,XX +XXX,XX @@ Can't get refcount for cluster 2: Input/output error | ||
507 | Can't get refcount for cluster 3: Input/output error | ||
508 | Rebuilding refcount structure | ||
509 | Repairing cluster 1 refcount=1 reference=0 | ||
510 | -can't open device TEST_DIR/t.IMGFMT: Could not repair dirty image: Input/output error | ||
511 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: Could not repair dirty image: Input/output error | ||
512 | --- Repairing --- | ||
513 | Leaked cluster 1 refcount=1 reference=0 | ||
514 | Repairing cluster 1 refcount=1 reference=0 | ||
515 | diff --git a/tests/qemu-iotests/069.out b/tests/qemu-iotests/069.out | ||
516 | index XXXXXXX..XXXXXXX 100644 | ||
517 | --- a/tests/qemu-iotests/069.out | ||
518 | +++ b/tests/qemu-iotests/069.out | ||
519 | @@ -XXX,XX +XXX,XX @@ QA output created by 069 | ||
520 | |||
521 | Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=131072 | ||
522 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=131072 backing_file=TEST_DIR/t.IMGFMT.base | ||
523 | -can't open device TEST_DIR/t.IMGFMT: Could not open backing file: Could not open 'TEST_DIR/t.IMGFMT.base': No such file or directory | ||
524 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: Could not open backing file: Could not open 'TEST_DIR/t.IMGFMT.base': No such file or directory | ||
525 | *** done | ||
526 | diff --git a/tests/qemu-iotests/070.out b/tests/qemu-iotests/070.out | ||
527 | index XXXXXXX..XXXXXXX 100644 | ||
528 | --- a/tests/qemu-iotests/070.out | ||
529 | +++ b/tests/qemu-iotests/070.out | ||
530 | @@ -XXX,XX +XXX,XX @@ | ||
531 | QA output created by 070 | ||
532 | |||
533 | === Verify open image read-only fails, due to dirty log === | ||
534 | -can't open device TEST_DIR/iotest-dirtylog-10G-4M.vhdx: VHDX image file 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx' opened read-only, but contains a log that needs to be replayed | ||
535 | +qemu-io: can't open device TEST_DIR/iotest-dirtylog-10G-4M.vhdx: VHDX image file 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx' opened read-only, but contains a log that needs to be replayed | ||
536 | To replay the log, run: | ||
537 | qemu-img check -r all 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx' | ||
538 | === Verify open image replays log === | ||
539 | diff --git a/tests/qemu-iotests/075.out b/tests/qemu-iotests/075.out | ||
540 | index XXXXXXX..XXXXXXX 100644 | ||
541 | --- a/tests/qemu-iotests/075.out | ||
542 | +++ b/tests/qemu-iotests/075.out | ||
543 | @@ -XXX,XX +XXX,XX @@ read 512/512 bytes at offset 1048064 | ||
544 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
545 | |||
546 | == block_size must be a multiple of 512 == | ||
547 | -can't open device TEST_DIR/simple-pattern.cloop: block_size 513 must be a multiple of 512 | ||
548 | +qemu-io: can't open device TEST_DIR/simple-pattern.cloop: block_size 513 must be a multiple of 512 | ||
549 | |||
550 | == block_size cannot be zero == | ||
551 | -can't open device TEST_DIR/simple-pattern.cloop: block_size cannot be zero | ||
552 | +qemu-io: can't open device TEST_DIR/simple-pattern.cloop: block_size cannot be zero | ||
553 | |||
554 | == huge block_size === | ||
555 | -can't open device TEST_DIR/simple-pattern.cloop: block_size 4294966784 must be 64 MB or less | ||
556 | +qemu-io: can't open device TEST_DIR/simple-pattern.cloop: block_size 4294966784 must be 64 MB or less | ||
557 | |||
558 | == offsets_size overflow === | ||
559 | -can't open device TEST_DIR/simple-pattern.cloop: n_blocks 4294967295 must be 536870911 or less | ||
560 | +qemu-io: can't open device TEST_DIR/simple-pattern.cloop: n_blocks 4294967295 must be 536870911 or less | ||
561 | |||
562 | == refuse images that require too many offsets === | ||
563 | -can't open device TEST_DIR/simple-pattern.cloop: image requires too many offsets, try increasing block size | ||
564 | +qemu-io: can't open device TEST_DIR/simple-pattern.cloop: image requires too many offsets, try increasing block size | ||
565 | |||
566 | == refuse images with non-monotonically increasing offsets == | ||
567 | -can't open device TEST_DIR/simple-pattern.cloop: offsets not monotonically increasing at index 1, image file is corrupt | ||
568 | +qemu-io: can't open device TEST_DIR/simple-pattern.cloop: offsets not monotonically increasing at index 1, image file is corrupt | ||
569 | |||
570 | == refuse images with invalid compressed block size == | ||
571 | -can't open device TEST_DIR/simple-pattern.cloop: invalid compressed block size at index 1, image file is corrupt | ||
572 | +qemu-io: can't open device TEST_DIR/simple-pattern.cloop: invalid compressed block size at index 1, image file is corrupt | ||
573 | *** done | ||
574 | diff --git a/tests/qemu-iotests/076.out b/tests/qemu-iotests/076.out | ||
575 | index XXXXXXX..XXXXXXX 100644 | ||
576 | --- a/tests/qemu-iotests/076.out | ||
577 | +++ b/tests/qemu-iotests/076.out | ||
578 | @@ -XXX,XX +XXX,XX @@ read 65536/65536 bytes at offset 0 | ||
579 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
580 | |||
581 | == Negative catalog size == | ||
582 | -can't open device TEST_DIR/parallels-v1: Catalog too large | ||
583 | +qemu-io: can't open device TEST_DIR/parallels-v1: Catalog too large | ||
584 | |||
585 | == Overflow in catalog allocation == | ||
586 | -can't open device TEST_DIR/parallels-v1: Catalog too large | ||
587 | +qemu-io: can't open device TEST_DIR/parallels-v1: Catalog too large | ||
588 | |||
589 | == Zero sectors per track == | ||
590 | -can't open device TEST_DIR/parallels-v1: Invalid image: Zero sectors per track | ||
591 | +qemu-io: can't open device TEST_DIR/parallels-v1: Invalid image: Zero sectors per track | ||
592 | |||
593 | == Read from a valid v2 image == | ||
594 | read 65536/65536 bytes at offset 0 | ||
595 | diff --git a/tests/qemu-iotests/078.out b/tests/qemu-iotests/078.out | ||
596 | index XXXXXXX..XXXXXXX 100644 | ||
597 | --- a/tests/qemu-iotests/078.out | ||
598 | +++ b/tests/qemu-iotests/078.out | ||
599 | @@ -XXX,XX +XXX,XX @@ read 512/512 bytes at offset 0 | ||
600 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
601 | |||
602 | == Negative catalog size == | ||
603 | -can't open device TEST_DIR/empty.bochs: Catalog size is too large | ||
604 | +qemu-io: can't open device TEST_DIR/empty.bochs: Catalog size is too large | ||
605 | |||
606 | == Overflow for catalog size * sizeof(uint32_t) == | ||
607 | -can't open device TEST_DIR/empty.bochs: Catalog size is too large | ||
608 | +qemu-io: can't open device TEST_DIR/empty.bochs: Catalog size is too large | ||
609 | |||
610 | == Too small catalog bitmap for image size == | ||
611 | -can't open device TEST_DIR/empty.bochs: Catalog size is too small for this disk size | ||
612 | -can't open device TEST_DIR/empty.bochs: Catalog size is too small for this disk size | ||
613 | +qemu-io: can't open device TEST_DIR/empty.bochs: Catalog size is too small for this disk size | ||
614 | +qemu-io: can't open device TEST_DIR/empty.bochs: Catalog size is too small for this disk size | ||
615 | |||
616 | == Negative extent size == | ||
617 | -can't open device TEST_DIR/empty.bochs: Extent size 2147483648 is too large | ||
618 | +qemu-io: can't open device TEST_DIR/empty.bochs: Extent size 2147483648 is too large | ||
619 | |||
620 | == Zero extent size == | ||
621 | -can't open device TEST_DIR/empty.bochs: Extent size must be at least 512 | ||
622 | +qemu-io: can't open device TEST_DIR/empty.bochs: Extent size must be at least 512 | ||
623 | *** done | ||
624 | diff --git a/tests/qemu-iotests/080.out b/tests/qemu-iotests/080.out | ||
625 | index XXXXXXX..XXXXXXX 100644 | ||
626 | --- a/tests/qemu-iotests/080.out | ||
627 | +++ b/tests/qemu-iotests/080.out | ||
628 | @@ -XXX,XX +XXX,XX @@ QA output created by 080 | ||
629 | |||
630 | == Huge header size == | ||
631 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
632 | -can't open device TEST_DIR/t.qcow2: qcow2 header exceeds cluster size | ||
633 | -can't open device TEST_DIR/t.qcow2: qcow2 header exceeds cluster size | ||
634 | +qemu-io: can't open device TEST_DIR/t.qcow2: qcow2 header exceeds cluster size | ||
635 | +qemu-io: can't open device TEST_DIR/t.qcow2: qcow2 header exceeds cluster size | ||
636 | |||
637 | == Huge unknown header extension == | ||
638 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
639 | -can't open device TEST_DIR/t.qcow2: Invalid backing file offset | ||
640 | -can't open device TEST_DIR/t.qcow2: Header extension too large | ||
641 | -can't open device TEST_DIR/t.qcow2: Header extension too large | ||
642 | +qemu-io: can't open device TEST_DIR/t.qcow2: Invalid backing file offset | ||
643 | +qemu-io: can't open device TEST_DIR/t.qcow2: Header extension too large | ||
644 | +qemu-io: can't open device TEST_DIR/t.qcow2: Header extension too large | ||
645 | |||
646 | == Huge refcount table size == | ||
647 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
648 | -can't open device TEST_DIR/t.qcow2: Reference count table too large | ||
649 | -can't open device TEST_DIR/t.qcow2: Reference count table too large | ||
650 | +qemu-io: can't open device TEST_DIR/t.qcow2: Reference count table too large | ||
651 | +qemu-io: can't open device TEST_DIR/t.qcow2: Reference count table too large | ||
652 | |||
653 | == Misaligned refcount table == | ||
654 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
655 | -can't open device TEST_DIR/t.qcow2: Reference count table offset invalid | ||
656 | +qemu-io: can't open device TEST_DIR/t.qcow2: Reference count table offset invalid | ||
657 | |||
658 | == Huge refcount offset == | ||
659 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
660 | -can't open device TEST_DIR/t.qcow2: Reference count table offset invalid | ||
661 | +qemu-io: can't open device TEST_DIR/t.qcow2: Reference count table offset invalid | ||
662 | |||
663 | == Invalid snapshot table == | ||
664 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
665 | -can't open device TEST_DIR/t.qcow2: Snapshot table too large | ||
666 | -can't open device TEST_DIR/t.qcow2: Snapshot table too large | ||
667 | -can't open device TEST_DIR/t.qcow2: Snapshot table offset invalid | ||
668 | -can't open device TEST_DIR/t.qcow2: Snapshot table offset invalid | ||
669 | +qemu-io: can't open device TEST_DIR/t.qcow2: Snapshot table too large | ||
670 | +qemu-io: can't open device TEST_DIR/t.qcow2: Snapshot table too large | ||
671 | +qemu-io: can't open device TEST_DIR/t.qcow2: Snapshot table offset invalid | ||
672 | +qemu-io: can't open device TEST_DIR/t.qcow2: Snapshot table offset invalid | ||
673 | |||
674 | == Hitting snapshot table size limit == | ||
675 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
676 | @@ -XXX,XX +XXX,XX @@ read 512/512 bytes at offset 0 | ||
677 | |||
678 | == Invalid L1 table == | ||
679 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
680 | -can't open device TEST_DIR/t.qcow2: Active L1 table too large | ||
681 | -can't open device TEST_DIR/t.qcow2: Active L1 table too large | ||
682 | -can't open device TEST_DIR/t.qcow2: Active L1 table offset invalid | ||
683 | -can't open device TEST_DIR/t.qcow2: Active L1 table offset invalid | ||
684 | +qemu-io: can't open device TEST_DIR/t.qcow2: Active L1 table too large | ||
685 | +qemu-io: can't open device TEST_DIR/t.qcow2: Active L1 table too large | ||
686 | +qemu-io: can't open device TEST_DIR/t.qcow2: Active L1 table offset invalid | ||
687 | +qemu-io: can't open device TEST_DIR/t.qcow2: Active L1 table offset invalid | ||
688 | |||
689 | == Invalid L1 table (with internal snapshot in the image) == | ||
690 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
691 | @@ -XXX,XX +XXX,XX @@ qemu-img: Could not open 'TEST_DIR/t.IMGFMT': L1 table is too small | ||
692 | |||
693 | == Invalid backing file size == | ||
694 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
695 | -can't open device TEST_DIR/t.qcow2: Backing file name too long | ||
696 | +qemu-io: can't open device TEST_DIR/t.qcow2: Backing file name too long | ||
697 | |||
698 | == Invalid L2 entry (huge physical offset) == | ||
699 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
700 | @@ -XXX,XX +XXX,XX @@ wrote 512/512 bytes at offset 0 | ||
701 | qemu-img: Failed to load snapshot: Snapshot L1 table offset invalid | ||
702 | qemu-img: Snapshot L1 table offset invalid | ||
703 | qemu-img: Failed to turn zero into data clusters: Invalid argument | ||
704 | -Failed to flush the refcount block cache: Invalid argument | ||
705 | +qemu-io: Failed to flush the refcount block cache: Invalid argument | ||
706 | write failed: Invalid argument | ||
707 | qemu-img: Snapshot L1 table offset invalid | ||
708 | qemu-img: Could not apply snapshot 'test': Failed to load snapshot: Invalid argument | ||
709 | @@ -XXX,XX +XXX,XX @@ wrote 512/512 bytes at offset 0 | ||
710 | qemu-img: Failed to load snapshot: Snapshot L1 table too large | ||
711 | qemu-img: Snapshot L1 table too large | ||
712 | qemu-img: Failed to turn zero into data clusters: File too large | ||
713 | -Failed to flush the refcount block cache: File too large | ||
714 | +qemu-io: Failed to flush the refcount block cache: File too large | ||
715 | write failed: File too large | ||
716 | qemu-img: Snapshot L1 table too large | ||
717 | qemu-img: Could not apply snapshot 'test': Failed to load snapshot: File too large | ||
110 | diff --git a/tests/qemu-iotests/081.out b/tests/qemu-iotests/081.out | 718 | diff --git a/tests/qemu-iotests/081.out b/tests/qemu-iotests/081.out |
111 | index XXXXXXX..XXXXXXX 100644 | 719 | index XXXXXXX..XXXXXXX 100644 |
112 | --- a/tests/qemu-iotests/081.out | 720 | --- a/tests/qemu-iotests/081.out |
113 | +++ b/tests/qemu-iotests/081.out | 721 | +++ b/tests/qemu-iotests/081.out |
114 | @@ -XXX,XX +XXX,XX @@ read 10485760/10485760 bytes at offset 0 | 722 | @@ -XXX,XX +XXX,XX @@ read 10485760/10485760 bytes at offset 0 |
723 | 10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
115 | 724 | ||
116 | == checking the blkverify mode with invalid settings == | 725 | == checking the blkverify mode with invalid settings == |
117 | can't open: blkverify=on can only be set if there are exactly two files and vote-threshold is 2 | 726 | -can't open: blkverify=on can only be set if there are exactly two files and vote-threshold is 2 |
118 | + | 727 | +qemu-io: can't open: blkverify=on can only be set if there are exactly two files and vote-threshold is 2 |
119 | +== dynamically adding a child to a quorum == | 728 | |
120 | +Testing: | 729 | == dynamically adding a child to a quorum == |
121 | +QMP_VERSION | 730 | Testing: |
122 | +{"return": {}} | 731 | diff --git a/tests/qemu-iotests/088.out b/tests/qemu-iotests/088.out |
123 | +{"return": {}} | 732 | index XXXXXXX..XXXXXXX 100644 |
124 | +{"return": {}} | 733 | --- a/tests/qemu-iotests/088.out |
125 | +{"return": {}} | 734 | +++ b/tests/qemu-iotests/088.out |
126 | +{"return": {}} | 735 | @@ -XXX,XX +XXX,XX @@ QA output created by 088 |
127 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} | 736 | |
128 | + | 737 | == Invalid block size == |
129 | +Testing: | 738 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 |
130 | +QMP_VERSION | 739 | -can't open device TEST_DIR/t.vpc: Invalid block size 0 |
131 | +{"return": {}} | 740 | -can't open device TEST_DIR/t.vpc: Invalid block size 0 |
132 | +{"return": {}} | 741 | -can't open device TEST_DIR/t.vpc: Invalid block size 128 |
133 | +{"return": {}} | 742 | -can't open device TEST_DIR/t.vpc: Invalid block size 128 |
134 | +{"error": {"class": "GenericError", "desc": "Cannot add a child to a quorum in blkverify mode"}} | 743 | -can't open device TEST_DIR/t.vpc: Invalid block size 305419896 |
135 | +{"return": {}} | 744 | -can't open device TEST_DIR/t.vpc: Invalid block size 305419896 |
136 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} | 745 | +qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 0 |
137 | + | 746 | +qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 0 |
138 | + | 747 | +qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 128 |
139 | +== dynamically removing a child from a quorum == | 748 | +qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 128 |
140 | +Testing: | 749 | +qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 305419896 |
141 | +QMP_VERSION | 750 | +qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 305419896 |
142 | +{"return": {}} | ||
143 | +{"return": {}} | ||
144 | +{"return": {}} | ||
145 | +{"return": {}} | ||
146 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} | ||
147 | + | ||
148 | +Testing: | ||
149 | +QMP_VERSION | ||
150 | +{"return": {}} | ||
151 | +{"return": {}} | ||
152 | +{"error": {"class": "GenericError", "desc": "The number of children cannot be lower than the vote threshold 2"}} | ||
153 | +{"return": {}} | ||
154 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} | ||
155 | + | ||
156 | +Testing: | ||
157 | +QMP_VERSION | ||
158 | +{"return": {}} | ||
159 | +{"error": {"class": "GenericError", "desc": "blkverify=on can only be set if there are exactly two files and vote-threshold is 2"}} | ||
160 | +{"error": {"class": "GenericError", "desc": "Cannot find device=drive0-quorum nor node_name=drive0-quorum"}} | ||
161 | +{"return": {}} | ||
162 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} | ||
163 | + | ||
164 | +Testing: | ||
165 | +QMP_VERSION | ||
166 | +{"return": {}} | ||
167 | +{"return": {}} | ||
168 | +{"error": {"class": "GenericError", "desc": "The number of children cannot be lower than the vote threshold 2"}} | ||
169 | +{"return": {}} | ||
170 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} | ||
171 | + | ||
172 | *** done | 751 | *** done |
752 | diff --git a/tests/qemu-iotests/103.out b/tests/qemu-iotests/103.out | ||
753 | index XXXXXXX..XXXXXXX 100644 | ||
754 | --- a/tests/qemu-iotests/103.out | ||
755 | +++ b/tests/qemu-iotests/103.out | ||
756 | @@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 0 | ||
757 | |||
758 | === Testing invalid option combinations === | ||
759 | |||
760 | -can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcount-cache-size may not be set at the same time | ||
761 | -can't open device TEST_DIR/t.IMGFMT: l2-cache-size may not exceed cache-size | ||
762 | -can't open device TEST_DIR/t.IMGFMT: refcount-cache-size may not exceed cache-size | ||
763 | -can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcount-cache-size may not be set at the same time | ||
764 | -can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
765 | -can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
766 | -can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
767 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcount-cache-size may not be set at the same time | ||
768 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: l2-cache-size may not exceed cache-size | ||
769 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: refcount-cache-size may not exceed cache-size | ||
770 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcount-cache-size may not be set at the same time | ||
771 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
772 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
773 | +qemu-io: can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
774 | |||
775 | === Testing valid option combinations === | ||
776 | |||
777 | diff --git a/tests/qemu-iotests/114.out b/tests/qemu-iotests/114.out | ||
778 | index XXXXXXX..XXXXXXX 100644 | ||
779 | --- a/tests/qemu-iotests/114.out | ||
780 | +++ b/tests/qemu-iotests/114.out | ||
781 | @@ -XXX,XX +XXX,XX @@ virtual size: 64M (67108864 bytes) | ||
782 | cluster_size: 65536 | ||
783 | backing file: TEST_DIR/t.IMGFMT.base | ||
784 | backing file format: foo | ||
785 | -can't open device TEST_DIR/t.qcow2: Could not open backing file: Unknown driver 'foo' | ||
786 | +qemu-io: can't open device TEST_DIR/t.qcow2: Could not open backing file: Unknown driver 'foo' | ||
787 | no file open, try 'help open' | ||
788 | read 4096/4096 bytes at offset 0 | ||
789 | 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
790 | diff --git a/tests/qemu-iotests/116.out b/tests/qemu-iotests/116.out | ||
791 | index XXXXXXX..XXXXXXX 100644 | ||
792 | --- a/tests/qemu-iotests/116.out | ||
793 | +++ b/tests/qemu-iotests/116.out | ||
794 | @@ -XXX,XX +XXX,XX @@ QA output created by 116 | ||
795 | |||
796 | == truncated header cluster == | ||
797 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
798 | -can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
799 | +qemu-io: can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
800 | |||
801 | == invalid header magic == | ||
802 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
803 | -can't open device TEST_DIR/t.qed: Image not in QED format | ||
804 | +qemu-io: can't open device TEST_DIR/t.qed: Image not in QED format | ||
805 | |||
806 | == invalid cluster size == | ||
807 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
808 | -can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
809 | +qemu-io: can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
810 | |||
811 | == invalid table size == | ||
812 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
813 | -can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
814 | +qemu-io: can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
815 | |||
816 | == invalid header size == | ||
817 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
818 | -can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
819 | +qemu-io: can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
820 | |||
821 | == invalid L1 table offset == | ||
822 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
823 | -can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
824 | +qemu-io: can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
825 | |||
826 | == invalid image size == | ||
827 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
828 | -can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
829 | +qemu-io: can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
830 | *** done | ||
831 | diff --git a/tests/qemu-iotests/131.out b/tests/qemu-iotests/131.out | ||
832 | index XXXXXXX..XXXXXXX 100644 | ||
833 | --- a/tests/qemu-iotests/131.out | ||
834 | +++ b/tests/qemu-iotests/131.out | ||
835 | @@ -XXX,XX +XXX,XX @@ read 32768/32768 bytes at offset 163840 | ||
836 | read 32768/32768 bytes at offset 0 | ||
837 | 32 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
838 | == Corrupt image == | ||
839 | -can't open device TEST_DIR/t.parallels: parallels: Image was not closed correctly; cannot be opened read/write | ||
840 | +qemu-io: can't open device TEST_DIR/t.parallels: parallels: Image was not closed correctly; cannot be opened read/write | ||
841 | ERROR image was not closed correctly | ||
842 | |||
843 | 1 errors were found on the image. | ||
844 | diff --git a/tests/qemu-iotests/133.out b/tests/qemu-iotests/133.out | ||
845 | index XXXXXXX..XXXXXXX 100644 | ||
846 | --- a/tests/qemu-iotests/133.out | ||
847 | +++ b/tests/qemu-iotests/133.out | ||
848 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t | ||
849 | |||
850 | === Check that node-name can't be changed === | ||
851 | |||
852 | -Cannot change the option 'node-name' | ||
853 | -Cannot change the option 'node-name' | ||
854 | -Cannot change the option 'node-name' | ||
855 | +qemu-io: Cannot change the option 'node-name' | ||
856 | +qemu-io: Cannot change the option 'node-name' | ||
857 | +qemu-io: Cannot change the option 'node-name' | ||
858 | |||
859 | === Check that unchanged node-name is okay === | ||
860 | |||
861 | |||
862 | === Check that driver can't be changed === | ||
863 | |||
864 | -Cannot change the option 'driver' | ||
865 | -Cannot change the option 'driver' | ||
866 | -Cannot change the option 'driver' | ||
867 | +qemu-io: Cannot change the option 'driver' | ||
868 | +qemu-io: Cannot change the option 'driver' | ||
869 | +qemu-io: Cannot change the option 'driver' | ||
870 | |||
871 | === Check that unchanged driver is okay === | ||
872 | |||
873 | @@ -XXX,XX +XXX,XX @@ format name: null-co | ||
874 | |||
875 | === Check that mixing -c/-r/-w and their corresponding options is forbidden === | ||
876 | |||
877 | -Cannot set both -r/-w and 'read-only' | ||
878 | -Cannot set both -r/-w and 'read-only' | ||
879 | -Cannot set both -c and the cache options | ||
880 | -Cannot set both -c and the cache options | ||
881 | -Cannot set both -c and the cache options | ||
882 | +qemu-io: Cannot set both -r/-w and 'read-only' | ||
883 | +qemu-io: Cannot set both -r/-w and 'read-only' | ||
884 | +qemu-io: Cannot set both -c and the cache options | ||
885 | +qemu-io: Cannot set both -c and the cache options | ||
886 | +qemu-io: Cannot set both -c and the cache options | ||
887 | |||
888 | === Check that invalid options are handled correctly === | ||
889 | |||
890 | -Parameter 'read-only' expects 'on' or 'off' | ||
891 | -Parameter 'cache.no-flush' expects 'on' or 'off' | ||
892 | -Parameter 'cache.direct' expects 'on' or 'off' | ||
893 | -Parameter 'auto-read-only' expects 'on' or 'off' | ||
894 | +qemu-io: Parameter 'read-only' expects 'on' or 'off' | ||
895 | +qemu-io: Parameter 'cache.no-flush' expects 'on' or 'off' | ||
896 | +qemu-io: Parameter 'cache.direct' expects 'on' or 'off' | ||
897 | +qemu-io: Parameter 'auto-read-only' expects 'on' or 'off' | ||
898 | *** done | ||
899 | diff --git a/tests/qemu-iotests/137.out b/tests/qemu-iotests/137.out | ||
900 | index XXXXXXX..XXXXXXX 100644 | ||
901 | --- a/tests/qemu-iotests/137.out | ||
902 | +++ b/tests/qemu-iotests/137.out | ||
903 | @@ -XXX,XX +XXX,XX @@ read 33554432/33554432 bytes at offset 0 | ||
904 | |||
905 | === Try setting some invalid values === | ||
906 | |||
907 | -Parameter 'lazy-refcounts' expects 'on' or 'off' | ||
908 | -cache-size, l2-cache-size and refcount-cache-size may not be set at the same time | ||
909 | -l2-cache-size may not exceed cache-size | ||
910 | -refcount-cache-size may not exceed cache-size | ||
911 | -L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
912 | -L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
913 | -Refcount cache size too big | ||
914 | -Conflicting values for qcow2 options 'overlap-check' ('constant') and 'overlap-check.template' ('all') | ||
915 | -Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all | ||
916 | -Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all | ||
917 | -Cache clean interval too big | ||
918 | +qemu-io: Parameter 'lazy-refcounts' expects 'on' or 'off' | ||
919 | +qemu-io: cache-size, l2-cache-size and refcount-cache-size may not be set at the same time | ||
920 | +qemu-io: l2-cache-size may not exceed cache-size | ||
921 | +qemu-io: refcount-cache-size may not exceed cache-size | ||
922 | +qemu-io: L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
923 | +qemu-io: L2 cache entry size must be a power of two between 512 and the cluster size (65536) | ||
924 | +qemu-io: Refcount cache size too big | ||
925 | +qemu-io: Conflicting values for qcow2 options 'overlap-check' ('constant') and 'overlap-check.template' ('all') | ||
926 | +qemu-io: Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all | ||
927 | +qemu-io: Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all | ||
928 | +qemu-io: Cache clean interval too big | ||
929 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=36028797018963968 | ||
930 | -L2 cache size too big | ||
931 | +qemu-io: L2 cache size too big | ||
932 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
933 | |||
934 | === Test transaction semantics === | ||
935 | |||
936 | -Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all | ||
937 | +qemu-io: Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all | ||
938 | wrote 512/512 bytes at offset 0 | ||
939 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
940 | ./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then | ||
941 | @@ -XXX,XX +XXX,XX @@ incompatible_features 0x0 | ||
942 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
943 | wrote 65536/65536 bytes at offset 0 | ||
944 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
945 | -Parameter 'lazy-refcounts' expects 'on' or 'off' | ||
946 | +qemu-io: Parameter 'lazy-refcounts' expects 'on' or 'off' | ||
947 | qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with qcow2_header); further corruption events will be suppressed | ||
948 | write failed: Input/output error | ||
949 | *** done | ||
950 | diff --git a/tests/qemu-iotests/140.out b/tests/qemu-iotests/140.out | ||
951 | index XXXXXXX..XXXXXXX 100644 | ||
952 | --- a/tests/qemu-iotests/140.out | ||
953 | +++ b/tests/qemu-iotests/140.out | ||
954 | @@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 0 | ||
955 | read 65536/65536 bytes at offset 0 | ||
956 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
957 | {"return": {}} | ||
958 | -can't open device nbd+unix:///drv?socket=TEST_DIR/nbd: Requested export not available | ||
959 | +qemu-io: can't open device nbd+unix:///drv?socket=TEST_DIR/nbd: Requested export not available | ||
960 | server reported: export 'drv' not present | ||
961 | {"return": {}} | ||
962 | {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} | ||
963 | diff --git a/tests/qemu-iotests/143.out b/tests/qemu-iotests/143.out | ||
964 | index XXXXXXX..XXXXXXX 100644 | ||
965 | --- a/tests/qemu-iotests/143.out | ||
966 | +++ b/tests/qemu-iotests/143.out | ||
967 | @@ -XXX,XX +XXX,XX @@ | ||
968 | QA output created by 143 | ||
969 | {"return": {}} | ||
970 | {"return": {}} | ||
971 | -can't open device nbd+unix:///no_such_export?socket=TEST_DIR/nbd: Requested export not available | ||
972 | +qemu-io: can't open device nbd+unix:///no_such_export?socket=TEST_DIR/nbd: Requested export not available | ||
973 | server reported: export 'no_such_export' not present | ||
974 | {"return": {}} | ||
975 | {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} | ||
976 | diff --git a/tests/qemu-iotests/153.out b/tests/qemu-iotests/153.out | ||
977 | index XXXXXXX..XXXXXXX 100644 | ||
978 | --- a/tests/qemu-iotests/153.out | ||
979 | +++ b/tests/qemu-iotests/153.out | ||
980 | @@ -XXX,XX +XXX,XX @@ Is another process using the image [TEST_DIR/t.qcow2]? | ||
981 | == Running utility commands == | ||
982 | |||
983 | _qemu_io_wrapper -c read 0 512 TEST_DIR/t.qcow2 | ||
984 | -can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
985 | +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
986 | Is another process using the image [TEST_DIR/t.qcow2]? | ||
987 | |||
988 | _qemu_io_wrapper -r -c read 0 512 TEST_DIR/t.qcow2 | ||
989 | -can't open device TEST_DIR/t.qcow2: Failed to get shared "write" lock | ||
990 | +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get shared "write" lock | ||
991 | Is another process using the image [TEST_DIR/t.qcow2]? | ||
992 | |||
993 | _qemu_io_wrapper -c open TEST_DIR/t.qcow2 -c read 0 512 | ||
994 | -can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
995 | +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
996 | Is another process using the image [TEST_DIR/t.qcow2]? | ||
997 | no file open, try 'help open' | ||
998 | |||
999 | _qemu_io_wrapper -c open -r TEST_DIR/t.qcow2 -c read 0 512 | ||
1000 | -can't open device TEST_DIR/t.qcow2: Failed to get shared "write" lock | ||
1001 | +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get shared "write" lock | ||
1002 | Is another process using the image [TEST_DIR/t.qcow2]? | ||
1003 | no file open, try 'help open' | ||
1004 | |||
1005 | @@ -XXX,XX +XXX,XX @@ file format: IMGFMT | ||
1006 | == Running utility commands -U == | ||
1007 | |||
1008 | _qemu_io_wrapper -U -c read 0 512 TEST_DIR/t.qcow2 | ||
1009 | -can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1010 | +qemu-io: can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1011 | |||
1012 | _qemu_io_wrapper -U -r -c read 0 512 TEST_DIR/t.qcow2 | ||
1013 | |||
1014 | _qemu_io_wrapper -c open -U TEST_DIR/t.qcow2 -c read 0 512 | ||
1015 | -can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1016 | +qemu-io: can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1017 | no file open, try 'help open' | ||
1018 | |||
1019 | _qemu_io_wrapper -c open -r -U TEST_DIR/t.qcow2 -c read 0 512 | ||
1020 | @@ -XXX,XX +XXX,XX @@ Is another process using the image [TEST_DIR/t.qcow2]? | ||
1021 | == Running utility commands == | ||
1022 | |||
1023 | _qemu_io_wrapper -c read 0 512 TEST_DIR/t.qcow2 | ||
1024 | -can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
1025 | +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
1026 | Is another process using the image [TEST_DIR/t.qcow2]? | ||
1027 | |||
1028 | _qemu_io_wrapper -r -c read 0 512 TEST_DIR/t.qcow2 | ||
1029 | |||
1030 | _qemu_io_wrapper -c open TEST_DIR/t.qcow2 -c read 0 512 | ||
1031 | -can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
1032 | +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
1033 | Is another process using the image [TEST_DIR/t.qcow2]? | ||
1034 | no file open, try 'help open' | ||
1035 | |||
1036 | @@ -XXX,XX +XXX,XX @@ file format: IMGFMT | ||
1037 | == Running utility commands -U == | ||
1038 | |||
1039 | _qemu_io_wrapper -U -c read 0 512 TEST_DIR/t.qcow2 | ||
1040 | -can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1041 | +qemu-io: can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1042 | |||
1043 | _qemu_io_wrapper -U -r -c read 0 512 TEST_DIR/t.qcow2 | ||
1044 | |||
1045 | _qemu_io_wrapper -c open -U TEST_DIR/t.qcow2 -c read 0 512 | ||
1046 | -can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1047 | +qemu-io: can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1048 | no file open, try 'help open' | ||
1049 | |||
1050 | _qemu_io_wrapper -c open -r -U TEST_DIR/t.qcow2 -c read 0 512 | ||
1051 | @@ -XXX,XX +XXX,XX @@ file format: IMGFMT | ||
1052 | == Running utility commands -U == | ||
1053 | |||
1054 | _qemu_io_wrapper -U -c read 0 512 TEST_DIR/t.qcow2 | ||
1055 | -can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1056 | +qemu-io: can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1057 | |||
1058 | _qemu_io_wrapper -U -r -c read 0 512 TEST_DIR/t.qcow2 | ||
1059 | |||
1060 | _qemu_io_wrapper -c open -U TEST_DIR/t.qcow2 -c read 0 512 | ||
1061 | -can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1062 | +qemu-io: can't open device TEST_DIR/t.qcow2: force-share=on can only be used with read-only images | ||
1063 | no file open, try 'help open' | ||
1064 | |||
1065 | _qemu_io_wrapper -c open -r -U TEST_DIR/t.qcow2 -c read 0 512 | ||
1066 | @@ -XXX,XX +XXX,XX @@ Adding drive | ||
1067 | {"return": "OKrn"} | ||
1068 | |||
1069 | _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512 | ||
1070 | -can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
1071 | +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
1072 | Is another process using the image [TEST_DIR/t.qcow2]? | ||
1073 | Creating overlay with qemu-img when the guest is running should be allowed | ||
1074 | |||
1075 | @@ -XXX,XX +XXX,XX @@ _qemu_img_wrapper info TEST_DIR/t.qcow2 | ||
1076 | {"return": ""} | ||
1077 | |||
1078 | _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512 | ||
1079 | -can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
1080 | +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock | ||
1081 | Is another process using the image [TEST_DIR/t.qcow2]? | ||
1082 | Closing the other | ||
1083 | {"return": ""} | ||
1084 | @@ -XXX,XX +XXX,XX @@ qemu-img: --force-share/-U conflicts with image options | ||
1085 | No conflict: | ||
1086 | |||
1087 | Conflict: | ||
1088 | --U conflicts with image options | ||
1089 | +qemu-io: -U conflicts with image options | ||
1090 | *** done | ||
1091 | diff --git a/tests/qemu-iotests/187.out b/tests/qemu-iotests/187.out | ||
1092 | index XXXXXXX..XXXXXXX 100644 | ||
1093 | --- a/tests/qemu-iotests/187.out | ||
1094 | +++ b/tests/qemu-iotests/187.out | ||
1095 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
1096 | |||
1097 | Start from read-only | ||
1098 | |||
1099 | -Block node is read-only | ||
1100 | +qemu-io: Block node is read-only | ||
1101 | wrote 65536/65536 bytes at offset 0 | ||
1102 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1103 | -Block node is read-only | ||
1104 | +qemu-io: Block node is read-only | ||
1105 | |||
1106 | Start from read-write | ||
1107 | |||
1108 | wrote 65536/65536 bytes at offset 0 | ||
1109 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1110 | -Block node is read-only | ||
1111 | +qemu-io: Block node is read-only | ||
1112 | wrote 65536/65536 bytes at offset 0 | ||
1113 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1114 | *** done | ||
1115 | diff --git a/tests/qemu-iotests/188.out b/tests/qemu-iotests/188.out | ||
1116 | index XXXXXXX..XXXXXXX 100644 | ||
1117 | --- a/tests/qemu-iotests/188.out | ||
1118 | +++ b/tests/qemu-iotests/188.out | ||
1119 | @@ -XXX,XX +XXX,XX @@ read 16777216/16777216 bytes at offset 0 | ||
1120 | 16 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1121 | |||
1122 | == verify open failure with wrong password == | ||
1123 | -can't open: Invalid password, cannot unlock any keyslot | ||
1124 | +qemu-io: can't open: Invalid password, cannot unlock any keyslot | ||
1125 | *** done | ||
1126 | diff --git a/tests/qemu-iotests/197.out b/tests/qemu-iotests/197.out | ||
1127 | index XXXXXXX..XXXXXXX 100644 | ||
1128 | --- a/tests/qemu-iotests/197.out | ||
1129 | +++ b/tests/qemu-iotests/197.out | ||
1130 | @@ -XXX,XX +XXX,XX @@ read 2147483136/2147483136 bytes at offset 1024 | ||
1131 | 2 GiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1132 | read 1024/1024 bytes at offset 3221226496 | ||
1133 | 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1134 | -can't open device TEST_DIR/t.wrap.qcow2: Can't use copy-on-read on read-only device | ||
1135 | +qemu-io: can't open device TEST_DIR/t.wrap.qcow2: Can't use copy-on-read on read-only device | ||
1136 | 2 GiB (0x80010000) bytes allocated at offset 0 bytes (0x0) | ||
1137 | 1023.938 MiB (0x3fff0000) bytes not allocated at offset 2 GiB (0x80010000) | ||
1138 | 64 KiB (0x10000) bytes allocated at offset 3 GiB (0xc0000000) | ||
1139 | diff --git a/tests/qemu-iotests/205 b/tests/qemu-iotests/205 | ||
1140 | index XXXXXXX..XXXXXXX 100755 | ||
1141 | --- a/tests/qemu-iotests/205 | ||
1142 | +++ b/tests/qemu-iotests/205 | ||
1143 | @@ -XXX,XX +XXX,XX @@ class TestNbdServerRemove(iotests.QMPTestCase): | ||
1144 | |||
1145 | def assertConnectFailed(self, qemu_io_output): | ||
1146 | self.assertEqual(filter_qemu_io(qemu_io_output).strip(), | ||
1147 | - "can't open device " + nbd_uri + | ||
1148 | + "qemu-io: can't open device " + nbd_uri + | ||
1149 | ": Requested export not available\n" | ||
1150 | "server reported: export 'exp' not present") | ||
1151 | |||
1152 | diff --git a/tests/qemu-iotests/215.out b/tests/qemu-iotests/215.out | ||
1153 | index XXXXXXX..XXXXXXX 100644 | ||
1154 | --- a/tests/qemu-iotests/215.out | ||
1155 | +++ b/tests/qemu-iotests/215.out | ||
1156 | @@ -XXX,XX +XXX,XX @@ read 2147483136/2147483136 bytes at offset 1024 | ||
1157 | 2 GiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1158 | read 1024/1024 bytes at offset 3221226496 | ||
1159 | 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1160 | -can't open device TEST_DIR/t.wrap.qcow2: Block node is read-only | ||
1161 | +qemu-io: can't open device TEST_DIR/t.wrap.qcow2: Block node is read-only | ||
1162 | 2 GiB (0x80010000) bytes allocated at offset 0 bytes (0x0) | ||
1163 | 1023.938 MiB (0x3fff0000) bytes not allocated at offset 2 GiB (0x80010000) | ||
1164 | 64 KiB (0x10000) bytes allocated at offset 3 GiB (0xc0000000) | ||
1165 | diff --git a/tests/qemu-iotests/226.out b/tests/qemu-iotests/226.out | ||
1166 | index XXXXXXX..XXXXXXX 100644 | ||
1167 | --- a/tests/qemu-iotests/226.out | ||
1168 | +++ b/tests/qemu-iotests/226.out | ||
1169 | @@ -XXX,XX +XXX,XX @@ QA output created by 226 | ||
1170 | === Testing with driver:file === | ||
1171 | |||
1172 | == Testing RO == | ||
1173 | -can't open: A regular file was expected by the 'file' driver, but something else was given | ||
1174 | -warning: Opening a character device as a file using the 'file' driver is deprecated | ||
1175 | +qemu-io: can't open: A regular file was expected by the 'file' driver, but something else was given | ||
1176 | +qemu-io: warning: Opening a character device as a file using the 'file' driver is deprecated | ||
1177 | == Testing RW == | ||
1178 | -can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory | ||
1179 | -warning: Opening a character device as a file using the 'file' driver is deprecated | ||
1180 | +qemu-io: can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory | ||
1181 | +qemu-io: warning: Opening a character device as a file using the 'file' driver is deprecated | ||
1182 | |||
1183 | === Testing with driver:host_device === | ||
1184 | |||
1185 | == Testing RO == | ||
1186 | -can't open: 'host_device' driver expects either a character or block device | ||
1187 | +qemu-io: can't open: 'host_device' driver expects either a character or block device | ||
1188 | == Testing RW == | ||
1189 | -can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory | ||
1190 | +qemu-io: can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory | ||
1191 | |||
1192 | === Testing with driver:host_cdrom === | ||
1193 | |||
1194 | == Testing RO == | ||
1195 | -can't open: 'host_cdrom' driver expects either a character or block device | ||
1196 | +qemu-io: can't open: 'host_cdrom' driver expects either a character or block device | ||
1197 | == Testing RW == | ||
1198 | -can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory | ||
1199 | +qemu-io: can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory | ||
1200 | |||
1201 | *** done | ||
1202 | diff --git a/tests/qemu-iotests/244.out b/tests/qemu-iotests/244.out | ||
1203 | index XXXXXXX..XXXXXXX 100644 | ||
1204 | --- a/tests/qemu-iotests/244.out | ||
1205 | +++ b/tests/qemu-iotests/244.out | ||
1206 | @@ -XXX,XX +XXX,XX @@ read 65536/65536 bytes at offset 0 | ||
1207 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1208 | read 65536/65536 bytes at offset 0 | ||
1209 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1210 | -can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory | ||
1211 | +qemu-io: can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory | ||
1212 | no file open, try 'help open' | ||
1213 | |||
1214 | Data file required, but without data file name in the image: | ||
1215 | -can't open device TEST_DIR/t.qcow2: 'data-file' is required for this image | ||
1216 | +qemu-io: can't open device TEST_DIR/t.qcow2: 'data-file' is required for this image | ||
1217 | no file open, try 'help open' | ||
1218 | read 65536/65536 bytes at offset 0 | ||
1219 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
1220 | -can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory | ||
1221 | +qemu-io: can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory | ||
1222 | no file open, try 'help open' | ||
1223 | |||
1224 | Setting data-file for an image with internal data: | ||
1225 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
1226 | -can't open device TEST_DIR/t.qcow2: 'data-file' can only be set for images with an external data file | ||
1227 | +qemu-io: can't open device TEST_DIR/t.qcow2: 'data-file' can only be set for images with an external data file | ||
1228 | no file open, try 'help open' | ||
1229 | -can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory | ||
1230 | +qemu-io: can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory | ||
1231 | no file open, try 'help open' | ||
1232 | |||
1233 | === Conflicting features === | ||
173 | -- | 1234 | -- |
174 | 2.19.1 | 1235 | 2.20.1 |
175 | 1236 | ||
176 | 1237 | diff view generated by jsdifflib |
1 | To fully change the read-only state of a node, we must not only change | 1 | Even for block nodes with bs->drv == NULL, we can't just ignore a |
---|---|---|---|
2 | bs->read_only, but also update bs->open_flags. | 2 | bdrv_set_aio_context() call. Leaving the node in its old context can |
3 | mean that it's still in an iothread context in bdrv_close_all() during | ||
4 | shutdown, resulting in an attempted unlock of the AioContext lock which | ||
5 | we don't hold. | ||
3 | 6 | ||
7 | This is an example stack trace of a related crash: | ||
8 | |||
9 | #0 0x00007ffff59da57f in raise () at /lib64/libc.so.6 | ||
10 | #1 0x00007ffff59c4895 in abort () at /lib64/libc.so.6 | ||
11 | #2 0x0000555555b97b1e in error_exit (err=<optimized out>, msg=msg@entry=0x555555d386d0 <__func__.19059> "qemu_mutex_unlock_impl") at util/qemu-thread-posix.c:36 | ||
12 | #3 0x0000555555b97f7f in qemu_mutex_unlock_impl (mutex=mutex@entry=0x5555568002f0, file=file@entry=0x555555d378df "util/async.c", line=line@entry=507) at util/qemu-thread-posix.c:97 | ||
13 | #4 0x0000555555b92f55 in aio_context_release (ctx=ctx@entry=0x555556800290) at util/async.c:507 | ||
14 | #5 0x0000555555b05cf8 in bdrv_prwv_co (child=child@entry=0x7fffc80012f0, offset=offset@entry=131072, qiov=qiov@entry=0x7fffffffd4f0, is_write=is_write@entry=true, flags=flags@entry=0) | ||
15 | at block/io.c:833 | ||
16 | #6 0x0000555555b060a9 in bdrv_pwritev (qiov=0x7fffffffd4f0, offset=131072, child=0x7fffc80012f0) at block/io.c:990 | ||
17 | #7 0x0000555555b060a9 in bdrv_pwrite (child=0x7fffc80012f0, offset=131072, buf=<optimized out>, bytes=<optimized out>) at block/io.c:990 | ||
18 | #8 0x0000555555ae172b in qcow2_cache_entry_flush (bs=bs@entry=0x555556810680, c=c@entry=0x5555568cc740, i=i@entry=0) at block/qcow2-cache.c:51 | ||
19 | #9 0x0000555555ae18dd in qcow2_cache_write (bs=bs@entry=0x555556810680, c=0x5555568cc740) at block/qcow2-cache.c:248 | ||
20 | #10 0x0000555555ae15de in qcow2_cache_flush (bs=0x555556810680, c=<optimized out>) at block/qcow2-cache.c:259 | ||
21 | #11 0x0000555555ae16b1 in qcow2_cache_flush_dependency (c=0x5555568a1700, c=0x5555568a1700, bs=0x555556810680) at block/qcow2-cache.c:194 | ||
22 | #12 0x0000555555ae16b1 in qcow2_cache_entry_flush (bs=bs@entry=0x555556810680, c=c@entry=0x5555568a1700, i=i@entry=0) at block/qcow2-cache.c:194 | ||
23 | #13 0x0000555555ae18dd in qcow2_cache_write (bs=bs@entry=0x555556810680, c=0x5555568a1700) at block/qcow2-cache.c:248 | ||
24 | #14 0x0000555555ae15de in qcow2_cache_flush (bs=bs@entry=0x555556810680, c=<optimized out>) at block/qcow2-cache.c:259 | ||
25 | #15 0x0000555555ad242c in qcow2_inactivate (bs=bs@entry=0x555556810680) at block/qcow2.c:2124 | ||
26 | #16 0x0000555555ad2590 in qcow2_close (bs=0x555556810680) at block/qcow2.c:2153 | ||
27 | #17 0x0000555555ab0c62 in bdrv_close (bs=0x555556810680) at block.c:3358 | ||
28 | #18 0x0000555555ab0c62 in bdrv_delete (bs=0x555556810680) at block.c:3542 | ||
29 | #19 0x0000555555ab0c62 in bdrv_unref (bs=0x555556810680) at block.c:4598 | ||
30 | #20 0x0000555555af4d72 in blk_remove_bs (blk=blk@entry=0x5555568103d0) at block/block-backend.c:785 | ||
31 | #21 0x0000555555af4dbb in blk_remove_all_bs () at block/block-backend.c:483 | ||
32 | #22 0x0000555555aae02f in bdrv_close_all () at block.c:3412 | ||
33 | #23 0x00005555557f9796 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4776 | ||
34 | |||
35 | The reproducer I used is a qcow2 image on gluster volume, where the | ||
36 | virtual disk size (4 GB) is larger than the gluster volume size (64M), | ||
37 | so we can easily trigger an ENOSPC. This backend is assigned to a | ||
38 | virtio-blk device using an iothread, and then from the guest a | ||
39 | 'dd if=/dev/zero of=/dev/vda bs=1G count=1' causes the VM to stop | ||
40 | because of an I/O error. qemu_gluster_co_flush_to_disk() sets | ||
41 | bs->drv = NULL on error, so when virtio-blk stops the dataplane, the | ||
42 | block nodes stay in the iothread AioContext. A 'quit' monitor command | ||
43 | issued from this paused state crashes the process. | ||
44 | |||
45 | Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1631227 | ||
46 | Cc: qemu-stable@nongnu.org | ||
4 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 47 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
5 | Reviewed-by: Eric Blake <eblake@redhat.com> | 48 | Reviewed-by: Eric Blake <eblake@redhat.com> |
6 | Reviewed-by: Alberto Garcia <berto@igalia.com> | 49 | Reviewed-by: Max Reitz <mreitz@redhat.com> |
50 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | ||
7 | --- | 51 | --- |
8 | block.c | 7 +++++++ | 52 | block.c | 12 ++---------- |
9 | 1 file changed, 7 insertions(+) | 53 | 1 file changed, 2 insertions(+), 10 deletions(-) |
10 | 54 | ||
11 | diff --git a/block.c b/block.c | 55 | diff --git a/block.c b/block.c |
12 | index XXXXXXX..XXXXXXX 100644 | 56 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/block.c | 57 | --- a/block.c |
14 | +++ b/block.c | 58 | +++ b/block.c |
15 | @@ -XXX,XX +XXX,XX @@ int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp) | 59 | @@ -XXX,XX +XXX,XX @@ void bdrv_detach_aio_context(BlockDriverState *bs) |
60 | BdrvAioNotifier *baf, *baf_tmp; | ||
61 | BdrvChild *child; | ||
62 | |||
63 | - if (!bs->drv) { | ||
64 | - return; | ||
65 | - } | ||
66 | - | ||
67 | assert(!bs->walking_aio_notifiers); | ||
68 | bs->walking_aio_notifiers = true; | ||
69 | QLIST_FOREACH_SAFE(baf, &bs->aio_notifiers, list, baf_tmp) { | ||
70 | @@ -XXX,XX +XXX,XX @@ void bdrv_detach_aio_context(BlockDriverState *bs) | ||
71 | */ | ||
72 | bs->walking_aio_notifiers = false; | ||
73 | |||
74 | - if (bs->drv->bdrv_detach_aio_context) { | ||
75 | + if (bs->drv && bs->drv->bdrv_detach_aio_context) { | ||
76 | bs->drv->bdrv_detach_aio_context(bs); | ||
16 | } | 77 | } |
17 | 78 | QLIST_FOREACH(child, &bs->children, next) { | |
18 | bs->read_only = read_only; | 79 | @@ -XXX,XX +XXX,XX @@ void bdrv_attach_aio_context(BlockDriverState *bs, |
19 | + | 80 | BdrvAioNotifier *ban, *ban_tmp; |
20 | + if (read_only) { | 81 | BdrvChild *child; |
21 | + bs->open_flags &= ~BDRV_O_RDWR; | 82 | |
22 | + } else { | 83 | - if (!bs->drv) { |
23 | + bs->open_flags |= BDRV_O_RDWR; | 84 | - return; |
24 | + } | 85 | - } |
25 | + | 86 | - |
26 | return 0; | 87 | if (bs->quiesce_counter) { |
27 | } | 88 | aio_disable_external(new_context); |
89 | } | ||
90 | @@ -XXX,XX +XXX,XX @@ void bdrv_attach_aio_context(BlockDriverState *bs, | ||
91 | QLIST_FOREACH(child, &bs->children, next) { | ||
92 | bdrv_attach_aio_context(child->bs, new_context); | ||
93 | } | ||
94 | - if (bs->drv->bdrv_attach_aio_context) { | ||
95 | + if (bs->drv && bs->drv->bdrv_attach_aio_context) { | ||
96 | bs->drv->bdrv_attach_aio_context(bs, new_context); | ||
97 | } | ||
28 | 98 | ||
29 | -- | 99 | -- |
30 | 2.19.1 | 100 | 2.20.1 |
31 | 101 | ||
32 | 102 | diff view generated by jsdifflib |
1 | From: Zhengui li <lizhengui@huawei.com> | ||
---|---|---|---|
2 | |||
3 | Concurrent IO becomes serial IO because of the qemu Coroutine lock, | ||
4 | which reduce IO performance severely. | ||
5 | |||
6 | So unlock Coroutine lock before bdrv_co_pwritev and | ||
7 | bdrv_co_preadv to fix it. | ||
8 | |||
9 | Signed-off-by: Zhengui li <lizhengui@huawei.com> | ||
10 | Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> | ||
1 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
2 | Reviewed-by: Alberto Garcia <berto@igalia.com> | ||
3 | --- | 12 | --- |
4 | block/vpc.c | 2 ++ | 13 | block/vpc.c | 4 ++++ |
5 | 1 file changed, 2 insertions(+) | 14 | 1 file changed, 4 insertions(+) |
6 | 15 | ||
7 | diff --git a/block/vpc.c b/block/vpc.c | 16 | diff --git a/block/vpc.c b/block/vpc.c |
8 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
9 | --- a/block/vpc.c | 18 | --- a/block/vpc.c |
10 | +++ b/block/vpc.c | 19 | +++ b/block/vpc.c |
11 | @@ -XXX,XX +XXX,XX @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags, | 20 | @@ -XXX,XX +XXX,XX @@ vpc_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, |
12 | } | 21 | qemu_iovec_reset(&local_qiov); |
13 | 22 | qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes); | |
14 | qemu_co_mutex_init(&s->lock); | 23 | |
15 | + qemu_opts_del(opts); | 24 | + qemu_co_mutex_unlock(&s->lock); |
16 | 25 | ret = bdrv_co_preadv(bs->file, image_offset, n_bytes, | |
17 | return 0; | 26 | &local_qiov, 0); |
18 | 27 | + qemu_co_mutex_lock(&s->lock); | |
19 | fail: | 28 | if (ret < 0) { |
20 | + qemu_opts_del(opts); | 29 | goto fail; |
21 | qemu_vfree(s->pagetable); | 30 | } |
22 | #ifdef CACHE | 31 | @@ -XXX,XX +XXX,XX @@ vpc_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, |
23 | g_free(s->pageentry_u8); | 32 | qemu_iovec_reset(&local_qiov); |
33 | qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes); | ||
34 | |||
35 | + qemu_co_mutex_unlock(&s->lock); | ||
36 | ret = bdrv_co_pwritev(bs->file, image_offset, n_bytes, | ||
37 | &local_qiov, 0); | ||
38 | + qemu_co_mutex_lock(&s->lock); | ||
39 | if (ret < 0) { | ||
40 | goto fail; | ||
41 | } | ||
24 | -- | 42 | -- |
25 | 2.19.1 | 43 | 2.20.1 |
26 | 44 | ||
27 | 45 | diff view generated by jsdifflib |
1 | From: Max Reitz <mreitz@redhat.com> | 1 | From: Sam Eiderman <shmuel.eiderman@oracle.com> |
---|---|---|---|
2 | 2 | ||
3 | Just like in qemu_opts_print_help(), print the device name as a caption | 3 | Commit b69864e5a ("vmdk: Support version=3 in VMDK descriptor files") |
4 | instead of on every single line, indent all options, add angle brackets | 4 | fixed the probe function to correctly guess vmdk descriptors with |
5 | around types, and align the descriptions after 24 characters. Also, | 5 | version=3. |
6 | separate the descriptions with " - " instead of putting them in | ||
7 | parentheses, because that is what we do everywhere else. This does look | ||
8 | a bit funny here because basically all bits have the description | ||
9 | "on/off", but funny does not mean it is less readable. | ||
10 | 6 | ||
11 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 7 | This solves the issue where vmdk snapshot with parent vmdk descriptor |
12 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> | 8 | containing "version=3" would be treated as raw instead vmdk. |
9 | |||
10 | In the future case where a new vmdk version is introduced, we will again | ||
11 | experience this issue, even if the user will provide "-f vmdk" it will | ||
12 | only apply to the tip image and not to the underlying "misprobed" parent | ||
13 | image. | ||
14 | |||
15 | The code in vmdk.c already assumes that the backing file of vmdk must be | ||
16 | vmdk (see vmdk_is_cid_valid which returns 0 if backing file is not | ||
17 | vmdk). | ||
18 | |||
19 | So let's make it official by supplying the backing_format as vmdk. | ||
20 | |||
21 | Reviewed-by: Mark Kanda <mark.kanda@oracle.com> | ||
22 | Reviewed-By: Liran Alon <liran.alon@oracle.com> | ||
23 | Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com> | ||
24 | Signed-off-by: Shmuel Eiderman <shmuel.eiderman@oracle.com> | ||
25 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
26 | Reviewed-by: Fam Zheng <fam@euphon.net> | ||
13 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 27 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
14 | --- | 28 | --- |
15 | qdev-monitor.c | 13 +++++++++++-- | 29 | block/vmdk.c | 2 ++ |
16 | 1 file changed, 11 insertions(+), 2 deletions(-) | 30 | 1 file changed, 2 insertions(+) |
17 | 31 | ||
18 | diff --git a/qdev-monitor.c b/qdev-monitor.c | 32 | diff --git a/block/vmdk.c b/block/vmdk.c |
19 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/qdev-monitor.c | 34 | --- a/block/vmdk.c |
21 | +++ b/qdev-monitor.c | 35 | +++ b/block/vmdk.c |
22 | @@ -XXX,XX +XXX,XX @@ int qdev_device_help(QemuOpts *opts) | 36 | @@ -XXX,XX +XXX,XX @@ static int vmdk_parent_open(BlockDriverState *bs) |
23 | goto error; | 37 | pstrcpy(bs->auto_backing_file, end_name - p_name + 1, p_name); |
38 | pstrcpy(bs->backing_file, sizeof(bs->backing_file), | ||
39 | bs->auto_backing_file); | ||
40 | + pstrcpy(bs->backing_format, sizeof(bs->backing_format), | ||
41 | + "vmdk"); | ||
24 | } | 42 | } |
25 | 43 | ||
26 | + if (prop_list) { | 44 | out: |
27 | + out_printf("%s options:\n", driver); | ||
28 | + } else { | ||
29 | + out_printf("There are no options for %s.\n", driver); | ||
30 | + } | ||
31 | for (prop = prop_list; prop; prop = prop->next) { | ||
32 | - out_printf("%s.%s=%s", driver, prop->value->name, prop->value->type); | ||
33 | + int len; | ||
34 | + out_printf(" %s=<%s>%n", prop->value->name, prop->value->type, &len); | ||
35 | if (prop->value->has_description) { | ||
36 | - out_printf(" (%s)\n", prop->value->description); | ||
37 | + if (len < 24) { | ||
38 | + out_printf("%*s", 24 - len, ""); | ||
39 | + } | ||
40 | + out_printf(" - %s\n", prop->value->description); | ||
41 | } else { | ||
42 | out_printf("\n"); | ||
43 | } | ||
44 | -- | 45 | -- |
45 | 2.19.1 | 46 | 2.20.1 |
46 | 47 | ||
47 | 48 | diff view generated by jsdifflib |
1 | From: Cleber Rosa <crosa@redhat.com> | 1 | From: Stefano Garzarella <sgarzare@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | While testing the Python 3 changes which touch the 083 test, I noticed | 3 | IEC binary prefixes are already defined in "qemu/units.h", |
4 | that it would fail with qcow2. Expanding the testing, I noticed it | 4 | so we can remove redundant definitions in "block/vhdx.h". |
5 | had nothing to do with the Python 3 changes, and in fact, it would not | ||
6 | pass on anything but raw: | ||
7 | 5 | ||
8 | raw: pass | 6 | Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> |
9 | bochs: not generic | 7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
10 | cloop: not generic | 8 | Reviewed-by: John Snow <jsnow@redhat.com> |
11 | parallels: fail | ||
12 | qcow: fail | ||
13 | qcow2: fail | ||
14 | qed: fail | ||
15 | vdi: fail | ||
16 | vhdx: fail | ||
17 | vmdk: fail | ||
18 | vpc: fail | ||
19 | luks: fail | ||
20 | |||
21 | The errors are a mixture I/O and "image not in xxx format", such as: | ||
22 | |||
23 | === Check disconnect before data === | ||
24 | |||
25 | Unexpected end-of-file before all bytes were read | ||
26 | -read failed: Input/output error | ||
27 | +can't open device nbd+tcp://127.0.0.1:PORT/foo: Could not open 'nbd://127.0.0.1:PORT/foo': Input/output error | ||
28 | |||
29 | === Check disconnect after data === | ||
30 | |||
31 | -read 512/512 bytes at offset 0 | ||
32 | -512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
33 | +can't open device nbd+tcp://127.0.0.1:PORT/foo: Image not in qcow format | ||
34 | |||
35 | I'm not aware if there's a quick fix, so, for the time being, it looks | ||
36 | like the honest approach is to make the test known to work on raw | ||
37 | only. | ||
38 | |||
39 | Signed-off-by: Cleber Rosa <crosa@redhat.com> | ||
40 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 9 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
41 | --- | 10 | --- |
42 | tests/qemu-iotests/083 | 2 +- | 11 | block/vhdx.h | 6 +----- |
43 | 1 file changed, 1 insertion(+), 1 deletion(-) | 12 | block/vhdx.c | 3 ++- |
13 | 2 files changed, 3 insertions(+), 6 deletions(-) | ||
44 | 14 | ||
45 | diff --git a/tests/qemu-iotests/083 b/tests/qemu-iotests/083 | 15 | diff --git a/block/vhdx.h b/block/vhdx.h |
46 | index XXXXXXX..XXXXXXX 100755 | 16 | index XXXXXXX..XXXXXXX 100644 |
47 | --- a/tests/qemu-iotests/083 | 17 | --- a/block/vhdx.h |
48 | +++ b/tests/qemu-iotests/083 | 18 | +++ b/block/vhdx.h |
49 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | 19 | @@ -XXX,XX +XXX,XX @@ |
50 | . ./common.rc | 20 | |
51 | . ./common.filter | 21 | #ifndef BLOCK_VHDX_H |
52 | 22 | #define BLOCK_VHDX_H | |
53 | -_supported_fmt generic | 23 | - |
54 | +_supported_fmt raw | 24 | -#define KiB (1 * 1024) |
55 | _supported_proto nbd | 25 | -#define MiB (KiB * 1024) |
56 | _supported_os Linux | 26 | -#define GiB (MiB * 1024) |
27 | -#define TiB ((uint64_t) GiB * 1024) | ||
28 | +#include "qemu/units.h" | ||
29 | |||
30 | #define DEFAULT_LOG_SIZE 1048576 /* 1MiB */ | ||
31 | /* Structures and fields present in the VHDX file */ | ||
32 | diff --git a/block/vhdx.c b/block/vhdx.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/block/vhdx.c | ||
35 | +++ b/block/vhdx.c | ||
36 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn vhdx_co_create(BlockdevCreateOptions *opts, | ||
37 | return -EINVAL; | ||
38 | } | ||
39 | if (block_size > VHDX_BLOCK_SIZE_MAX) { | ||
40 | - error_setg(errp, "Block size must not exceed %d", VHDX_BLOCK_SIZE_MAX); | ||
41 | + error_setg(errp, "Block size must not exceed %" PRId64, | ||
42 | + VHDX_BLOCK_SIZE_MAX); | ||
43 | return -EINVAL; | ||
44 | } | ||
57 | 45 | ||
58 | -- | 46 | -- |
59 | 2.19.1 | 47 | 2.20.1 |
60 | 48 | ||
61 | 49 | diff view generated by jsdifflib |
1 | From: Peter Maydell <peter.maydell@linaro.org> | 1 | From: Stefano Garzarella <sgarzare@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Taking the address of a field in a packed struct is a bad idea, because | 3 | Using IEC binary prefixes in order to make the code more readable, |
4 | it might not be actually aligned enough for that pointer type (and | 4 | with the exception of DEFAULT_LOG_SIZE because it's passed to |
5 | thus cause a crash on dereference on some host architectures). Newer | 5 | stringify(). |
6 | versions of clang warn about this. Avoid the bug by not using the | ||
7 | "modify in place" byte swapping functions. | ||
8 | 6 | ||
9 | There are a few places where the in-place swap function is | 7 | Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> |
10 | used on something other than a packed struct field; we convert | 8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
11 | those anyway, for consistency. | 9 | Reviewed-by: John Snow <jsnow@redhat.com> |
12 | |||
13 | Patch produced with scripts/coccinelle/inplace-byteswaps.cocci. | ||
14 | |||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
17 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 10 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
18 | --- | 11 | --- |
19 | block/vhdx.h | 12 ++--- | 12 | block/vhdx.h | 10 ++++++---- |
20 | block/vhdx-endian.c | 118 ++++++++++++++++++++++---------------------- | 13 | block/vhdx-log.c | 2 +- |
21 | block/vhdx-log.c | 4 +- | 14 | block/vhdx.c | 4 ++-- |
22 | block/vhdx.c | 18 +++---- | 15 | 3 files changed, 9 insertions(+), 7 deletions(-) |
23 | 4 files changed, 76 insertions(+), 76 deletions(-) | ||
24 | 16 | ||
25 | diff --git a/block/vhdx.h b/block/vhdx.h | 17 | diff --git a/block/vhdx.h b/block/vhdx.h |
26 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/block/vhdx.h | 19 | --- a/block/vhdx.h |
28 | +++ b/block/vhdx.h | 20 | +++ b/block/vhdx.h |
29 | @@ -XXX,XX +XXX,XX @@ int vhdx_log_write_and_flush(BlockDriverState *bs, BDRVVHDXState *s, | 21 | @@ -XXX,XX +XXX,XX @@ |
30 | 22 | #include "qemu/units.h" | |
31 | static inline void leguid_to_cpus(MSGUID *guid) | 23 | |
32 | { | 24 | #define DEFAULT_LOG_SIZE 1048576 /* 1MiB */ |
33 | - le32_to_cpus(&guid->data1); | 25 | +/* Note: can't use 1 * MiB, because it's passed to stringify() */ |
34 | - le16_to_cpus(&guid->data2); | 26 | + |
35 | - le16_to_cpus(&guid->data3); | 27 | /* Structures and fields present in the VHDX file */ |
36 | + guid->data1 = le32_to_cpu(guid->data1); | 28 | |
37 | + guid->data2 = le16_to_cpu(guid->data2); | 29 | /* The header section has the following blocks, |
38 | + guid->data3 = le16_to_cpu(guid->data3); | 30 | @@ -XXX,XX +XXX,XX @@ |
39 | } | 31 | * 0.........64KB...........128KB........192KB..........256KB................1MB |
40 | 32 | */ | |
41 | static inline void cpu_to_leguids(MSGUID *guid) | 33 | |
42 | { | 34 | -#define VHDX_HEADER_BLOCK_SIZE (64 * 1024) |
43 | - cpu_to_le32s(&guid->data1); | 35 | +#define VHDX_HEADER_BLOCK_SIZE (64 * KiB) |
44 | - cpu_to_le16s(&guid->data2); | 36 | |
45 | - cpu_to_le16s(&guid->data3); | 37 | #define VHDX_FILE_ID_OFFSET 0 |
46 | + guid->data1 = cpu_to_le32(guid->data1); | 38 | #define VHDX_HEADER1_OFFSET (VHDX_HEADER_BLOCK_SIZE * 1) |
47 | + guid->data2 = cpu_to_le16(guid->data2); | 39 | @@ -XXX,XX +XXX,XX @@ typedef struct QEMU_PACKED MSGUID { |
48 | + guid->data3 = cpu_to_le16(guid->data3); | 40 | #define guid_eq(a, b) \ |
49 | } | 41 | (memcmp(&(a), &(b), sizeof(MSGUID)) == 0) |
50 | 42 | ||
51 | void vhdx_header_le_import(VHDXHeader *h); | 43 | -#define VHDX_HEADER_SIZE (4 * 1024) /* although the vhdx_header struct in disk |
52 | diff --git a/block/vhdx-endian.c b/block/vhdx-endian.c | 44 | +#define VHDX_HEADER_SIZE (4 * KiB) /* although the vhdx_header struct in disk |
53 | index XXXXXXX..XXXXXXX 100644 | 45 | is only 582 bytes, for purposes of crc |
54 | --- a/block/vhdx-endian.c | 46 | the header is the first 4KB of the 64KB |
55 | +++ b/block/vhdx-endian.c | 47 | block */ |
56 | @@ -XXX,XX +XXX,XX @@ void vhdx_header_le_import(VHDXHeader *h) | 48 | @@ -XXX,XX +XXX,XX @@ typedef struct QEMU_PACKED VHDXRegionTableEntry { |
57 | { | 49 | |
58 | assert(h != NULL); | 50 | |
59 | 51 | /* ---- LOG ENTRY STRUCTURES ---- */ | |
60 | - le32_to_cpus(&h->signature); | 52 | -#define VHDX_LOG_MIN_SIZE (1024 * 1024) |
61 | - le32_to_cpus(&h->checksum); | 53 | -#define VHDX_LOG_SECTOR_SIZE 4096 |
62 | - le64_to_cpus(&h->sequence_number); | 54 | +#define VHDX_LOG_MIN_SIZE (1 * MiB) |
63 | + h->signature = le32_to_cpu(h->signature); | 55 | +#define VHDX_LOG_SECTOR_SIZE (4 * KiB) |
64 | + h->checksum = le32_to_cpu(h->checksum); | 56 | #define VHDX_LOG_HDR_SIZE 64 |
65 | + h->sequence_number = le64_to_cpu(h->sequence_number); | 57 | #define VHDX_LOG_SIGNATURE 0x65676f6c |
66 | 58 | typedef struct QEMU_PACKED VHDXLogEntryHeader { | |
67 | leguid_to_cpus(&h->file_write_guid); | ||
68 | leguid_to_cpus(&h->data_write_guid); | ||
69 | leguid_to_cpus(&h->log_guid); | ||
70 | |||
71 | - le16_to_cpus(&h->log_version); | ||
72 | - le16_to_cpus(&h->version); | ||
73 | - le32_to_cpus(&h->log_length); | ||
74 | - le64_to_cpus(&h->log_offset); | ||
75 | + h->log_version = le16_to_cpu(h->log_version); | ||
76 | + h->version = le16_to_cpu(h->version); | ||
77 | + h->log_length = le32_to_cpu(h->log_length); | ||
78 | + h->log_offset = le64_to_cpu(h->log_offset); | ||
79 | } | ||
80 | |||
81 | void vhdx_header_le_export(VHDXHeader *orig_h, VHDXHeader *new_h) | ||
82 | @@ -XXX,XX +XXX,XX @@ void vhdx_log_desc_le_import(VHDXLogDescriptor *d) | ||
83 | { | ||
84 | assert(d != NULL); | ||
85 | |||
86 | - le32_to_cpus(&d->signature); | ||
87 | - le64_to_cpus(&d->file_offset); | ||
88 | - le64_to_cpus(&d->sequence_number); | ||
89 | + d->signature = le32_to_cpu(d->signature); | ||
90 | + d->file_offset = le64_to_cpu(d->file_offset); | ||
91 | + d->sequence_number = le64_to_cpu(d->sequence_number); | ||
92 | } | ||
93 | |||
94 | void vhdx_log_desc_le_export(VHDXLogDescriptor *d) | ||
95 | { | ||
96 | assert(d != NULL); | ||
97 | |||
98 | - cpu_to_le32s(&d->signature); | ||
99 | - cpu_to_le32s(&d->trailing_bytes); | ||
100 | - cpu_to_le64s(&d->leading_bytes); | ||
101 | - cpu_to_le64s(&d->file_offset); | ||
102 | - cpu_to_le64s(&d->sequence_number); | ||
103 | + d->signature = cpu_to_le32(d->signature); | ||
104 | + d->trailing_bytes = cpu_to_le32(d->trailing_bytes); | ||
105 | + d->leading_bytes = cpu_to_le64(d->leading_bytes); | ||
106 | + d->file_offset = cpu_to_le64(d->file_offset); | ||
107 | + d->sequence_number = cpu_to_le64(d->sequence_number); | ||
108 | } | ||
109 | |||
110 | void vhdx_log_data_le_import(VHDXLogDataSector *d) | ||
111 | { | ||
112 | assert(d != NULL); | ||
113 | |||
114 | - le32_to_cpus(&d->data_signature); | ||
115 | - le32_to_cpus(&d->sequence_high); | ||
116 | - le32_to_cpus(&d->sequence_low); | ||
117 | + d->data_signature = le32_to_cpu(d->data_signature); | ||
118 | + d->sequence_high = le32_to_cpu(d->sequence_high); | ||
119 | + d->sequence_low = le32_to_cpu(d->sequence_low); | ||
120 | } | ||
121 | |||
122 | void vhdx_log_data_le_export(VHDXLogDataSector *d) | ||
123 | { | ||
124 | assert(d != NULL); | ||
125 | |||
126 | - cpu_to_le32s(&d->data_signature); | ||
127 | - cpu_to_le32s(&d->sequence_high); | ||
128 | - cpu_to_le32s(&d->sequence_low); | ||
129 | + d->data_signature = cpu_to_le32(d->data_signature); | ||
130 | + d->sequence_high = cpu_to_le32(d->sequence_high); | ||
131 | + d->sequence_low = cpu_to_le32(d->sequence_low); | ||
132 | } | ||
133 | |||
134 | void vhdx_log_entry_hdr_le_import(VHDXLogEntryHeader *hdr) | ||
135 | { | ||
136 | assert(hdr != NULL); | ||
137 | |||
138 | - le32_to_cpus(&hdr->signature); | ||
139 | - le32_to_cpus(&hdr->checksum); | ||
140 | - le32_to_cpus(&hdr->entry_length); | ||
141 | - le32_to_cpus(&hdr->tail); | ||
142 | - le64_to_cpus(&hdr->sequence_number); | ||
143 | - le32_to_cpus(&hdr->descriptor_count); | ||
144 | + hdr->signature = le32_to_cpu(hdr->signature); | ||
145 | + hdr->checksum = le32_to_cpu(hdr->checksum); | ||
146 | + hdr->entry_length = le32_to_cpu(hdr->entry_length); | ||
147 | + hdr->tail = le32_to_cpu(hdr->tail); | ||
148 | + hdr->sequence_number = le64_to_cpu(hdr->sequence_number); | ||
149 | + hdr->descriptor_count = le32_to_cpu(hdr->descriptor_count); | ||
150 | leguid_to_cpus(&hdr->log_guid); | ||
151 | - le64_to_cpus(&hdr->flushed_file_offset); | ||
152 | - le64_to_cpus(&hdr->last_file_offset); | ||
153 | + hdr->flushed_file_offset = le64_to_cpu(hdr->flushed_file_offset); | ||
154 | + hdr->last_file_offset = le64_to_cpu(hdr->last_file_offset); | ||
155 | } | ||
156 | |||
157 | void vhdx_log_entry_hdr_le_export(VHDXLogEntryHeader *hdr) | ||
158 | { | ||
159 | assert(hdr != NULL); | ||
160 | |||
161 | - cpu_to_le32s(&hdr->signature); | ||
162 | - cpu_to_le32s(&hdr->checksum); | ||
163 | - cpu_to_le32s(&hdr->entry_length); | ||
164 | - cpu_to_le32s(&hdr->tail); | ||
165 | - cpu_to_le64s(&hdr->sequence_number); | ||
166 | - cpu_to_le32s(&hdr->descriptor_count); | ||
167 | + hdr->signature = cpu_to_le32(hdr->signature); | ||
168 | + hdr->checksum = cpu_to_le32(hdr->checksum); | ||
169 | + hdr->entry_length = cpu_to_le32(hdr->entry_length); | ||
170 | + hdr->tail = cpu_to_le32(hdr->tail); | ||
171 | + hdr->sequence_number = cpu_to_le64(hdr->sequence_number); | ||
172 | + hdr->descriptor_count = cpu_to_le32(hdr->descriptor_count); | ||
173 | cpu_to_leguids(&hdr->log_guid); | ||
174 | - cpu_to_le64s(&hdr->flushed_file_offset); | ||
175 | - cpu_to_le64s(&hdr->last_file_offset); | ||
176 | + hdr->flushed_file_offset = cpu_to_le64(hdr->flushed_file_offset); | ||
177 | + hdr->last_file_offset = cpu_to_le64(hdr->last_file_offset); | ||
178 | } | ||
179 | |||
180 | |||
181 | @@ -XXX,XX +XXX,XX @@ void vhdx_region_header_le_import(VHDXRegionTableHeader *hdr) | ||
182 | { | ||
183 | assert(hdr != NULL); | ||
184 | |||
185 | - le32_to_cpus(&hdr->signature); | ||
186 | - le32_to_cpus(&hdr->checksum); | ||
187 | - le32_to_cpus(&hdr->entry_count); | ||
188 | + hdr->signature = le32_to_cpu(hdr->signature); | ||
189 | + hdr->checksum = le32_to_cpu(hdr->checksum); | ||
190 | + hdr->entry_count = le32_to_cpu(hdr->entry_count); | ||
191 | } | ||
192 | |||
193 | void vhdx_region_header_le_export(VHDXRegionTableHeader *hdr) | ||
194 | { | ||
195 | assert(hdr != NULL); | ||
196 | |||
197 | - cpu_to_le32s(&hdr->signature); | ||
198 | - cpu_to_le32s(&hdr->checksum); | ||
199 | - cpu_to_le32s(&hdr->entry_count); | ||
200 | + hdr->signature = cpu_to_le32(hdr->signature); | ||
201 | + hdr->checksum = cpu_to_le32(hdr->checksum); | ||
202 | + hdr->entry_count = cpu_to_le32(hdr->entry_count); | ||
203 | } | ||
204 | |||
205 | void vhdx_region_entry_le_import(VHDXRegionTableEntry *e) | ||
206 | @@ -XXX,XX +XXX,XX @@ void vhdx_region_entry_le_import(VHDXRegionTableEntry *e) | ||
207 | assert(e != NULL); | ||
208 | |||
209 | leguid_to_cpus(&e->guid); | ||
210 | - le64_to_cpus(&e->file_offset); | ||
211 | - le32_to_cpus(&e->length); | ||
212 | - le32_to_cpus(&e->data_bits); | ||
213 | + e->file_offset = le64_to_cpu(e->file_offset); | ||
214 | + e->length = le32_to_cpu(e->length); | ||
215 | + e->data_bits = le32_to_cpu(e->data_bits); | ||
216 | } | ||
217 | |||
218 | void vhdx_region_entry_le_export(VHDXRegionTableEntry *e) | ||
219 | @@ -XXX,XX +XXX,XX @@ void vhdx_region_entry_le_export(VHDXRegionTableEntry *e) | ||
220 | assert(e != NULL); | ||
221 | |||
222 | cpu_to_leguids(&e->guid); | ||
223 | - cpu_to_le64s(&e->file_offset); | ||
224 | - cpu_to_le32s(&e->length); | ||
225 | - cpu_to_le32s(&e->data_bits); | ||
226 | + e->file_offset = cpu_to_le64(e->file_offset); | ||
227 | + e->length = cpu_to_le32(e->length); | ||
228 | + e->data_bits = cpu_to_le32(e->data_bits); | ||
229 | } | ||
230 | |||
231 | |||
232 | @@ -XXX,XX +XXX,XX @@ void vhdx_metadata_header_le_import(VHDXMetadataTableHeader *hdr) | ||
233 | { | ||
234 | assert(hdr != NULL); | ||
235 | |||
236 | - le64_to_cpus(&hdr->signature); | ||
237 | - le16_to_cpus(&hdr->entry_count); | ||
238 | + hdr->signature = le64_to_cpu(hdr->signature); | ||
239 | + hdr->entry_count = le16_to_cpu(hdr->entry_count); | ||
240 | } | ||
241 | |||
242 | void vhdx_metadata_header_le_export(VHDXMetadataTableHeader *hdr) | ||
243 | { | ||
244 | assert(hdr != NULL); | ||
245 | |||
246 | - cpu_to_le64s(&hdr->signature); | ||
247 | - cpu_to_le16s(&hdr->entry_count); | ||
248 | + hdr->signature = cpu_to_le64(hdr->signature); | ||
249 | + hdr->entry_count = cpu_to_le16(hdr->entry_count); | ||
250 | } | ||
251 | |||
252 | void vhdx_metadata_entry_le_import(VHDXMetadataTableEntry *e) | ||
253 | @@ -XXX,XX +XXX,XX @@ void vhdx_metadata_entry_le_import(VHDXMetadataTableEntry *e) | ||
254 | assert(e != NULL); | ||
255 | |||
256 | leguid_to_cpus(&e->item_id); | ||
257 | - le32_to_cpus(&e->offset); | ||
258 | - le32_to_cpus(&e->length); | ||
259 | - le32_to_cpus(&e->data_bits); | ||
260 | + e->offset = le32_to_cpu(e->offset); | ||
261 | + e->length = le32_to_cpu(e->length); | ||
262 | + e->data_bits = le32_to_cpu(e->data_bits); | ||
263 | } | ||
264 | void vhdx_metadata_entry_le_export(VHDXMetadataTableEntry *e) | ||
265 | { | ||
266 | assert(e != NULL); | ||
267 | |||
268 | cpu_to_leguids(&e->item_id); | ||
269 | - cpu_to_le32s(&e->offset); | ||
270 | - cpu_to_le32s(&e->length); | ||
271 | - cpu_to_le32s(&e->data_bits); | ||
272 | + e->offset = cpu_to_le32(e->offset); | ||
273 | + e->length = cpu_to_le32(e->length); | ||
274 | + e->data_bits = cpu_to_le32(e->data_bits); | ||
275 | } | ||
276 | diff --git a/block/vhdx-log.c b/block/vhdx-log.c | 59 | diff --git a/block/vhdx-log.c b/block/vhdx-log.c |
277 | index XXXXXXX..XXXXXXX 100644 | 60 | index XXXXXXX..XXXXXXX 100644 |
278 | --- a/block/vhdx-log.c | 61 | --- a/block/vhdx-log.c |
279 | +++ b/block/vhdx-log.c | 62 | +++ b/block/vhdx-log.c |
280 | @@ -XXX,XX +XXX,XX @@ static void vhdx_log_raw_to_le_sector(VHDXLogDescriptor *desc, | 63 | @@ -XXX,XX +XXX,XX @@ static int vhdx_log_flush(BlockDriverState *bs, BDRVVHDXState *s, |
281 | /* 8 + 4084 + 4 = 4096, 1 log sector */ | 64 | } |
282 | memcpy(&desc->leading_bytes, data, 8); | 65 | if (file_length < desc_entries->hdr.last_file_offset) { |
283 | data += 8; | 66 | new_file_size = desc_entries->hdr.last_file_offset; |
284 | - cpu_to_le64s(&desc->leading_bytes); | 67 | - if (new_file_size % (1024*1024)) { |
285 | + desc->leading_bytes = cpu_to_le64(desc->leading_bytes); | 68 | + if (new_file_size % (1 * MiB)) { |
286 | memcpy(sector->data, data, 4084); | 69 | /* round up to nearest 1MB boundary */ |
287 | data += 4084; | 70 | new_file_size = QEMU_ALIGN_UP(new_file_size, MiB); |
288 | memcpy(&desc->trailing_bytes, data, 4); | 71 | if (new_file_size > INT64_MAX) { |
289 | - cpu_to_le32s(&desc->trailing_bytes); | ||
290 | + desc->trailing_bytes = cpu_to_le32(desc->trailing_bytes); | ||
291 | data += 4; | ||
292 | |||
293 | sector->sequence_high = (uint32_t) (seq >> 32); | ||
294 | diff --git a/block/vhdx.c b/block/vhdx.c | 72 | diff --git a/block/vhdx.c b/block/vhdx.c |
295 | index XXXXXXX..XXXXXXX 100644 | 73 | index XXXXXXX..XXXXXXX 100644 |
296 | --- a/block/vhdx.c | 74 | --- a/block/vhdx.c |
297 | +++ b/block/vhdx.c | 75 | +++ b/block/vhdx.c |
298 | @@ -XXX,XX +XXX,XX @@ uint32_t vhdx_update_checksum(uint8_t *buf, size_t size, int crc_offset) | 76 | @@ -XXX,XX +XXX,XX @@ static int vhdx_allocate_block(BlockDriverState *bs, BDRVVHDXState *s, |
299 | 77 | *new_offset = current_len; | |
300 | memset(buf + crc_offset, 0, sizeof(crc)); | 78 | |
301 | crc = crc32c(0xffffffff, buf, size); | 79 | /* per the spec, the address for a block is in units of 1MB */ |
302 | - cpu_to_le32s(&crc); | 80 | - *new_offset = ROUND_UP(*new_offset, 1024 * 1024); |
303 | + crc = cpu_to_le32(crc); | 81 | + *new_offset = ROUND_UP(*new_offset, 1 * MiB); |
304 | memcpy(buf + crc_offset, &crc, sizeof(crc)); | 82 | if (*new_offset > INT64_MAX) { |
305 | 83 | return -EINVAL; | |
306 | return crc; | ||
307 | @@ -XXX,XX +XXX,XX @@ static int vhdx_parse_metadata(BlockDriverState *bs, BDRVVHDXState *s) | ||
308 | goto exit; | ||
309 | } | 84 | } |
310 | 85 | @@ -XXX,XX +XXX,XX @@ static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num, | |
311 | - le32_to_cpus(&s->params.block_size); | 86 | case PAYLOAD_BLOCK_FULLY_PRESENT: |
312 | - le32_to_cpus(&s->params.data_bits); | 87 | /* if the file offset address is in the header zone, |
313 | + s->params.block_size = le32_to_cpu(s->params.block_size); | 88 | * there is a problem */ |
314 | + s->params.data_bits = le32_to_cpu(s->params.data_bits); | 89 | - if (sinfo.file_offset < (1024 * 1024)) { |
315 | 90 | + if (sinfo.file_offset < (1 * MiB)) { | |
316 | 91 | ret = -EFAULT; | |
317 | /* We now have the file parameters, so we can tell if this is a | 92 | goto error_bat_restore; |
318 | @@ -XXX,XX +XXX,XX @@ static int vhdx_parse_metadata(BlockDriverState *bs, BDRVVHDXState *s) | 93 | } |
319 | goto exit; | ||
320 | } | ||
321 | |||
322 | - le64_to_cpus(&s->virtual_disk_size); | ||
323 | - le32_to_cpus(&s->logical_sector_size); | ||
324 | - le32_to_cpus(&s->physical_sector_size); | ||
325 | + s->virtual_disk_size = le64_to_cpu(s->virtual_disk_size); | ||
326 | + s->logical_sector_size = le32_to_cpu(s->logical_sector_size); | ||
327 | + s->physical_sector_size = le32_to_cpu(s->physical_sector_size); | ||
328 | |||
329 | if (s->params.block_size < VHDX_BLOCK_SIZE_MIN || | ||
330 | s->params.block_size > VHDX_BLOCK_SIZE_MAX) { | ||
331 | @@ -XXX,XX +XXX,XX @@ static int vhdx_open(BlockDriverState *bs, QDict *options, int flags, | ||
332 | /* endian convert, and verify populated BAT field file offsets against | ||
333 | * region table and log entries */ | ||
334 | for (i = 0; i < s->bat_entries; i++) { | ||
335 | - le64_to_cpus(&s->bat[i]); | ||
336 | + s->bat[i] = le64_to_cpu(s->bat[i]); | ||
337 | if (payblocks--) { | ||
338 | /* payload bat entries */ | ||
339 | if ((s->bat[i] & VHDX_BAT_STATE_BIT_MASK) == | ||
340 | @@ -XXX,XX +XXX,XX @@ static int vhdx_create_new_metadata(BlockBackend *blk, | ||
341 | mt_file_params->block_size = cpu_to_le32(block_size); | ||
342 | if (type == VHDX_TYPE_FIXED) { | ||
343 | mt_file_params->data_bits |= VHDX_PARAMS_LEAVE_BLOCKS_ALLOCED; | ||
344 | - cpu_to_le32s(&mt_file_params->data_bits); | ||
345 | + mt_file_params->data_bits = cpu_to_le32(mt_file_params->data_bits); | ||
346 | } | ||
347 | |||
348 | vhdx_guid_generate(&mt_page83->page_83_data); | ||
349 | @@ -XXX,XX +XXX,XX @@ static int vhdx_create_bat(BlockBackend *blk, BDRVVHDXState *s, | ||
350 | sinfo.file_offset = ROUND_UP(sinfo.file_offset, MiB); | ||
351 | vhdx_update_bat_table_entry(blk_bs(blk), s, &sinfo, &unused, &unused, | ||
352 | block_state); | ||
353 | - cpu_to_le64s(&s->bat[sinfo.bat_idx]); | ||
354 | + s->bat[sinfo.bat_idx] = cpu_to_le64(s->bat[sinfo.bat_idx]); | ||
355 | sector_num += s->sectors_per_block; | ||
356 | } | ||
357 | ret = blk_pwrite(blk, file_offset, s->bat, length, 0); | ||
358 | -- | 94 | -- |
359 | 2.19.1 | 95 | 2.20.1 |
360 | 96 | ||
361 | 97 | diff view generated by jsdifflib |
1 | From: Max Reitz <mreitz@redhat.com> | 1 | From: Eric Blake <eblake@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | There is no good reason why there should be a newline in this | 3 | When extracting a human-readable size formatter, we changed 'uint64_t |
4 | description, so remove it. | 4 | div' pre-patch to 'unsigned long div' post-patch. Which breaks on |
5 | 32-bit platforms, resulting in 'inf' instead of intended values larger | ||
6 | than 999GB. | ||
5 | 7 | ||
6 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 8 | Fixes: 22951aaa |
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 9 | CC: qemu-stable@nongnu.org |
8 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> | 10 | Reported-by: Max Reitz <mreitz@redhat.com> |
11 | Signed-off-by: Eric Blake <eblake@redhat.com> | ||
12 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
9 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 13 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
10 | --- | 14 | --- |
11 | vl.c | 2 +- | 15 | util/cutils.c | 2 +- |
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 16 | 1 file changed, 1 insertion(+), 1 deletion(-) |
13 | 17 | ||
14 | diff --git a/vl.c b/vl.c | 18 | diff --git a/util/cutils.c b/util/cutils.c |
15 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/vl.c | 20 | --- a/util/cutils.c |
17 | +++ b/vl.c | 21 | +++ b/util/cutils.c |
18 | @@ -XXX,XX +XXX,XX @@ static QemuOptsList qemu_fw_cfg_opts = { | 22 | @@ -XXX,XX +XXX,XX @@ const char *qemu_ether_ntoa(const MACAddr *mac) |
19 | }, { | 23 | char *size_to_str(uint64_t val) |
20 | .name = "file", | 24 | { |
21 | .type = QEMU_OPT_STRING, | 25 | static const char *suffixes[] = { "", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei" }; |
22 | - .help = "Sets the name of the file from which\n" | 26 | - unsigned long div; |
23 | + .help = "Sets the name of the file from which " | 27 | + uint64_t div; |
24 | "the fw_cfg blob will be loaded", | 28 | int i; |
25 | }, { | 29 | |
26 | .name = "string", | 30 | /* |
27 | -- | 31 | -- |
28 | 2.19.1 | 32 | 2.20.1 |
29 | 33 | ||
30 | 34 | diff view generated by jsdifflib |
1 | From: Alberto Garcia <berto@igalia.com> | 1 | From: Eric Blake <eblake@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | This is a static function with only one caller, so there's no need to | 3 | Disk sizes close to INT64_MAX cause overflow, for some pretty |
4 | keep it. Inlining the code in quorum_compare() makes it much simpler. | 4 | ridiculous output: |
5 | 5 | ||
6 | Signed-off-by: Alberto Garcia <berto@igalia.com> | 6 | $ ./nbdkit -U - memory size=$((2**63 - 512)) --run 'qemu-img info $nbd' |
7 | Reported-by: Markus Armbruster <armbru@redhat.com> | 7 | image: nbd+unix://?socket=/tmp/nbdkitHSAzNz/socket |
8 | file format: raw | ||
9 | virtual size: -8388607T (9223372036854775296 bytes) | ||
10 | disk size: unavailable | ||
11 | |||
12 | But there's no reason to have two separate implementations of integer | ||
13 | to human-readable abbreviation, where one has overflow and stops at | ||
14 | 'T', while the other avoids overflow and goes all the way to 'E'. With | ||
15 | this patch, the output now claims 8EiB instead of -8388607T, which | ||
16 | really is the correct rounding of largest file size supported by qemu | ||
17 | (we could go 511 bytes larger if we used byte-accurate sizing instead | ||
18 | of rounding up to the next sector boundary, but that wouldn't change | ||
19 | the human-readable result). | ||
20 | |||
21 | Quite a few iotests need updates to expected output to match. | ||
22 | |||
23 | Reported-by: Richard W.M. Jones <rjones@redhat.com> | ||
24 | Signed-off-by: Eric Blake <eblake@redhat.com> | ||
25 | Tested-by: Richard W.M. Jones <rjones@redhat.com> | ||
26 | Reviewed-by: Alberto Garcia <berto@igalia.com> | ||
27 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
8 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 28 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
29 | Tested-by: Max Reitz <mreitz@redhat.com> | ||
9 | --- | 30 | --- |
10 | block/quorum.c | 24 +++++------------------- | 31 | block/qapi.c | 49 +++++++++----------------------------- |
11 | 1 file changed, 5 insertions(+), 19 deletions(-) | 32 | tests/qemu-iotests/043.out | 6 ++--- |
33 | tests/qemu-iotests/053.out | 2 +- | ||
34 | tests/qemu-iotests/059.out | 10 ++++---- | ||
35 | tests/qemu-iotests/060.out | 10 ++++---- | ||
36 | tests/qemu-iotests/061.out | 12 +++++----- | ||
37 | tests/qemu-iotests/070.out | 2 +- | ||
38 | tests/qemu-iotests/082.out | 26 ++++++++++---------- | ||
39 | tests/qemu-iotests/084.out | 8 +++---- | ||
40 | tests/qemu-iotests/089.out | 2 +- | ||
41 | tests/qemu-iotests/095.out | 4 ++-- | ||
42 | tests/qemu-iotests/104.out | 6 ++--- | ||
43 | tests/qemu-iotests/110.out | 6 ++--- | ||
44 | tests/qemu-iotests/114.out | 2 +- | ||
45 | tests/qemu-iotests/126.out | 4 ++-- | ||
46 | tests/qemu-iotests/130.out | 10 ++++---- | ||
47 | tests/qemu-iotests/153.out | 2 +- | ||
48 | tests/qemu-iotests/191.out | 8 +++---- | ||
49 | tests/qemu-iotests/195.out | 4 ++-- | ||
50 | tests/qemu-iotests/198.out | 4 ++-- | ||
51 | tests/qemu-iotests/206.out | 10 ++++---- | ||
52 | tests/qemu-iotests/207.out | 12 +++++----- | ||
53 | tests/qemu-iotests/210.out | 8 +++---- | ||
54 | tests/qemu-iotests/211.out | 10 ++++---- | ||
55 | tests/qemu-iotests/212.out | 10 ++++---- | ||
56 | tests/qemu-iotests/213.out | 10 ++++---- | ||
57 | tests/qemu-iotests/233.out | 4 ++-- | ||
58 | tests/qemu-iotests/237.out | 22 ++++++++--------- | ||
59 | tests/qemu-iotests/242.out | 10 ++++---- | ||
60 | 29 files changed, 123 insertions(+), 150 deletions(-) | ||
12 | 61 | ||
13 | diff --git a/block/quorum.c b/block/quorum.c | 62 | diff --git a/block/qapi.c b/block/qapi.c |
14 | index XXXXXXX..XXXXXXX 100644 | 63 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/block/quorum.c | 64 | --- a/block/qapi.c |
16 | +++ b/block/quorum.c | 65 | +++ b/block/qapi.c |
17 | @@ -XXX,XX +XXX,XX @@ static bool quorum_iovec_compare(QEMUIOVector *a, QEMUIOVector *b) | 66 | @@ -XXX,XX +XXX,XX @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes, |
18 | return true; | 67 | return head; |
19 | } | 68 | } |
20 | 69 | ||
21 | -static void GCC_FMT_ATTR(2, 3) quorum_err(QuorumAIOCB *acb, | 70 | -#define NB_SUFFIXES 4 |
22 | - const char *fmt, ...) | 71 | - |
72 | -static char *get_human_readable_size(char *buf, int buf_size, int64_t size) | ||
23 | -{ | 73 | -{ |
24 | - va_list ap; | 74 | - static const char suffixes[NB_SUFFIXES] = {'K', 'M', 'G', 'T'}; |
75 | - int64_t base; | ||
76 | - int i; | ||
25 | - | 77 | - |
26 | - va_start(ap, fmt); | 78 | - if (size <= 999) { |
27 | - fprintf(stderr, "quorum: offset=%" PRIu64 " bytes=%" PRIu64 " ", | 79 | - snprintf(buf, buf_size, "%" PRId64, size); |
28 | - acb->offset, acb->bytes); | 80 | - } else { |
29 | - vfprintf(stderr, fmt, ap); | 81 | - base = 1024; |
30 | - fprintf(stderr, "\n"); | 82 | - for (i = 0; i < NB_SUFFIXES; i++) { |
31 | - va_end(ap); | 83 | - if (size < (10 * base)) { |
32 | - exit(1); | 84 | - snprintf(buf, buf_size, "%0.1f%c", |
85 | - (double)size / base, | ||
86 | - suffixes[i]); | ||
87 | - break; | ||
88 | - } else if (size < (1000 * base) || i == (NB_SUFFIXES - 1)) { | ||
89 | - snprintf(buf, buf_size, "%" PRId64 "%c", | ||
90 | - ((size + (base >> 1)) / base), | ||
91 | - suffixes[i]); | ||
92 | - break; | ||
93 | - } | ||
94 | - base = base * 1024; | ||
95 | - } | ||
96 | - } | ||
97 | - return buf; | ||
33 | -} | 98 | -} |
34 | - | 99 | - |
35 | -static bool quorum_compare(QuorumAIOCB *acb, | 100 | void bdrv_snapshot_dump(QEMUSnapshotInfo *sn) |
36 | - QEMUIOVector *a, | ||
37 | - QEMUIOVector *b) | ||
38 | +static bool quorum_compare(QuorumAIOCB *acb, QEMUIOVector *a, QEMUIOVector *b) | ||
39 | { | 101 | { |
40 | BDRVQuorumState *s = acb->bs->opaque; | 102 | - char buf1[128], date_buf[128], clock_buf[128]; |
41 | ssize_t offset; | 103 | + char date_buf[128], clock_buf[128]; |
42 | @@ -XXX,XX +XXX,XX @@ static bool quorum_compare(QuorumAIOCB *acb, | 104 | struct tm tm; |
43 | if (s->is_blkverify) { | 105 | time_t ti; |
44 | offset = qemu_iovec_compare(a, b); | 106 | int64_t secs; |
45 | if (offset != -1) { | 107 | + char *sizing = NULL; |
46 | - quorum_err(acb, "contents mismatch at offset %" PRIu64, | 108 | |
47 | - acb->offset + offset); | 109 | if (!sn) { |
48 | + fprintf(stderr, "quorum: offset=%" PRIu64 " bytes=%" PRIu64 | 110 | qemu_printf("%-10s%-20s%7s%20s%15s", |
49 | + " contents mismatch at offset %" PRIu64 "\n", | 111 | @@ -XXX,XX +XXX,XX @@ void bdrv_snapshot_dump(QEMUSnapshotInfo *sn) |
50 | + acb->offset, acb->bytes, acb->offset + offset); | 112 | (int)((secs / 60) % 60), |
51 | + exit(1); | 113 | (int)(secs % 60), |
52 | } | 114 | (int)((sn->vm_clock_nsec / 1000000) % 1000)); |
53 | return true; | 115 | + sizing = size_to_str(sn->vm_state_size); |
116 | qemu_printf("%-10s%-20s%7s%20s%15s", | ||
117 | sn->id_str, sn->name, | ||
118 | - get_human_readable_size(buf1, sizeof(buf1), | ||
119 | - sn->vm_state_size), | ||
120 | + sizing, | ||
121 | date_buf, | ||
122 | clock_buf); | ||
54 | } | 123 | } |
124 | + g_free(sizing); | ||
125 | } | ||
126 | |||
127 | static void dump_qdict(int indentation, QDict *dict); | ||
128 | @@ -XXX,XX +XXX,XX @@ void bdrv_image_info_specific_dump(ImageInfoSpecific *info_spec) | ||
129 | |||
130 | void bdrv_image_info_dump(ImageInfo *info) | ||
131 | { | ||
132 | - char size_buf[128], dsize_buf[128]; | ||
133 | + char *size_buf, *dsize_buf; | ||
134 | if (!info->has_actual_size) { | ||
135 | - snprintf(dsize_buf, sizeof(dsize_buf), "unavailable"); | ||
136 | + dsize_buf = g_strdup("unavailable"); | ||
137 | } else { | ||
138 | - get_human_readable_size(dsize_buf, sizeof(dsize_buf), | ||
139 | - info->actual_size); | ||
140 | + dsize_buf = size_to_str(info->actual_size); | ||
141 | } | ||
142 | - get_human_readable_size(size_buf, sizeof(size_buf), info->virtual_size); | ||
143 | + size_buf = size_to_str(info->virtual_size); | ||
144 | qemu_printf("image: %s\n" | ||
145 | "file format: %s\n" | ||
146 | "virtual size: %s (%" PRId64 " bytes)\n" | ||
147 | @@ -XXX,XX +XXX,XX @@ void bdrv_image_info_dump(ImageInfo *info) | ||
148 | info->filename, info->format, size_buf, | ||
149 | info->virtual_size, | ||
150 | dsize_buf); | ||
151 | + g_free(size_buf); | ||
152 | + g_free(dsize_buf); | ||
153 | |||
154 | if (info->has_encrypted && info->encrypted) { | ||
155 | qemu_printf("encrypted: yes\n"); | ||
156 | diff --git a/tests/qemu-iotests/043.out b/tests/qemu-iotests/043.out | ||
157 | index XXXXXXX..XXXXXXX 100644 | ||
158 | --- a/tests/qemu-iotests/043.out | ||
159 | +++ b/tests/qemu-iotests/043.out | ||
160 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/ | ||
161 | == finite chain of length 3 (human) == | ||
162 | image: TEST_DIR/t.IMGFMT | ||
163 | file format: IMGFMT | ||
164 | -virtual size: 128M (134217728 bytes) | ||
165 | +virtual size: 128 MiB (134217728 bytes) | ||
166 | cluster_size: 65536 | ||
167 | backing file: TEST_DIR/t.IMGFMT.2.base | ||
168 | |||
169 | image: TEST_DIR/t.IMGFMT.2.base | ||
170 | file format: IMGFMT | ||
171 | -virtual size: 128M (134217728 bytes) | ||
172 | +virtual size: 128 MiB (134217728 bytes) | ||
173 | cluster_size: 65536 | ||
174 | backing file: TEST_DIR/t.IMGFMT.1.base | ||
175 | |||
176 | image: TEST_DIR/t.IMGFMT.1.base | ||
177 | file format: IMGFMT | ||
178 | -virtual size: 128M (134217728 bytes) | ||
179 | +virtual size: 128 MiB (134217728 bytes) | ||
180 | cluster_size: 65536 | ||
181 | |||
182 | == finite chain of length 3 (json) == | ||
183 | diff --git a/tests/qemu-iotests/053.out b/tests/qemu-iotests/053.out | ||
184 | index XXXXXXX..XXXXXXX 100644 | ||
185 | --- a/tests/qemu-iotests/053.out | ||
186 | +++ b/tests/qemu-iotests/053.out | ||
187 | @@ -XXX,XX +XXX,XX @@ wrote 512/512 bytes at offset 0 | ||
188 | No errors were found on the image. | ||
189 | |||
190 | == Checking compressed image virtual disk size == | ||
191 | -virtual size: 512 (512 bytes) | ||
192 | +virtual size: 512 B (512 bytes) | ||
193 | |||
194 | == Verifying the compressed image == | ||
195 | read 512/512 bytes at offset 0 | ||
196 | diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out | ||
197 | index XXXXXXX..XXXXXXX 100644 | ||
198 | --- a/tests/qemu-iotests/059.out | ||
199 | +++ b/tests/qemu-iotests/059.out | ||
200 | @@ -XXX,XX +XXX,XX @@ can't open device TEST_DIR/t.vmdk: L1 size too big | ||
201 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 subformat=monolithicFlat | ||
202 | image: TEST_DIR/t.IMGFMT | ||
203 | file format: IMGFMT | ||
204 | -virtual size: 2.0G (2147483648 bytes) | ||
205 | +virtual size: 2 GiB (2147483648 bytes) | ||
206 | |||
207 | === Testing monolithicFlat with zeroed_grain === | ||
208 | qemu-img: TEST_DIR/t.IMGFMT: Flat image can't enable zeroed grain | ||
209 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 subformat=monolithicF | ||
210 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824000 subformat=twoGbMaxExtentFlat | ||
211 | image: TEST_DIR/t.vmdk | ||
212 | file format: vmdk | ||
213 | -virtual size: 1.0T (1073741824000 bytes) | ||
214 | -disk size: 16K | ||
215 | +virtual size: 0.977 TiB (1073741824000 bytes) | ||
216 | +disk size: 16 KiB | ||
217 | Format specific information: | ||
218 | cid: XXXXXXXX | ||
219 | parent cid: XXXXXXXX | ||
220 | @@ -XXX,XX +XXX,XX @@ can't open: Cannot use relative extent paths with VMDK descriptor file 'json:{"i | ||
221 | === Testing version 3 === | ||
222 | image: TEST_DIR/iotest-version3.IMGFMT | ||
223 | file format: IMGFMT | ||
224 | -virtual size: 16G (17179869184 bytes) | ||
225 | +virtual size: 16 GiB (17179869184 bytes) | ||
226 | cluster_size: 65536 | ||
227 | read 512/512 bytes at offset 0 | ||
228 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
229 | @@ -XXX,XX +XXX,XX @@ read 512/512 bytes at offset 64931328 | ||
230 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4398046511104 subformat=monolithicFlat | ||
231 | image: TEST_DIR/t.IMGFMT | ||
232 | file format: IMGFMT | ||
233 | -virtual size: 4.0T (4398046511104 bytes) | ||
234 | +virtual size: 4 TiB (4398046511104 bytes) | ||
235 | wrote 512/512 bytes at offset 966367641600 | ||
236 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
237 | e100000000: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ | ||
238 | diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out | ||
239 | index XXXXXXX..XXXXXXX 100644 | ||
240 | --- a/tests/qemu-iotests/060.out | ||
241 | +++ b/tests/qemu-iotests/060.out | ||
242 | @@ -XXX,XX +XXX,XX @@ write failed: Input/output error | ||
243 | incompatible_features 0x2 | ||
244 | image: TEST_DIR/t.IMGFMT | ||
245 | file format: IMGFMT | ||
246 | -virtual size: 64M (67108864 bytes) | ||
247 | +virtual size: 64 MiB (67108864 bytes) | ||
248 | cluster_size: 65536 | ||
249 | Format specific information: | ||
250 | compat: 1.1 | ||
251 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
252 | qcow2: Marking image as corrupt: Refblock at 0xffffff00000000 is not covered by the refcount structures; further corruption events will be suppressed | ||
253 | qemu-img: Failed to discard unused refblocks: Input/output error | ||
254 | --- Checking and retrying --- | ||
255 | -virtual size: 64M (67108864 bytes) | ||
256 | +virtual size: 64 MiB (67108864 bytes) | ||
257 | No errors were found on the image. | ||
258 | Image resized. | ||
259 | -virtual size: 32M (33554432 bytes) | ||
260 | +virtual size: 32 MiB (33554432 bytes) | ||
261 | |||
262 | === Discarding a non-covered in-bounds refblock === | ||
263 | |||
264 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
265 | qcow2: Marking image as corrupt: Refblock at 0x1000000000 is not covered by the refcount structures; further corruption events will be suppressed | ||
266 | qemu-img: Failed to discard unused refblocks: Input/output error | ||
267 | --- Checking and retrying --- | ||
268 | -virtual size: 64M (67108864 bytes) | ||
269 | +virtual size: 64 MiB (67108864 bytes) | ||
270 | No errors were found on the image. | ||
271 | Image resized. | ||
272 | -virtual size: 32M (33554432 bytes) | ||
273 | +virtual size: 32 MiB (33554432 bytes) | ||
274 | |||
275 | === Discarding a refblock covered by an unaligned refblock === | ||
276 | |||
277 | diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out | ||
278 | index XXXXXXX..XXXXXXX 100644 | ||
279 | --- a/tests/qemu-iotests/061.out | ||
280 | +++ b/tests/qemu-iotests/061.out | ||
281 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 data_file=TEST_DIR/t.IM | ||
282 | qemu-img: Cannot downgrade an image with a data file | ||
283 | image: TEST_DIR/t.IMGFMT | ||
284 | file format: IMGFMT | ||
285 | -virtual size: 64M (67108864 bytes) | ||
286 | +virtual size: 64 MiB (67108864 bytes) | ||
287 | cluster_size: 65536 | ||
288 | Format specific information: | ||
289 | compat: 1.1 | ||
290 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 data_file=TEST_DIR/t.IM | ||
291 | qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Could not open 'foo': No such file or directory | ||
292 | image: TEST_DIR/t.IMGFMT | ||
293 | file format: IMGFMT | ||
294 | -virtual size: 64M (67108864 bytes) | ||
295 | +virtual size: 64 MiB (67108864 bytes) | ||
296 | cluster_size: 65536 | ||
297 | Format specific information: | ||
298 | compat: 1.1 | ||
299 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
300 | qemu-img: Could not open 'TEST_DIR/t.IMGFMT': 'data-file' is required for this image | ||
301 | image: TEST_DIR/t.IMGFMT | ||
302 | file format: IMGFMT | ||
303 | -virtual size: 64M (67108864 bytes) | ||
304 | +virtual size: 64 MiB (67108864 bytes) | ||
305 | cluster_size: 65536 | ||
306 | Format specific information: | ||
307 | compat: 1.1 | ||
308 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
309 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 data_file=TEST_DIR/t.IMGFMT.data data_file_raw=on | ||
310 | image: TEST_DIR/t.IMGFMT | ||
311 | file format: IMGFMT | ||
312 | -virtual size: 64M (67108864 bytes) | ||
313 | +virtual size: 64 MiB (67108864 bytes) | ||
314 | cluster_size: 65536 | ||
315 | Format specific information: | ||
316 | compat: 1.1 | ||
317 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
318 | No errors were found on the image. | ||
319 | image: TEST_DIR/t.IMGFMT | ||
320 | file format: IMGFMT | ||
321 | -virtual size: 64M (67108864 bytes) | ||
322 | +virtual size: 64 MiB (67108864 bytes) | ||
323 | cluster_size: 65536 | ||
324 | Format specific information: | ||
325 | compat: 1.1 | ||
326 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
327 | qemu-img: data-file-raw cannot be set on existing images | ||
328 | image: TEST_DIR/t.IMGFMT | ||
329 | file format: IMGFMT | ||
330 | -virtual size: 64M (67108864 bytes) | ||
331 | +virtual size: 64 MiB (67108864 bytes) | ||
332 | cluster_size: 65536 | ||
333 | Format specific information: | ||
334 | compat: 1.1 | ||
335 | diff --git a/tests/qemu-iotests/070.out b/tests/qemu-iotests/070.out | ||
336 | index XXXXXXX..XXXXXXX 100644 | ||
337 | --- a/tests/qemu-iotests/070.out | ||
338 | +++ b/tests/qemu-iotests/070.out | ||
339 | @@ -XXX,XX +XXX,XX @@ read 18874368/18874368 bytes at offset 0 | ||
340 | === Verify image created by Disk2VHD can be opened === | ||
341 | image: TEST_DIR/test-disk2vhd.IMGFMT | ||
342 | file format: IMGFMT | ||
343 | -virtual size: 256M (268435456 bytes) | ||
344 | +virtual size: 256 MiB (268435456 bytes) | ||
345 | cluster_size: 2097152 | ||
346 | *** done | ||
347 | diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out | ||
348 | index XXXXXXX..XXXXXXX 100644 | ||
349 | --- a/tests/qemu-iotests/082.out | ||
350 | +++ b/tests/qemu-iotests/082.out | ||
351 | @@ -XXX,XX +XXX,XX @@ Testing: create -f foo -f qcow2 TEST_DIR/t.qcow2 128M | ||
352 | Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
353 | image: TEST_DIR/t.IMGFMT | ||
354 | file format: IMGFMT | ||
355 | -virtual size: 128M (134217728 bytes) | ||
356 | +virtual size: 128 MiB (134217728 bytes) | ||
357 | cluster_size: 65536 | ||
358 | |||
359 | Testing: create -f qcow2 -o cluster_size=4k -o lazy_refcounts=on TEST_DIR/t.qcow2 128M | ||
360 | Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=4096 lazy_refcounts=on refcount_bits=16 | ||
361 | image: TEST_DIR/t.IMGFMT | ||
362 | file format: IMGFMT | ||
363 | -virtual size: 128M (134217728 bytes) | ||
364 | +virtual size: 128 MiB (134217728 bytes) | ||
365 | cluster_size: 4096 | ||
366 | Format specific information: | ||
367 | compat: 1.1 | ||
368 | @@ -XXX,XX +XXX,XX @@ Testing: create -f qcow2 -o cluster_size=4k -o lazy_refcounts=on -o cluster_size | ||
369 | Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=8192 lazy_refcounts=on refcount_bits=16 | ||
370 | image: TEST_DIR/t.IMGFMT | ||
371 | file format: IMGFMT | ||
372 | -virtual size: 128M (134217728 bytes) | ||
373 | +virtual size: 128 MiB (134217728 bytes) | ||
374 | cluster_size: 8192 | ||
375 | Format specific information: | ||
376 | compat: 1.1 | ||
377 | @@ -XXX,XX +XXX,XX @@ Testing: create -f qcow2 -o cluster_size=4k,cluster_size=8k TEST_DIR/t.qcow2 128 | ||
378 | Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=8192 lazy_refcounts=off refcount_bits=16 | ||
379 | image: TEST_DIR/t.IMGFMT | ||
380 | file format: IMGFMT | ||
381 | -virtual size: 128M (134217728 bytes) | ||
382 | +virtual size: 128 MiB (134217728 bytes) | ||
383 | cluster_size: 8192 | ||
384 | |||
385 | === create: help for -o === | ||
386 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=65536 lazy_ | ||
387 | Testing: convert -f foo -f qcow2 TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
388 | image: TEST_DIR/t.IMGFMT.base | ||
389 | file format: raw | ||
390 | -virtual size: 128M (134217728 bytes) | ||
391 | +virtual size: 128 MiB (134217728 bytes) | ||
392 | |||
393 | Testing: convert -O foo -O qcow2 TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
394 | image: TEST_DIR/t.IMGFMT.base | ||
395 | file format: IMGFMT | ||
396 | -virtual size: 128M (134217728 bytes) | ||
397 | +virtual size: 128 MiB (134217728 bytes) | ||
398 | cluster_size: 65536 | ||
399 | |||
400 | Testing: convert -O qcow2 -o cluster_size=4k -o lazy_refcounts=on TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
401 | image: TEST_DIR/t.IMGFMT.base | ||
402 | file format: IMGFMT | ||
403 | -virtual size: 128M (134217728 bytes) | ||
404 | +virtual size: 128 MiB (134217728 bytes) | ||
405 | cluster_size: 4096 | ||
406 | Format specific information: | ||
407 | compat: 1.1 | ||
408 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
409 | Testing: convert -O qcow2 -o cluster_size=4k -o lazy_refcounts=on -o cluster_size=8k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
410 | image: TEST_DIR/t.IMGFMT.base | ||
411 | file format: IMGFMT | ||
412 | -virtual size: 128M (134217728 bytes) | ||
413 | +virtual size: 128 MiB (134217728 bytes) | ||
414 | cluster_size: 8192 | ||
415 | Format specific information: | ||
416 | compat: 1.1 | ||
417 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
418 | Testing: convert -O qcow2 -o cluster_size=4k,cluster_size=8k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
419 | image: TEST_DIR/t.IMGFMT.base | ||
420 | file format: IMGFMT | ||
421 | -virtual size: 128M (134217728 bytes) | ||
422 | +virtual size: 128 MiB (134217728 bytes) | ||
423 | cluster_size: 8192 | ||
424 | |||
425 | === convert: help for -o === | ||
426 | @@ -XXX,XX +XXX,XX @@ qemu-img: Cannot enable copy offloading when -c is used | ||
427 | Testing: amend -f foo -f qcow2 -o lazy_refcounts=on TEST_DIR/t.qcow2 | ||
428 | image: TEST_DIR/t.IMGFMT | ||
429 | file format: IMGFMT | ||
430 | -virtual size: 128M (134217728 bytes) | ||
431 | +virtual size: 128 MiB (134217728 bytes) | ||
432 | cluster_size: 65536 | ||
433 | Format specific information: | ||
434 | compat: 1.1 | ||
435 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
436 | Testing: amend -f qcow2 -o size=130M -o lazy_refcounts=off TEST_DIR/t.qcow2 | ||
437 | image: TEST_DIR/t.IMGFMT | ||
438 | file format: IMGFMT | ||
439 | -virtual size: 130M (136314880 bytes) | ||
440 | +virtual size: 130 MiB (136314880 bytes) | ||
441 | cluster_size: 65536 | ||
442 | Format specific information: | ||
443 | compat: 1.1 | ||
444 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
445 | Testing: amend -f qcow2 -o size=8M -o lazy_refcounts=on -o size=132M TEST_DIR/t.qcow2 | ||
446 | image: TEST_DIR/t.IMGFMT | ||
447 | file format: IMGFMT | ||
448 | -virtual size: 132M (138412032 bytes) | ||
449 | +virtual size: 132 MiB (138412032 bytes) | ||
450 | cluster_size: 65536 | ||
451 | Format specific information: | ||
452 | compat: 1.1 | ||
453 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
454 | Testing: amend -f qcow2 -o size=4M,size=148M TEST_DIR/t.qcow2 | ||
455 | image: TEST_DIR/t.IMGFMT | ||
456 | file format: IMGFMT | ||
457 | -virtual size: 148M (155189248 bytes) | ||
458 | +virtual size: 148 MiB (155189248 bytes) | ||
459 | cluster_size: 65536 | ||
460 | |||
461 | === amend: help for -o === | ||
462 | diff --git a/tests/qemu-iotests/084.out b/tests/qemu-iotests/084.out | ||
463 | index XXXXXXX..XXXXXXX 100644 | ||
464 | --- a/tests/qemu-iotests/084.out | ||
465 | +++ b/tests/qemu-iotests/084.out | ||
466 | @@ -XXX,XX +XXX,XX @@ QA output created by 084 | ||
467 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
468 | image: TEST_DIR/t.IMGFMT | ||
469 | file format: IMGFMT | ||
470 | -virtual size: 64M (67108864 bytes) | ||
471 | +virtual size: 64 MiB (67108864 bytes) | ||
472 | cluster_size: 1048576 | ||
473 | disk image file size in bytes: 67109888 | ||
474 | |||
475 | @@ -XXX,XX +XXX,XX @@ disk image file size in bytes: 67109888 | ||
476 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
477 | image: TEST_DIR/t.IMGFMT | ||
478 | file format: IMGFMT | ||
479 | -virtual size: 64M (67108864 bytes) | ||
480 | +virtual size: 64 MiB (67108864 bytes) | ||
481 | cluster_size: 1048576 | ||
482 | disk image file size in bytes: 1024 | ||
483 | Test 1: Maximum size (512 TB - 128 MB): | ||
484 | image: TEST_DIR/t.IMGFMT | ||
485 | file format: IMGFMT | ||
486 | -virtual size: 512T (562949819203584 bytes) | ||
487 | +virtual size: 512 TiB (562949819203584 bytes) | ||
488 | cluster_size: 1048576 | ||
489 | |||
490 | Test 2: Size too large (512 TB - 128 MB + 64 kB) | ||
491 | @@ -XXX,XX +XXX,XX @@ qemu-img: Could not open 'TEST_DIR/t.IMGFMT': unsupported VDI image (too many bl | ||
492 | Test 5: Valid Image: 64MB, Blocks In Image 64, Block Size 1MB | ||
493 | image: TEST_DIR/t.IMGFMT | ||
494 | file format: IMGFMT | ||
495 | -virtual size: 64M (67108864 bytes) | ||
496 | +virtual size: 64 MiB (67108864 bytes) | ||
497 | cluster_size: 1048576 | ||
498 | |||
499 | Test 6: Block Size != 1MB; too small test (1MB - 1) | ||
500 | diff --git a/tests/qemu-iotests/089.out b/tests/qemu-iotests/089.out | ||
501 | index XXXXXXX..XXXXXXX 100644 | ||
502 | --- a/tests/qemu-iotests/089.out | ||
503 | +++ b/tests/qemu-iotests/089.out | ||
504 | @@ -XXX,XX +XXX,XX @@ read failed: Input/output error | ||
505 | |||
506 | image: TEST_DIR/t.IMGFMT | ||
507 | file format: IMGFMT | ||
508 | -virtual size: 64M (67108864 bytes) | ||
509 | +virtual size: 64 MiB (67108864 bytes) | ||
510 | cluster_size: 65536 | ||
511 | |||
512 | === Testing option merging === | ||
513 | diff --git a/tests/qemu-iotests/095.out b/tests/qemu-iotests/095.out | ||
514 | index XXXXXXX..XXXXXXX 100644 | ||
515 | --- a/tests/qemu-iotests/095.out | ||
516 | +++ b/tests/qemu-iotests/095.out | ||
517 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=104857600 backing_file=TEST_DIR/ | ||
518 | === Base image info before commit and resize === | ||
519 | image: TEST_DIR/t.IMGFMT.base | ||
520 | file format: IMGFMT | ||
521 | -virtual size: 5.0M (5242880 bytes) | ||
522 | +virtual size: 5 MiB (5242880 bytes) | ||
523 | |||
524 | === Running QEMU Live Commit Test === | ||
525 | |||
526 | @@ -XXX,XX +XXX,XX @@ virtual size: 5.0M (5242880 bytes) | ||
527 | === Base image info after commit and resize === | ||
528 | image: TEST_DIR/t.IMGFMT.base | ||
529 | file format: IMGFMT | ||
530 | -virtual size: 100M (104857600 bytes) | ||
531 | +virtual size: 100 MiB (104857600 bytes) | ||
532 | *** done | ||
533 | diff --git a/tests/qemu-iotests/104.out b/tests/qemu-iotests/104.out | ||
534 | index XXXXXXX..XXXXXXX 100644 | ||
535 | --- a/tests/qemu-iotests/104.out | ||
536 | +++ b/tests/qemu-iotests/104.out | ||
537 | @@ -XXX,XX +XXX,XX @@ QA output created by 104 | ||
538 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024 | ||
539 | image: TEST_DIR/t.IMGFMT | ||
540 | file format: IMGFMT | ||
541 | -virtual size: 1.0K (1024 bytes) | ||
542 | +virtual size: 1 KiB (1024 bytes) | ||
543 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1234 | ||
544 | image: TEST_DIR/t.IMGFMT | ||
545 | file format: IMGFMT | ||
546 | -virtual size: 1.5K (1536 bytes) | ||
547 | -***done | ||
548 | +virtual size: 1.5 KiB (1536 bytes) | ||
549 | +*** done | ||
550 | diff --git a/tests/qemu-iotests/110.out b/tests/qemu-iotests/110.out | ||
551 | index XXXXXXX..XXXXXXX 100644 | ||
552 | --- a/tests/qemu-iotests/110.out | ||
553 | +++ b/tests/qemu-iotests/110.out | ||
554 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864 | ||
555 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=t.IMGFMT.base | ||
556 | image: TEST_DIR/t.IMGFMT | ||
557 | file format: IMGFMT | ||
558 | -virtual size: 64M (67108864 bytes) | ||
559 | +virtual size: 64 MiB (67108864 bytes) | ||
560 | backing file: t.IMGFMT.base (actual path: TEST_DIR/t.IMGFMT.base) | ||
561 | |||
562 | === Non-reconstructable filename === | ||
563 | |||
564 | image: json:{"driver": "IMGFMT", "file": {"set-state.0.event": "read_aio", "image": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "driver": "blkdebug", "set-state.0.new_state": 42}} | ||
565 | file format: IMGFMT | ||
566 | -virtual size: 64M (67108864 bytes) | ||
567 | +virtual size: 64 MiB (67108864 bytes) | ||
568 | backing file: t.IMGFMT.base (actual path: TEST_DIR/t.IMGFMT.base) | ||
569 | |||
570 | === Backing name is always relative to the backed image === | ||
571 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=t.IMGFMT.b | ||
572 | |||
573 | image: json:{"driver": "IMGFMT", "file": {"children": [{"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, {"driver": "file", "filename": "TEST_DIR/t.IMGFMT.copy"}], "driver": "quorum", "vote-threshold": 1}} | ||
574 | file format: IMGFMT | ||
575 | -virtual size: 64M (67108864 bytes) | ||
576 | +virtual size: 64 MiB (67108864 bytes) | ||
577 | backing file: t.IMGFMT.base (cannot determine actual path) | ||
578 | *** done | ||
579 | diff --git a/tests/qemu-iotests/114.out b/tests/qemu-iotests/114.out | ||
580 | index XXXXXXX..XXXXXXX 100644 | ||
581 | --- a/tests/qemu-iotests/114.out | ||
582 | +++ b/tests/qemu-iotests/114.out | ||
583 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864 | ||
584 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.base | ||
585 | image: TEST_DIR/t.IMGFMT | ||
586 | file format: IMGFMT | ||
587 | -virtual size: 64M (67108864 bytes) | ||
588 | +virtual size: 64 MiB (67108864 bytes) | ||
589 | cluster_size: 65536 | ||
590 | backing file: TEST_DIR/t.IMGFMT.base | ||
591 | backing file format: foo | ||
592 | diff --git a/tests/qemu-iotests/126.out b/tests/qemu-iotests/126.out | ||
593 | index XXXXXXX..XXXXXXX 100644 | ||
594 | --- a/tests/qemu-iotests/126.out | ||
595 | +++ b/tests/qemu-iotests/126.out | ||
596 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/image:base.IMGFMT', fmt=IMGFMT size=67108864 | ||
597 | Formatting 'TEST_DIR/image:top.IMGFMT', fmt=IMGFMT size=67108864 backing_file=./image:base.IMGFMT | ||
598 | image: TEST_DIR/image:top.IMGFMT | ||
599 | file format: IMGFMT | ||
600 | -virtual size: 64M (67108864 bytes) | ||
601 | +virtual size: 64 MiB (67108864 bytes) | ||
602 | backing file: ./image:base.IMGFMT (actual path: TEST_DIR/./image:base.IMGFMT) | ||
603 | |||
604 | Formatting 'base.IMGFMT', fmt=IMGFMT size=67108864 | ||
605 | Formatting 'file:image:top.IMGFMT', fmt=IMGFMT size=67108864 backing_file=base.IMGFMT | ||
606 | image: ./image:top.IMGFMT | ||
607 | file format: IMGFMT | ||
608 | -virtual size: 64M (67108864 bytes) | ||
609 | +virtual size: 64 MiB (67108864 bytes) | ||
610 | backing file: base.IMGFMT (actual path: ./base.IMGFMT) | ||
611 | *** done | ||
612 | diff --git a/tests/qemu-iotests/130.out b/tests/qemu-iotests/130.out | ||
613 | index XXXXXXX..XXXXXXX 100644 | ||
614 | --- a/tests/qemu-iotests/130.out | ||
615 | +++ b/tests/qemu-iotests/130.out | ||
616 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864 | ||
617 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
618 | image: TEST_DIR/t.IMGFMT | ||
619 | file format: IMGFMT | ||
620 | -virtual size: 64M (67108864 bytes) | ||
621 | +virtual size: 64 MiB (67108864 bytes) | ||
622 | |||
623 | === HMP commit === | ||
624 | |||
625 | @@ -XXX,XX +XXX,XX @@ QEMU X.Y.Z monitor - type 'help' for more information | ||
626 | (qemu) | ||
627 | image: TEST_DIR/t.IMGFMT | ||
628 | file format: IMGFMT | ||
629 | -virtual size: 64M (67108864 bytes) | ||
630 | +virtual size: 64 MiB (67108864 bytes) | ||
631 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.orig backing_fmt=raw | ||
632 | QEMU X.Y.Z monitor - type 'help' for more information | ||
633 | (qemu) commit testdisk | ||
634 | (qemu) | ||
635 | image: TEST_DIR/t.IMGFMT | ||
636 | file format: IMGFMT | ||
637 | -virtual size: 64M (67108864 bytes) | ||
638 | +virtual size: 64 MiB (67108864 bytes) | ||
639 | backing file: TEST_DIR/t.IMGFMT.orig | ||
640 | backing file format: raw | ||
641 | |||
642 | @@ -XXX,XX +XXX,XX @@ wrote 4096/4096 bytes at offset 0 | ||
643 | 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
644 | image: TEST_DIR/t.IMGFMT | ||
645 | file format: IMGFMT | ||
646 | -virtual size: 64M (67108864 bytes) | ||
647 | +virtual size: 64 MiB (67108864 bytes) | ||
648 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.orig backing_fmt=raw | ||
649 | wrote 4096/4096 bytes at offset 0 | ||
650 | 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
651 | image: TEST_DIR/t.IMGFMT | ||
652 | file format: IMGFMT | ||
653 | -virtual size: 64M (67108864 bytes) | ||
654 | +virtual size: 64 MiB (67108864 bytes) | ||
655 | backing file: TEST_DIR/t.IMGFMT.orig | ||
656 | backing file format: raw | ||
657 | *** done | ||
658 | diff --git a/tests/qemu-iotests/153.out b/tests/qemu-iotests/153.out | ||
659 | index XXXXXXX..XXXXXXX 100644 | ||
660 | --- a/tests/qemu-iotests/153.out | ||
661 | +++ b/tests/qemu-iotests/153.out | ||
662 | @@ -XXX,XX +XXX,XX @@ _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512 | ||
663 | No conflict: | ||
664 | image: null-co:// | ||
665 | file format: null-co | ||
666 | -virtual size: 1.0G (1073741824 bytes) | ||
667 | +virtual size: 1 GiB (1073741824 bytes) | ||
668 | disk size: unavailable | ||
669 | |||
670 | Conflict: | ||
671 | diff --git a/tests/qemu-iotests/191.out b/tests/qemu-iotests/191.out | ||
672 | index XXXXXXX..XXXXXXX 100644 | ||
673 | --- a/tests/qemu-iotests/191.out | ||
674 | +++ b/tests/qemu-iotests/191.out | ||
675 | @@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576 | ||
676 | } | ||
677 | image: TEST_DIR/t.IMGFMT | ||
678 | file format: IMGFMT | ||
679 | -virtual size: 64M (67108864 bytes) | ||
680 | +virtual size: 64 MiB (67108864 bytes) | ||
681 | cluster_size: 65536 | ||
682 | backing file: TEST_DIR/t.IMGFMT.base | ||
683 | backing file format: IMGFMT | ||
684 | image: TEST_DIR/t.IMGFMT.ovl2 | ||
685 | file format: IMGFMT | ||
686 | -virtual size: 64M (67108864 bytes) | ||
687 | +virtual size: 64 MiB (67108864 bytes) | ||
688 | cluster_size: 65536 | ||
689 | backing file: TEST_DIR/t.IMGFMT.base | ||
690 | backing file format: IMGFMT | ||
691 | @@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576 | ||
692 | } | ||
693 | image: TEST_DIR/t.IMGFMT | ||
694 | file format: IMGFMT | ||
695 | -virtual size: 64M (67108864 bytes) | ||
696 | +virtual size: 64 MiB (67108864 bytes) | ||
697 | cluster_size: 65536 | ||
698 | backing file: TEST_DIR/t.IMGFMT.base | ||
699 | backing file format: IMGFMT | ||
700 | image: TEST_DIR/t.IMGFMT.ovl2 | ||
701 | file format: IMGFMT | ||
702 | -virtual size: 64M (67108864 bytes) | ||
703 | +virtual size: 64 MiB (67108864 bytes) | ||
704 | cluster_size: 65536 | ||
705 | backing file: TEST_DIR/t.IMGFMT.base | ||
706 | backing file format: IMGFMT | ||
707 | diff --git a/tests/qemu-iotests/195.out b/tests/qemu-iotests/195.out | ||
708 | index XXXXXXX..XXXXXXX 100644 | ||
709 | --- a/tests/qemu-iotests/195.out | ||
710 | +++ b/tests/qemu-iotests/195.out | ||
711 | @@ -XXX,XX +XXX,XX @@ Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,backing.node-name=mid | ||
712 | |||
713 | image: TEST_DIR/t.IMGFMT.mid | ||
714 | file format: IMGFMT | ||
715 | -virtual size: 64M (67108864 bytes) | ||
716 | +virtual size: 64 MiB (67108864 bytes) | ||
717 | cluster_size: 65536 | ||
718 | backing file: /dev/null | ||
719 | backing file format: IMGFMT | ||
720 | @@ -XXX,XX +XXX,XX @@ Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,node-name=top | ||
721 | |||
722 | image: TEST_DIR/t.IMGFMT | ||
723 | file format: IMGFMT | ||
724 | -virtual size: 64M (67108864 bytes) | ||
725 | +virtual size: 64 MiB (67108864 bytes) | ||
726 | cluster_size: 65536 | ||
727 | backing file: /dev/null | ||
728 | backing file format: IMGFMT | ||
729 | diff --git a/tests/qemu-iotests/198.out b/tests/qemu-iotests/198.out | ||
730 | index XXXXXXX..XXXXXXX 100644 | ||
731 | --- a/tests/qemu-iotests/198.out | ||
732 | +++ b/tests/qemu-iotests/198.out | ||
733 | @@ -XXX,XX +XXX,XX @@ read 16777216/16777216 bytes at offset 0 | ||
734 | == checking image base == | ||
735 | image: json:{"encrypt.key-secret": "sec0", "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT.base"}} | ||
736 | file format: IMGFMT | ||
737 | -virtual size: 16M (16777216 bytes) | ||
738 | +virtual size: 16 MiB (16777216 bytes) | ||
739 | Format specific information: | ||
740 | encrypt: | ||
741 | ivgen alg: plain64 | ||
742 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
743 | == checking image layer == | ||
744 | image: json:{"encrypt.key-secret": "sec1", "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}} | ||
745 | file format: IMGFMT | ||
746 | -virtual size: 16M (16777216 bytes) | ||
747 | +virtual size: 16 MiB (16777216 bytes) | ||
748 | backing file: TEST_DIR/t.IMGFMT.base | ||
749 | Format specific information: | ||
750 | encrypt: | ||
751 | diff --git a/tests/qemu-iotests/206.out b/tests/qemu-iotests/206.out | ||
752 | index XXXXXXX..XXXXXXX 100644 | ||
753 | --- a/tests/qemu-iotests/206.out | ||
754 | +++ b/tests/qemu-iotests/206.out | ||
755 | @@ -XXX,XX +XXX,XX @@ | ||
756 | |||
757 | image: TEST_IMG | ||
758 | file format: IMGFMT | ||
759 | -virtual size: 128M (134217728 bytes) | ||
760 | +virtual size: 128 MiB (134217728 bytes) | ||
761 | cluster_size: 65536 | ||
762 | Format specific information: | ||
763 | compat: 1.1 | ||
764 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
765 | |||
766 | image: TEST_IMG | ||
767 | file format: IMGFMT | ||
768 | -virtual size: 64M (67108864 bytes) | ||
769 | +virtual size: 64 MiB (67108864 bytes) | ||
770 | cluster_size: 65536 | ||
771 | Format specific information: | ||
772 | compat: 1.1 | ||
773 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
774 | |||
775 | image: TEST_IMG | ||
776 | file format: IMGFMT | ||
777 | -virtual size: 32M (33554432 bytes) | ||
778 | +virtual size: 32 MiB (33554432 bytes) | ||
779 | cluster_size: 2097152 | ||
780 | Format specific information: | ||
781 | compat: 1.1 | ||
782 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
783 | |||
784 | image: TEST_IMG | ||
785 | file format: IMGFMT | ||
786 | -virtual size: 32M (33554432 bytes) | ||
787 | +virtual size: 32 MiB (33554432 bytes) | ||
788 | cluster_size: 512 | ||
789 | backing file: TEST_IMG.base | ||
790 | backing file format: IMGFMT | ||
791 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
792 | |||
793 | image: TEST_IMG | ||
794 | file format: IMGFMT | ||
795 | -virtual size: 32M (33554432 bytes) | ||
796 | +virtual size: 32 MiB (33554432 bytes) | ||
797 | encrypted: yes | ||
798 | cluster_size: 65536 | ||
799 | Format specific information: | ||
800 | diff --git a/tests/qemu-iotests/207.out b/tests/qemu-iotests/207.out | ||
801 | index XXXXXXX..XXXXXXX 100644 | ||
802 | --- a/tests/qemu-iotests/207.out | ||
803 | +++ b/tests/qemu-iotests/207.out | ||
804 | @@ -XXX,XX +XXX,XX @@ | ||
805 | |||
806 | image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}} | ||
807 | file format: IMGFMT | ||
808 | -virtual size: 4.0M (4194304 bytes) | ||
809 | +virtual size: 4 MiB (4194304 bytes) | ||
810 | |||
811 | |||
812 | image: TEST_IMG | ||
813 | file format: IMGFMT | ||
814 | -virtual size: 4.0M (4194304 bytes) | ||
815 | +virtual size: 4 MiB (4194304 bytes) | ||
816 | |||
817 | === Test host-key-check options === | ||
818 | |||
819 | @@ -XXX,XX +XXX,XX @@ virtual size: 4.0M (4194304 bytes) | ||
820 | |||
821 | image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}} | ||
822 | file format: IMGFMT | ||
823 | -virtual size: 8.0M (8388608 bytes) | ||
824 | +virtual size: 8 MiB (8388608 bytes) | ||
825 | |||
826 | {"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "ssh", "location": {"host-key-check": {"mode": "known_hosts"}, "path": "TEST_DIR/PID-t.img", "server": {"host": "127.0.0.1", "port": "22"}}, "size": 4194304}}} | ||
827 | {"return": {}} | ||
828 | @@ -XXX,XX +XXX,XX @@ virtual size: 8.0M (8388608 bytes) | ||
829 | |||
830 | image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}} | ||
831 | file format: IMGFMT | ||
832 | -virtual size: 4.0M (4194304 bytes) | ||
833 | +virtual size: 4 MiB (4194304 bytes) | ||
834 | |||
835 | {"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "ssh", "location": {"host-key-check": {"hash": "wrong", "mode": "hash", "type": "md5"}, "path": "TEST_DIR/PID-t.img", "server": {"host": "127.0.0.1", "port": "22"}}, "size": 2097152}}} | ||
836 | {"return": {}} | ||
837 | @@ -XXX,XX +XXX,XX @@ Job failed: remote host key does not match host_key_check 'wrong' | ||
838 | |||
839 | image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}} | ||
840 | file format: IMGFMT | ||
841 | -virtual size: 8.0M (8388608 bytes) | ||
842 | +virtual size: 8 MiB (8388608 bytes) | ||
843 | |||
844 | {"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "ssh", "location": {"host-key-check": {"hash": "wrong", "mode": "hash", "type": "sha1"}, "path": "TEST_DIR/PID-t.img", "server": {"host": "127.0.0.1", "port": "22"}}, "size": 2097152}}} | ||
845 | {"return": {}} | ||
846 | @@ -XXX,XX +XXX,XX @@ Job failed: remote host key does not match host_key_check 'wrong' | ||
847 | |||
848 | image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}} | ||
849 | file format: IMGFMT | ||
850 | -virtual size: 4.0M (4194304 bytes) | ||
851 | +virtual size: 4 MiB (4194304 bytes) | ||
852 | |||
853 | === Invalid path and user === | ||
854 | |||
855 | diff --git a/tests/qemu-iotests/210.out b/tests/qemu-iotests/210.out | ||
856 | index XXXXXXX..XXXXXXX 100644 | ||
857 | --- a/tests/qemu-iotests/210.out | ||
858 | +++ b/tests/qemu-iotests/210.out | ||
859 | @@ -XXX,XX +XXX,XX @@ | ||
860 | |||
861 | image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_IMG"}, "key-secret": "keysec0"} | ||
862 | file format: IMGFMT | ||
863 | -virtual size: 128M (134217728 bytes) | ||
864 | +virtual size: 128 MiB (134217728 bytes) | ||
865 | encrypted: yes | ||
866 | Format specific information: | ||
867 | ivgen alg: plain64 | ||
868 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
869 | |||
870 | image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_IMG"}, "key-secret": "keysec0"} | ||
871 | file format: IMGFMT | ||
872 | -virtual size: 64M (67108864 bytes) | ||
873 | +virtual size: 64 MiB (67108864 bytes) | ||
874 | encrypted: yes | ||
875 | Format specific information: | ||
876 | ivgen alg: plain64 | ||
877 | @@ -XXX,XX +XXX,XX @@ Job failed: Cannot find device=this doesn't exist nor node_name=this doesn't exi | ||
878 | |||
879 | image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_IMG"}, "key-secret": "keysec0"} | ||
880 | file format: IMGFMT | ||
881 | -virtual size: 0 (0 bytes) | ||
882 | +virtual size: 0 B (0 bytes) | ||
883 | encrypted: yes | ||
884 | Format specific information: | ||
885 | ivgen alg: plain64 | ||
886 | @@ -XXX,XX +XXX,XX @@ Job failed: The requested file size is too large | ||
887 | {"error": {"class": "GenericError", "desc": "Parameter 'size' expects a >0 size"}} | ||
888 | image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_IMG"}, "key-secret": "keysec0"} | ||
889 | file format: IMGFMT | ||
890 | -virtual size: 0 (0 bytes) | ||
891 | +virtual size: 0 B (0 bytes) | ||
892 | encrypted: yes | ||
893 | Format specific information: | ||
894 | ivgen alg: plain64 | ||
895 | diff --git a/tests/qemu-iotests/211.out b/tests/qemu-iotests/211.out | ||
896 | index XXXXXXX..XXXXXXX 100644 | ||
897 | --- a/tests/qemu-iotests/211.out | ||
898 | +++ b/tests/qemu-iotests/211.out | ||
899 | @@ -XXX,XX +XXX,XX @@ | ||
900 | |||
901 | image: TEST_IMG | ||
902 | file format: IMGFMT | ||
903 | -virtual size: 128M (134217728 bytes) | ||
904 | +virtual size: 128 MiB (134217728 bytes) | ||
905 | cluster_size: 1048576 | ||
906 | |||
907 | [{ "start": 0, "length": 134217728, "depth": 0, "zero": true, "data": false}] | ||
908 | @@ -XXX,XX +XXX,XX @@ cluster_size: 1048576 | ||
909 | |||
910 | image: TEST_IMG | ||
911 | file format: IMGFMT | ||
912 | -virtual size: 64M (67108864 bytes) | ||
913 | +virtual size: 64 MiB (67108864 bytes) | ||
914 | cluster_size: 1048576 | ||
915 | |||
916 | [{ "start": 0, "length": 67108864, "depth": 0, "zero": true, "data": false}] | ||
917 | @@ -XXX,XX +XXX,XX @@ cluster_size: 1048576 | ||
918 | |||
919 | image: TEST_IMG | ||
920 | file format: IMGFMT | ||
921 | -virtual size: 32M (33554432 bytes) | ||
922 | +virtual size: 32 MiB (33554432 bytes) | ||
923 | cluster_size: 1048576 | ||
924 | |||
925 | [{ "start": 0, "length": 3072, "depth": 0, "zero": false, "data": true, "offset": 1024}, | ||
926 | @@ -XXX,XX +XXX,XX @@ Job failed: Cannot find device=this doesn't exist nor node_name=this doesn't exi | ||
927 | |||
928 | image: TEST_IMG | ||
929 | file format: IMGFMT | ||
930 | -virtual size: 0 (0 bytes) | ||
931 | +virtual size: 0 B (0 bytes) | ||
932 | cluster_size: 1048576 | ||
933 | |||
934 | === Maximum size === | ||
935 | @@ -XXX,XX +XXX,XX @@ cluster_size: 1048576 | ||
936 | |||
937 | image: TEST_IMG | ||
938 | file format: IMGFMT | ||
939 | -virtual size: 512T (562949819203584 bytes) | ||
940 | +virtual size: 512 TiB (562949819203584 bytes) | ||
941 | cluster_size: 1048576 | ||
942 | |||
943 | === Invalid sizes === | ||
944 | diff --git a/tests/qemu-iotests/212.out b/tests/qemu-iotests/212.out | ||
945 | index XXXXXXX..XXXXXXX 100644 | ||
946 | --- a/tests/qemu-iotests/212.out | ||
947 | +++ b/tests/qemu-iotests/212.out | ||
948 | @@ -XXX,XX +XXX,XX @@ | ||
949 | |||
950 | image: TEST_IMG | ||
951 | file format: IMGFMT | ||
952 | -virtual size: 128M (134217728 bytes) | ||
953 | +virtual size: 128 MiB (134217728 bytes) | ||
954 | |||
955 | === Successful image creation (explicit defaults) === | ||
956 | |||
957 | @@ -XXX,XX +XXX,XX @@ virtual size: 128M (134217728 bytes) | ||
958 | |||
959 | image: TEST_IMG | ||
960 | file format: IMGFMT | ||
961 | -virtual size: 64M (67108864 bytes) | ||
962 | +virtual size: 64 MiB (67108864 bytes) | ||
963 | |||
964 | === Successful image creation (with non-default options) === | ||
965 | |||
966 | @@ -XXX,XX +XXX,XX @@ virtual size: 64M (67108864 bytes) | ||
967 | |||
968 | image: TEST_IMG | ||
969 | file format: IMGFMT | ||
970 | -virtual size: 32M (33554432 bytes) | ||
971 | +virtual size: 32 MiB (33554432 bytes) | ||
972 | |||
973 | === Invalid BlockdevRef === | ||
974 | |||
975 | @@ -XXX,XX +XXX,XX @@ Job failed: Cannot find device=this doesn't exist nor node_name=this doesn't exi | ||
976 | |||
977 | image: TEST_IMG | ||
978 | file format: IMGFMT | ||
979 | -virtual size: 0 (0 bytes) | ||
980 | +virtual size: 0 B (0 bytes) | ||
981 | |||
982 | === Maximum size === | ||
983 | |||
984 | @@ -XXX,XX +XXX,XX @@ virtual size: 0 (0 bytes) | ||
985 | |||
986 | image: TEST_IMG | ||
987 | file format: IMGFMT | ||
988 | -virtual size: 4096T (4503599627369984 bytes) | ||
989 | +virtual size: 4 PiB (4503599627369984 bytes) | ||
990 | |||
991 | === Invalid sizes === | ||
992 | |||
993 | diff --git a/tests/qemu-iotests/213.out b/tests/qemu-iotests/213.out | ||
994 | index XXXXXXX..XXXXXXX 100644 | ||
995 | --- a/tests/qemu-iotests/213.out | ||
996 | +++ b/tests/qemu-iotests/213.out | ||
997 | @@ -XXX,XX +XXX,XX @@ | ||
998 | |||
999 | image: TEST_IMG | ||
1000 | file format: IMGFMT | ||
1001 | -virtual size: 128M (134217728 bytes) | ||
1002 | +virtual size: 128 MiB (134217728 bytes) | ||
1003 | cluster_size: 8388608 | ||
1004 | |||
1005 | === Successful image creation (explicit defaults) === | ||
1006 | @@ -XXX,XX +XXX,XX @@ cluster_size: 8388608 | ||
1007 | |||
1008 | image: TEST_IMG | ||
1009 | file format: IMGFMT | ||
1010 | -virtual size: 64M (67108864 bytes) | ||
1011 | +virtual size: 64 MiB (67108864 bytes) | ||
1012 | cluster_size: 8388608 | ||
1013 | |||
1014 | === Successful image creation (with non-default options) === | ||
1015 | @@ -XXX,XX +XXX,XX @@ cluster_size: 8388608 | ||
1016 | |||
1017 | image: TEST_IMG | ||
1018 | file format: IMGFMT | ||
1019 | -virtual size: 32M (33554432 bytes) | ||
1020 | +virtual size: 32 MiB (33554432 bytes) | ||
1021 | cluster_size: 268435456 | ||
1022 | |||
1023 | === Invalid BlockdevRef === | ||
1024 | @@ -XXX,XX +XXX,XX @@ Job failed: Cannot find device=this doesn't exist nor node_name=this doesn't exi | ||
1025 | |||
1026 | image: TEST_IMG | ||
1027 | file format: IMGFMT | ||
1028 | -virtual size: 0 (0 bytes) | ||
1029 | +virtual size: 0 B (0 bytes) | ||
1030 | cluster_size: 8388608 | ||
1031 | |||
1032 | === Maximum size === | ||
1033 | @@ -XXX,XX +XXX,XX @@ cluster_size: 8388608 | ||
1034 | |||
1035 | image: TEST_IMG | ||
1036 | file format: IMGFMT | ||
1037 | -virtual size: 64T (70368744177664 bytes) | ||
1038 | +virtual size: 64 TiB (70368744177664 bytes) | ||
1039 | cluster_size: 67108864 | ||
1040 | |||
1041 | === Invalid sizes === | ||
1042 | diff --git a/tests/qemu-iotests/233.out b/tests/qemu-iotests/233.out | ||
1043 | index XXXXXXX..XXXXXXX 100644 | ||
1044 | --- a/tests/qemu-iotests/233.out | ||
1045 | +++ b/tests/qemu-iotests/233.out | ||
1046 | @@ -XXX,XX +XXX,XX @@ server reported: Option 0x8 not permitted before TLS | ||
1047 | == check TLS works == | ||
1048 | image: nbd://127.0.0.1:PORT | ||
1049 | file format: nbd | ||
1050 | -virtual size: 64M (67108864 bytes) | ||
1051 | +virtual size: 64 MiB (67108864 bytes) | ||
1052 | disk size: unavailable | ||
1053 | image: nbd://127.0.0.1:PORT | ||
1054 | file format: nbd | ||
1055 | -virtual size: 64M (67108864 bytes) | ||
1056 | +virtual size: 64 MiB (67108864 bytes) | ||
1057 | disk size: unavailable | ||
1058 | exports available: 1 | ||
1059 | export: '' | ||
1060 | diff --git a/tests/qemu-iotests/237.out b/tests/qemu-iotests/237.out | ||
1061 | index XXXXXXX..XXXXXXX 100644 | ||
1062 | --- a/tests/qemu-iotests/237.out | ||
1063 | +++ b/tests/qemu-iotests/237.out | ||
1064 | @@ -XXX,XX +XXX,XX @@ | ||
1065 | |||
1066 | image: TEST_IMG | ||
1067 | file format: IMGFMT | ||
1068 | -virtual size: 5.0G (5368709120 bytes) | ||
1069 | +virtual size: 5 GiB (5368709120 bytes) | ||
1070 | cluster_size: 65536 | ||
1071 | Format specific information: | ||
1072 | cid: XXXXXXXXXX | ||
1073 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1074 | |||
1075 | image: TEST_IMG | ||
1076 | file format: IMGFMT | ||
1077 | -virtual size: 64M (67108864 bytes) | ||
1078 | +virtual size: 64 MiB (67108864 bytes) | ||
1079 | cluster_size: 65536 | ||
1080 | Format specific information: | ||
1081 | cid: XXXXXXXXXX | ||
1082 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1083 | |||
1084 | image: TEST_IMG | ||
1085 | file format: IMGFMT | ||
1086 | -virtual size: 32M (33554432 bytes) | ||
1087 | +virtual size: 32 MiB (33554432 bytes) | ||
1088 | cluster_size: 65536 | ||
1089 | Format specific information: | ||
1090 | cid: XXXXXXXXXX | ||
1091 | @@ -XXX,XX +XXX,XX @@ Job failed: List of extents contains unused extents | ||
1092 | |||
1093 | image: TEST_IMG | ||
1094 | file format: IMGFMT | ||
1095 | -virtual size: 512 (512 bytes) | ||
1096 | +virtual size: 512 B (512 bytes) | ||
1097 | Format specific information: | ||
1098 | cid: XXXXXXXXXX | ||
1099 | parent cid: XXXXXXXXXX | ||
1100 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1101 | |||
1102 | image: TEST_IMG | ||
1103 | file format: IMGFMT | ||
1104 | -virtual size: 512 (512 bytes) | ||
1105 | +virtual size: 512 B (512 bytes) | ||
1106 | cluster_size: 65536 | ||
1107 | Format specific information: | ||
1108 | cid: XXXXXXXXXX | ||
1109 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1110 | |||
1111 | image: TEST_IMG | ||
1112 | file format: IMGFMT | ||
1113 | -virtual size: 1.0G (1073741824 bytes) | ||
1114 | +virtual size: 1 GiB (1073741824 bytes) | ||
1115 | Format specific information: | ||
1116 | cid: XXXXXXXXXX | ||
1117 | parent cid: XXXXXXXXXX | ||
1118 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1119 | |||
1120 | image: TEST_IMG | ||
1121 | file format: IMGFMT | ||
1122 | -virtual size: 1.0G (1073741824 bytes) | ||
1123 | +virtual size: 1 GiB (1073741824 bytes) | ||
1124 | cluster_size: 65536 | ||
1125 | Format specific information: | ||
1126 | cid: XXXXXXXXXX | ||
1127 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1128 | |||
1129 | image: TEST_IMG | ||
1130 | file format: IMGFMT | ||
1131 | -virtual size: 2.0G (2147483648 bytes) | ||
1132 | +virtual size: 2 GiB (2147483648 bytes) | ||
1133 | Format specific information: | ||
1134 | cid: XXXXXXXXXX | ||
1135 | parent cid: XXXXXXXXXX | ||
1136 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1137 | |||
1138 | image: TEST_IMG | ||
1139 | file format: IMGFMT | ||
1140 | -virtual size: 2.0G (2147483648 bytes) | ||
1141 | +virtual size: 2 GiB (2147483648 bytes) | ||
1142 | cluster_size: 65536 | ||
1143 | Format specific information: | ||
1144 | cid: XXXXXXXXXX | ||
1145 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1146 | |||
1147 | image: TEST_IMG | ||
1148 | file format: IMGFMT | ||
1149 | -virtual size: 5.0G (5368709120 bytes) | ||
1150 | +virtual size: 5 GiB (5368709120 bytes) | ||
1151 | Format specific information: | ||
1152 | cid: XXXXXXXXXX | ||
1153 | parent cid: XXXXXXXXXX | ||
1154 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
1155 | |||
1156 | image: TEST_IMG | ||
1157 | file format: IMGFMT | ||
1158 | -virtual size: 5.0G (5368709120 bytes) | ||
1159 | +virtual size: 5 GiB (5368709120 bytes) | ||
1160 | cluster_size: 65536 | ||
1161 | Format specific information: | ||
1162 | cid: XXXXXXXXXX | ||
1163 | diff --git a/tests/qemu-iotests/242.out b/tests/qemu-iotests/242.out | ||
1164 | index XXXXXXX..XXXXXXX 100644 | ||
1165 | --- a/tests/qemu-iotests/242.out | ||
1166 | +++ b/tests/qemu-iotests/242.out | ||
1167 | @@ -XXX,XX +XXX,XX @@ qemu-img info dump: | ||
1168 | |||
1169 | image: TEST_IMG | ||
1170 | file format: IMGFMT | ||
1171 | -virtual size: 1.0M (1048576 bytes) | ||
1172 | +virtual size: 1 MiB (1048576 bytes) | ||
1173 | cluster_size: 65536 | ||
1174 | Format specific information: | ||
1175 | compat: 1.1 | ||
1176 | @@ -XXX,XX +XXX,XX @@ qemu-img info dump: | ||
1177 | |||
1178 | image: TEST_IMG | ||
1179 | file format: IMGFMT | ||
1180 | -virtual size: 1.0M (1048576 bytes) | ||
1181 | +virtual size: 1 MiB (1048576 bytes) | ||
1182 | cluster_size: 65536 | ||
1183 | Format specific information: | ||
1184 | compat: 1.1 | ||
1185 | @@ -XXX,XX +XXX,XX @@ qemu-img info dump: | ||
1186 | |||
1187 | image: TEST_IMG | ||
1188 | file format: IMGFMT | ||
1189 | -virtual size: 1.0M (1048576 bytes) | ||
1190 | +virtual size: 1 MiB (1048576 bytes) | ||
1191 | cluster_size: 65536 | ||
1192 | Format specific information: | ||
1193 | compat: 1.1 | ||
1194 | @@ -XXX,XX +XXX,XX @@ qemu-img info dump: | ||
1195 | |||
1196 | image: TEST_IMG | ||
1197 | file format: IMGFMT | ||
1198 | -virtual size: 1.0M (1048576 bytes) | ||
1199 | +virtual size: 1 MiB (1048576 bytes) | ||
1200 | cluster_size: 65536 | ||
1201 | Format specific information: | ||
1202 | compat: 1.1 | ||
1203 | @@ -XXX,XX +XXX,XX @@ Unset the unknown bitmap flag '0x4' in the bitmap directory entry: | ||
1204 | |||
1205 | image: TEST_IMG | ||
1206 | file format: IMGFMT | ||
1207 | -virtual size: 1.0M (1048576 bytes) | ||
1208 | +virtual size: 1 MiB (1048576 bytes) | ||
1209 | cluster_size: 65536 | ||
1210 | Format specific information: | ||
1211 | compat: 1.1 | ||
55 | -- | 1212 | -- |
56 | 2.19.1 | 1213 | 2.20.1 |
57 | 1214 | ||
58 | 1215 | diff view generated by jsdifflib |
1 | From: Alberto Garcia <berto@igalia.com> | 1 | Limiting the allocation to INT_MAX bytes isn't particularly clever |
---|---|---|---|
2 | because it means that the final cluster will be a partial cluster which | ||
3 | will be completed through a COW operation. This results in unnecessary | ||
4 | data read and write requests which lead to an unwanted non-sparse | ||
5 | filesystem block for metadata preallocation. | ||
2 | 6 | ||
3 | This doesn't have any practical effect at the moment because the | 7 | Align the maximum allocation size down to the cluster size to avoid this |
4 | values of BDRV_SECTOR_SIZE, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE and | 8 | situation. |
5 | QCRYPTO_BLOCK_QCOW_SECTOR_SIZE are all the same (512 bytes), but | ||
6 | future encryption methods could have different requirements. | ||
7 | 9 | ||
8 | Signed-off-by: Alberto Garcia <berto@igalia.com> | 10 | Cc: qemu-stable@nongnu.org |
9 | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> | ||
10 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
12 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
11 | --- | 13 | --- |
12 | block/qcow2.c | 2 +- | 14 | block/qcow2.c | 2 +- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 15 | 1 file changed, 1 insertion(+), 1 deletion(-) |
14 | 16 | ||
15 | diff --git a/block/qcow2.c b/block/qcow2.c | 17 | diff --git a/block/qcow2.c b/block/qcow2.c |
16 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/block/qcow2.c | 19 | --- a/block/qcow2.c |
18 | +++ b/block/qcow2.c | 20 | +++ b/block/qcow2.c |
19 | @@ -XXX,XX +XXX,XX @@ static void qcow2_refresh_limits(BlockDriverState *bs, Error **errp) | 21 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset, |
20 | 22 | bytes = new_length - offset; | |
21 | if (bs->encrypted) { | 23 | |
22 | /* Encryption works on a sector granularity */ | 24 | while (bytes) { |
23 | - bs->bl.request_alignment = BDRV_SECTOR_SIZE; | 25 | - cur_bytes = MIN(bytes, INT_MAX); |
24 | + bs->bl.request_alignment = qcrypto_block_get_sector_size(s->crypto); | 26 | + cur_bytes = MIN(bytes, QEMU_ALIGN_DOWN(INT_MAX, s->cluster_size)); |
25 | } | 27 | ret = qcow2_alloc_cluster_offset(bs, offset, &cur_bytes, |
26 | bs->bl.pwrite_zeroes_alignment = s->cluster_size; | 28 | &host_offset, &meta); |
27 | bs->bl.pdiscard_alignment = s->cluster_size; | 29 | if (ret < 0) { |
28 | -- | 30 | -- |
29 | 2.19.1 | 31 | 2.20.1 |
30 | 32 | ||
31 | 33 | diff view generated by jsdifflib |
1 | If a management application builds the block graph node by node, the | 1 | We'll add a bdrv_co_truncate() call in the next patch which can return |
---|---|---|---|
2 | protocol layer doesn't inherit its read-only option from the format | 2 | an Error that we don't want to discard. So add an errp parameter to |
3 | layer any more, so it must be set explicitly. | 3 | preallocate_co(). |
4 | 4 | ||
5 | Backing files should work on read-only storage, but at the same time, a | 5 | Cc: qemu-stable@nongnu.org |
6 | block job like commit should be able to reopen them read-write if they | ||
7 | are on read-write storage. However, without option inheritance, reopen | ||
8 | only changes the read-only option for the root node (typically the | ||
9 | format layer), but not the protocol layer, so reopening fails (the | ||
10 | format layer wants to get write permissions, but the protocol layer is | ||
11 | still read-only). | ||
12 | |||
13 | A simple workaround for the problem in the management tool would be to | ||
14 | open the protocol layer always read-write and to make only the format | ||
15 | layer read-only for backing files. However, sometimes the file is | ||
16 | actually stored on read-only storage and we don't know whether the image | ||
17 | can be opened read-write (for example, for NBD it depends on the server | ||
18 | we're trying to connect to). This adds an option that makes QEMU try to | ||
19 | open the image read-write, but allows it to degrade to a read-only mode | ||
20 | without returning an error. | ||
21 | |||
22 | The documentation for this option is consciously phrased in a way that | ||
23 | allows QEMU to switch to a better model eventually: Instead of trying | ||
24 | when the image is first opened, making the read-only flag dynamic and | ||
25 | changing it automatically whenever the first BLK_PERM_WRITE user is | ||
26 | attached or the last one is detached would be much more useful | ||
27 | behaviour. | ||
28 | |||
29 | Unfortunately, this more useful behaviour is also a lot harder to | ||
30 | implement, and libvirt needs a solution now before it can switch to | ||
31 | -blockdev, so let's start with this easier approach for now. | ||
32 | |||
33 | Instead of adding a new auto-read-only option, turning the existing | ||
34 | read-only into an enum (with a bool alternate for compatibility) was | ||
35 | considered, but it complicated the implementation to the point that it | ||
36 | didn't seem to be worth it. | ||
37 | |||
38 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
39 | Reviewed-by: Eric Blake <eblake@redhat.com> | 7 | Reviewed-by: Eric Blake <eblake@redhat.com> |
40 | --- | 8 | --- |
41 | qapi/block-core.json | 7 +++++++ | 9 | block/qcow2.c | 11 ++++++----- |
42 | include/block/block.h | 2 ++ | 10 | 1 file changed, 6 insertions(+), 5 deletions(-) |
43 | block.c | 17 +++++++++++++++++ | ||
44 | block/vvfat.c | 1 + | ||
45 | blockdev.c | 2 +- | ||
46 | 5 files changed, 28 insertions(+), 1 deletion(-) | ||
47 | 11 | ||
48 | diff --git a/qapi/block-core.json b/qapi/block-core.json | 12 | diff --git a/block/qcow2.c b/block/qcow2.c |
49 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
50 | --- a/qapi/block-core.json | 14 | --- a/block/qcow2.c |
51 | +++ b/qapi/block-core.json | 15 | +++ b/block/qcow2.c |
52 | @@ -XXX,XX +XXX,XX @@ | 16 | @@ -XXX,XX +XXX,XX @@ static int qcow2_set_up_encryption(BlockDriverState *bs, |
53 | # either generally or in certain configurations. In this case, | 17 | * Returns: 0 on success, -errno on failure. |
54 | # the default value does not work and the option must be | 18 | */ |
55 | # specified explicitly. | 19 | static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset, |
56 | +# @auto-read-only: if true and @read-only is false, QEMU may automatically | 20 | - uint64_t new_length) |
57 | +# decide not to open the image read-write as requested, but | 21 | + uint64_t new_length, Error **errp) |
58 | +# fall back to read-only instead (and switch between the modes | 22 | { |
59 | +# later), e.g. depending on whether the image file is writable | 23 | BDRVQcow2State *s = bs->opaque; |
60 | +# or whether a writing user is attached to the node | 24 | uint64_t bytes; |
61 | +# (default: false, since 3.1) | 25 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset, |
62 | # @detect-zeroes: detect and optimize zero writes (Since 2.1) | 26 | ret = qcow2_alloc_cluster_offset(bs, offset, &cur_bytes, |
63 | # (default: off) | 27 | &host_offset, &meta); |
64 | # @force-share: force share all permission on added nodes. | 28 | if (ret < 0) { |
65 | @@ -XXX,XX +XXX,XX @@ | 29 | + error_setg_errno(errp, -ret, "Allocating clusters failed"); |
66 | '*discard': 'BlockdevDiscardOptions', | 30 | return ret; |
67 | '*cache': 'BlockdevCacheOptions', | 31 | } |
68 | '*read-only': 'bool', | 32 | |
69 | + '*auto-read-only': 'bool', | 33 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset, |
70 | '*force-share': 'bool', | 34 | |
71 | '*detect-zeroes': 'BlockdevDetectZeroesOptions' }, | 35 | ret = qcow2_alloc_cluster_link_l2(bs, meta); |
72 | 'discriminator': 'driver', | 36 | if (ret < 0) { |
73 | diff --git a/include/block/block.h b/include/block/block.h | 37 | + error_setg_errno(errp, -ret, "Mapping clusters failed"); |
74 | index XXXXXXX..XXXXXXX 100644 | 38 | qcow2_free_any_clusters(bs, meta->alloc_offset, |
75 | --- a/include/block/block.h | 39 | meta->nb_clusters, QCOW2_DISCARD_NEVER); |
76 | +++ b/include/block/block.h | 40 | return ret; |
77 | @@ -XXX,XX +XXX,XX @@ typedef struct HDGeometry { | 41 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset, |
78 | select an appropriate protocol driver, | 42 | ret = bdrv_pwrite(s->data_file, (host_offset + cur_bytes) - 1, |
79 | ignoring the format layer */ | 43 | &data, 1); |
80 | #define BDRV_O_NO_IO 0x10000 /* don't initialize for I/O */ | 44 | if (ret < 0) { |
81 | +#define BDRV_O_AUTO_RDONLY 0x20000 /* degrade to read-only if opening read-write fails */ | 45 | + error_setg_errno(errp, -ret, "Writing to EOF failed"); |
82 | 46 | return ret; | |
83 | #define BDRV_O_CACHE_MASK (BDRV_O_NOCACHE | BDRV_O_NO_FLUSH) | 47 | } |
84 | |||
85 | @@ -XXX,XX +XXX,XX @@ typedef struct HDGeometry { | ||
86 | #define BDRV_OPT_CACHE_DIRECT "cache.direct" | ||
87 | #define BDRV_OPT_CACHE_NO_FLUSH "cache.no-flush" | ||
88 | #define BDRV_OPT_READ_ONLY "read-only" | ||
89 | +#define BDRV_OPT_AUTO_READ_ONLY "auto-read-only" | ||
90 | #define BDRV_OPT_DISCARD "discard" | ||
91 | #define BDRV_OPT_FORCE_SHARE "force-share" | ||
92 | |||
93 | diff --git a/block.c b/block.c | ||
94 | index XXXXXXX..XXXXXXX 100644 | ||
95 | --- a/block.c | ||
96 | +++ b/block.c | ||
97 | @@ -XXX,XX +XXX,XX @@ static void bdrv_inherited_options(int *child_flags, QDict *child_options, | ||
98 | |||
99 | /* Inherit the read-only option from the parent if it's not set */ | ||
100 | qdict_copy_default(child_options, parent_options, BDRV_OPT_READ_ONLY); | ||
101 | + qdict_copy_default(child_options, parent_options, BDRV_OPT_AUTO_READ_ONLY); | ||
102 | |||
103 | /* Our block drivers take care to send flushes and respect unmap policy, | ||
104 | * so we can default to enable both on lower layers regardless of the | ||
105 | @@ -XXX,XX +XXX,XX @@ static void bdrv_backing_options(int *child_flags, QDict *child_options, | ||
106 | |||
107 | /* backing files always opened read-only */ | ||
108 | qdict_set_default_str(child_options, BDRV_OPT_READ_ONLY, "on"); | ||
109 | + qdict_set_default_str(child_options, BDRV_OPT_AUTO_READ_ONLY, "off"); | ||
110 | flags &= ~BDRV_O_COPY_ON_READ; | ||
111 | |||
112 | /* snapshot=on is handled on the top layer */ | ||
113 | @@ -XXX,XX +XXX,XX @@ static void update_flags_from_options(int *flags, QemuOpts *opts) | ||
114 | *flags |= BDRV_O_RDWR; | ||
115 | } | 48 | } |
116 | 49 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, | |
117 | + assert(qemu_opt_find(opts, BDRV_OPT_AUTO_READ_ONLY)); | 50 | break; |
118 | + if (qemu_opt_get_bool_del(opts, BDRV_OPT_AUTO_READ_ONLY, false)) { | 51 | |
119 | + *flags |= BDRV_O_AUTO_RDONLY; | 52 | case PREALLOC_MODE_METADATA: |
120 | + } | 53 | - ret = preallocate_co(bs, old_length, offset); |
121 | } | 54 | + ret = preallocate_co(bs, old_length, offset, errp); |
122 | 55 | if (ret < 0) { | |
123 | static void update_options_from_flags(QDict *options, int flags) | 56 | - error_setg_errno(errp, -ret, "Preallocation failed"); |
124 | @@ -XXX,XX +XXX,XX @@ static void update_options_from_flags(QDict *options, int flags) | 57 | goto fail; |
125 | if (!qdict_haskey(options, BDRV_OPT_READ_ONLY)) { | 58 | } |
126 | qdict_put_bool(options, BDRV_OPT_READ_ONLY, !(flags & BDRV_O_RDWR)); | 59 | break; |
127 | } | 60 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, |
128 | + if (!qdict_haskey(options, BDRV_OPT_AUTO_READ_ONLY)) { | 61 | /* With a data file, preallocation means just allocating the metadata |
129 | + qdict_put_bool(options, BDRV_OPT_AUTO_READ_ONLY, | 62 | * and forwarding the truncate request to the data file */ |
130 | + flags & BDRV_O_AUTO_RDONLY); | 63 | if (has_data_file(bs)) { |
131 | + } | 64 | - ret = preallocate_co(bs, old_length, offset); |
132 | } | 65 | + ret = preallocate_co(bs, old_length, offset, errp); |
133 | 66 | if (ret < 0) { | |
134 | static void bdrv_assign_node_name(BlockDriverState *bs, | 67 | - error_setg_errno(errp, -ret, "Preallocation failed"); |
135 | @@ -XXX,XX +XXX,XX @@ QemuOptsList bdrv_runtime_opts = { | 68 | goto fail; |
136 | .type = QEMU_OPT_BOOL, | 69 | } |
137 | .help = "Node is opened in read-only mode", | 70 | break; |
138 | }, | ||
139 | + { | ||
140 | + .name = BDRV_OPT_AUTO_READ_ONLY, | ||
141 | + .type = QEMU_OPT_BOOL, | ||
142 | + .help = "Node can become read-only if opening read-write fails", | ||
143 | + }, | ||
144 | { | ||
145 | .name = "detect-zeroes", | ||
146 | .type = QEMU_OPT_STRING, | ||
147 | @@ -XXX,XX +XXX,XX @@ BlockDriverState *bdrv_open_blockdev_ref(BlockdevRef *ref, Error **errp) | ||
148 | qdict_set_default_str(qdict, BDRV_OPT_CACHE_DIRECT, "off"); | ||
149 | qdict_set_default_str(qdict, BDRV_OPT_CACHE_NO_FLUSH, "off"); | ||
150 | qdict_set_default_str(qdict, BDRV_OPT_READ_ONLY, "off"); | ||
151 | + qdict_set_default_str(qdict, BDRV_OPT_AUTO_READ_ONLY, "off"); | ||
152 | + | ||
153 | } | ||
154 | |||
155 | bs = bdrv_open_inherit(NULL, reference, qdict, 0, NULL, NULL, errp); | ||
156 | diff --git a/block/vvfat.c b/block/vvfat.c | ||
157 | index XXXXXXX..XXXXXXX 100644 | ||
158 | --- a/block/vvfat.c | ||
159 | +++ b/block/vvfat.c | ||
160 | @@ -XXX,XX +XXX,XX @@ static void vvfat_qcow_options(int *child_flags, QDict *child_options, | ||
161 | int parent_flags, QDict *parent_options) | ||
162 | { | ||
163 | qdict_set_default_str(child_options, BDRV_OPT_READ_ONLY, "off"); | ||
164 | + qdict_set_default_str(child_options, BDRV_OPT_AUTO_READ_ONLY, "off"); | ||
165 | qdict_set_default_str(child_options, BDRV_OPT_CACHE_NO_FLUSH, "on"); | ||
166 | } | ||
167 | |||
168 | diff --git a/blockdev.c b/blockdev.c | ||
169 | index XXXXXXX..XXXXXXX 100644 | ||
170 | --- a/blockdev.c | ||
171 | +++ b/blockdev.c | ||
172 | @@ -XXX,XX +XXX,XX @@ void qmp_blockdev_change_medium(bool has_device, const char *device, | ||
173 | |||
174 | bdrv_flags = blk_get_open_flags_from_root_state(blk); | ||
175 | bdrv_flags &= ~(BDRV_O_TEMPORARY | BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING | | ||
176 | - BDRV_O_PROTOCOL); | ||
177 | + BDRV_O_PROTOCOL | BDRV_O_AUTO_RDONLY); | ||
178 | |||
179 | if (!has_read_only) { | ||
180 | read_only = BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN; | ||
181 | -- | 71 | -- |
182 | 2.19.1 | 72 | 2.20.1 |
183 | 73 | ||
184 | 74 | diff view generated by jsdifflib |
1 | If read-only=off, but auto-read-only=on is given, open the file | 1 | preallocate_co() already gave the data file the full size without |
---|---|---|---|
2 | read-write if we have the permissions, but instead of erroring out for | 2 | forwarding the requested preallocation mode to the protocol. When |
3 | read-only files, just degrade to read-only. | 3 | bdrv_co_truncate() was called later with the preallocation mode, the |
4 | file didn't actually grow any more, so the data file stayed unallocated | ||
5 | even if full preallocation was requested. | ||
4 | 6 | ||
7 | Pass the right preallocation mode to preallocate_co() and remove the | ||
8 | second bdrv_co_truncate() to fix this. As a side effect, the ugly | ||
9 | one-byte write in preallocate_co() is replaced with a truncate call, | ||
10 | now leaving the last block unallocated on the protocol level as it | ||
11 | should be. | ||
12 | |||
13 | Cc: qemu-stable@nongnu.org | ||
5 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 14 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
6 | Reviewed-by: Eric Blake <eblake@redhat.com> | 15 | Reviewed-by: Eric Blake <eblake@redhat.com> |
7 | --- | 16 | --- |
8 | block/file-posix.c | 19 ++++++++++++++++--- | 17 | block/qcow2.c | 41 +++++++++++++++++++++++------------------ |
9 | 1 file changed, 16 insertions(+), 3 deletions(-) | 18 | 1 file changed, 23 insertions(+), 18 deletions(-) |
10 | 19 | ||
11 | diff --git a/block/file-posix.c b/block/file-posix.c | 20 | diff --git a/block/qcow2.c b/block/qcow2.c |
12 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/block/file-posix.c | 22 | --- a/block/qcow2.c |
14 | +++ b/block/file-posix.c | 23 | +++ b/block/qcow2.c |
15 | @@ -XXX,XX +XXX,XX @@ static int raw_open_common(BlockDriverState *bs, QDict *options, | 24 | @@ -XXX,XX +XXX,XX @@ static int qcow2_set_up_encryption(BlockDriverState *bs, |
16 | 25 | * Returns: 0 on success, -errno on failure. | |
17 | s->fd = -1; | 26 | */ |
18 | fd = qemu_open(filename, s->open_flags, 0644); | 27 | static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset, |
19 | - if (fd < 0) { | 28 | - uint64_t new_length, Error **errp) |
20 | - ret = -errno; | 29 | + uint64_t new_length, PreallocMode mode, |
21 | - error_setg_errno(errp, errno, "Could not open '%s'", filename); | 30 | + Error **errp) |
22 | + ret = fd < 0 ? -errno : 0; | 31 | { |
23 | + | 32 | BDRVQcow2State *s = bs->opaque; |
24 | + if (ret == -EACCES || ret == -EROFS) { | 33 | uint64_t bytes; |
25 | + /* Try to degrade to read-only, but if it doesn't work, still use the | 34 | uint64_t host_offset = 0; |
26 | + * normal error message. */ | 35 | + int64_t file_length; |
27 | + if (bdrv_apply_auto_read_only(bs, NULL, NULL) == 0) { | 36 | unsigned int cur_bytes; |
28 | + bdrv_flags &= ~BDRV_O_RDWR; | 37 | int ret; |
29 | + raw_parse_flags(bdrv_flags, &s->open_flags); | 38 | QCowL2Meta *meta; |
30 | + assert(!(s->open_flags & O_CREAT)); | 39 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset, |
31 | + fd = qemu_open(filename, s->open_flags); | 40 | * all of the allocated clusters (otherwise we get failing reads after |
32 | + ret = fd < 0 ? -errno : 0; | 41 | * EOF). Extend the image to the last allocated sector. |
33 | + } | 42 | */ |
43 | - if (host_offset != 0) { | ||
44 | - uint8_t data = 0; | ||
45 | - ret = bdrv_pwrite(s->data_file, (host_offset + cur_bytes) - 1, | ||
46 | - &data, 1); | ||
47 | + file_length = bdrv_getlength(s->data_file->bs); | ||
48 | + if (file_length < 0) { | ||
49 | + error_setg_errno(errp, -file_length, "Could not get file size"); | ||
50 | + return file_length; | ||
34 | + } | 51 | + } |
35 | + | 52 | + |
36 | + if (ret < 0) { | 53 | + if (host_offset + cur_bytes > file_length) { |
37 | + error_setg_errno(errp, -ret, "Could not open '%s'", filename); | 54 | + if (mode == PREALLOC_MODE_METADATA) { |
38 | if (ret == -EROFS) { | 55 | + mode = PREALLOC_MODE_OFF; |
39 | ret = -EACCES; | 56 | + } |
57 | + ret = bdrv_co_truncate(s->data_file, host_offset + cur_bytes, mode, | ||
58 | + errp); | ||
59 | if (ret < 0) { | ||
60 | - error_setg_errno(errp, -ret, "Writing to EOF failed"); | ||
61 | return ret; | ||
40 | } | 62 | } |
63 | } | ||
64 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, | ||
65 | |||
66 | switch (prealloc) { | ||
67 | case PREALLOC_MODE_OFF: | ||
68 | + if (has_data_file(bs)) { | ||
69 | + ret = bdrv_co_truncate(s->data_file, offset, prealloc, errp); | ||
70 | + if (ret < 0) { | ||
71 | + goto fail; | ||
72 | + } | ||
73 | + } | ||
74 | break; | ||
75 | |||
76 | case PREALLOC_MODE_METADATA: | ||
77 | - ret = preallocate_co(bs, old_length, offset, errp); | ||
78 | + ret = preallocate_co(bs, old_length, offset, prealloc, errp); | ||
79 | if (ret < 0) { | ||
80 | goto fail; | ||
81 | } | ||
82 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, | ||
83 | /* With a data file, preallocation means just allocating the metadata | ||
84 | * and forwarding the truncate request to the data file */ | ||
85 | if (has_data_file(bs)) { | ||
86 | - ret = preallocate_co(bs, old_length, offset, errp); | ||
87 | + ret = preallocate_co(bs, old_length, offset, prealloc, errp); | ||
88 | if (ret < 0) { | ||
89 | goto fail; | ||
90 | } | ||
91 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, | ||
92 | |||
93 | bs->total_sectors = offset / BDRV_SECTOR_SIZE; | ||
94 | |||
95 | - if (has_data_file(bs)) { | ||
96 | - if (prealloc == PREALLOC_MODE_METADATA) { | ||
97 | - prealloc = PREALLOC_MODE_OFF; | ||
98 | - } | ||
99 | - ret = bdrv_co_truncate(s->data_file, offset, prealloc, errp); | ||
100 | - if (ret < 0) { | ||
101 | - goto fail; | ||
102 | - } | ||
103 | - } | ||
104 | - | ||
105 | /* write updated header.size */ | ||
106 | offset = cpu_to_be64(offset); | ||
107 | ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, size), | ||
41 | -- | 108 | -- |
42 | 2.19.1 | 109 | 2.20.1 |
43 | 110 | ||
44 | 111 | diff view generated by jsdifflib |
1 | From: Max Reitz <mreitz@redhat.com> | 1 | From: Max Reitz <mreitz@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Just like in qemu_opts_print_help(), print the object name as a caption | 3 | In the "amend" section of 082, we perform a single "convert" test |
4 | instead of on every single line, indent all options, add angle brackets | 4 | (namely "convert -o help"). That does not make sense, especially |
5 | around types, and align the descriptions after 24 characters. | 5 | because we have done exactly that "convert" test earlier in 082 already. |
6 | 6 | ||
7 | Also, indent every object name in the list of available objects. | 7 | Replacing "convert" by "amend" yields an error, which is correct because |
8 | there is no point in "amend" having a default format. The user has to | ||
9 | either specify the format, or give a file for qemu-img to probe. | ||
8 | 10 | ||
9 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 11 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
10 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> | 12 | Reviewed-by: John Snow <jsnow@redhat.com> |
11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 13 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
12 | --- | 14 | --- |
13 | vl.c | 13 ++++++++++--- | 15 | tests/qemu-iotests/082 | 5 ++++- |
14 | 1 file changed, 10 insertions(+), 3 deletions(-) | 16 | tests/qemu-iotests/082.out | 5 ++--- |
17 | 2 files changed, 6 insertions(+), 4 deletions(-) | ||
15 | 18 | ||
16 | diff --git a/vl.c b/vl.c | 19 | diff --git a/tests/qemu-iotests/082 b/tests/qemu-iotests/082 |
20 | index XXXXXXX..XXXXXXX 100755 | ||
21 | --- a/tests/qemu-iotests/082 | ||
22 | +++ b/tests/qemu-iotests/082 | ||
23 | @@ -XXX,XX +XXX,XX @@ run_qemu_img amend -f $IMGFMT -o backing_file="$TEST_IMG" -o ,, -o help "$TEST_I | ||
24 | |||
25 | # Leave out everything that isn't needed | ||
26 | run_qemu_img amend -f $IMGFMT -o help | ||
27 | -run_qemu_img convert -o help | ||
28 | + | ||
29 | +# amend requires specifying either a format explicitly, or a file | ||
30 | +# which it can probe | ||
31 | +run_qemu_img amend -o help | ||
32 | |||
33 | # Try help option for a format that does not support amendment | ||
34 | run_qemu_img amend -f bochs -o help | ||
35 | diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out | ||
17 | index XXXXXXX..XXXXXXX 100644 | 36 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/vl.c | 37 | --- a/tests/qemu-iotests/082.out |
19 | +++ b/vl.c | 38 | +++ b/tests/qemu-iotests/082.out |
20 | @@ -XXX,XX +XXX,XX @@ static bool object_create_initial(const char *type, QemuOpts *opts) | 39 | @@ -XXX,XX +XXX,XX @@ Creation options for 'qcow2': |
21 | list = object_class_get_list_sorted(TYPE_USER_CREATABLE, false); | 40 | |
22 | for (l = list; l != NULL; l = l->next) { | 41 | Note that not all of these options may be amendable. |
23 | ObjectClass *oc = OBJECT_CLASS(l->data); | 42 | |
24 | - printf("%s\n", object_class_get_name(oc)); | 43 | -Testing: convert -o help |
25 | + printf(" %s\n", object_class_get_name(oc)); | 44 | -Supported options: |
26 | } | 45 | - size=<size> - Virtual disk size |
27 | g_slist_free(list); | 46 | +Testing: amend -o help |
28 | exit(0); | 47 | +qemu-img: Expecting one image file name |
29 | @@ -XXX,XX +XXX,XX @@ static bool object_create_initial(const char *type, QemuOpts *opts) | 48 | |
30 | } | 49 | Testing: amend -f bochs -o help |
31 | 50 | qemu-img: Format driver 'bochs' does not support option amendment | |
32 | str = g_string_new(NULL); | ||
33 | - g_string_append_printf(str, "%s.%s=%s", type, | ||
34 | - prop->name, prop->type); | ||
35 | + g_string_append_printf(str, " %s=<%s>", prop->name, prop->type); | ||
36 | if (prop->description) { | ||
37 | + if (str->len < 24) { | ||
38 | + g_string_append_printf(str, "%*s", 24 - (int)str->len, ""); | ||
39 | + } | ||
40 | g_string_append_printf(str, " - %s", prop->description); | ||
41 | } | ||
42 | g_ptr_array_add(array, g_string_free(str, false)); | ||
43 | } | ||
44 | g_ptr_array_sort(array, (GCompareFunc)qemu_pstrcmp0); | ||
45 | + if (array->len > 0) { | ||
46 | + printf("%s options:\n", type); | ||
47 | + } else { | ||
48 | + printf("There are no options for %s.\n", type); | ||
49 | + } | ||
50 | for (i = 0; i < array->len; i++) { | ||
51 | printf("%s\n", (char *)array->pdata[i]); | ||
52 | } | ||
53 | -- | 51 | -- |
54 | 2.19.1 | 52 | 2.20.1 |
55 | 53 | ||
56 | 54 | diff view generated by jsdifflib |
1 | From: Max Reitz <mreitz@redhat.com> | 1 | From: Max Reitz <mreitz@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | This adds some whitespace into the option help (including indentation) | 3 | qemu-img create allows giving just a format and "-o help" to get a list |
4 | and puts angle brackets around the type names. Furthermore, the list | 4 | of the options supported by that format. Users may not realize that the |
5 | name is no longer printed as part of every line, but only once in | 5 | protocol level may offer even more options, which they only get to see |
6 | advance, and only if the caller did not print a caption already. | 6 | by specifying a filename. |
7 | 7 | ||
8 | This patch also restores the description alignment we had before commit | 8 | This patch adds a note to hint at that fact. |
9 | 9cbef9d68ee1d8d0, just at 24 instead of 16 characters like we used to. | ||
10 | This increase is because now we have the type and two spaces of | ||
11 | indentation before the description, and with a usual type name length of | ||
12 | three chracters, this sums up to eight additional characters -- which | ||
13 | means that we now need 24 characters to get the same amount of padding | ||
14 | for most options. Also, 24 is a third of 80, which makes it kind of a | ||
15 | round number in terminal terms. | ||
16 | |||
17 | Finally, this patch amends the reference output of iotest 082 to match | ||
18 | the changes (and thus makes it pass again). | ||
19 | 9 | ||
20 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 10 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
21 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> | 11 | Reviewed-by: John Snow <jsnow@redhat.com> |
22 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 12 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
23 | --- | 13 | --- |
24 | include/qemu/option.h | 2 +- | 14 | qemu-img.c | 13 ++++++++++++- |
25 | qemu-img.c | 4 +- | 15 | tests/qemu-iotests/082.out | 20 ++++++++++++++++---- |
26 | util/qemu-option.c | 32 +- | 16 | 2 files changed, 28 insertions(+), 5 deletions(-) |
27 | tests/qemu-iotests/082.out | 956 ++++++++++++++++++------------------- | ||
28 | 4 files changed, 507 insertions(+), 487 deletions(-) | ||
29 | 17 | ||
30 | diff --git a/include/qemu/option.h b/include/qemu/option.h | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/include/qemu/option.h | ||
33 | +++ b/include/qemu/option.h | ||
34 | @@ -XXX,XX +XXX,XX @@ typedef int (*qemu_opts_loopfunc)(void *opaque, QemuOpts *opts, Error **errp); | ||
35 | int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, | ||
36 | void *opaque, Error **errp); | ||
37 | void qemu_opts_print(QemuOpts *opts, const char *sep); | ||
38 | -void qemu_opts_print_help(QemuOptsList *list); | ||
39 | +void qemu_opts_print_help(QemuOptsList *list, bool print_caption); | ||
40 | void qemu_opts_free(QemuOptsList *list); | ||
41 | QemuOptsList *qemu_opts_append(QemuOptsList *dst, QemuOptsList *list); | ||
42 | |||
43 | diff --git a/qemu-img.c b/qemu-img.c | 18 | diff --git a/qemu-img.c b/qemu-img.c |
44 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
45 | --- a/qemu-img.c | 20 | --- a/qemu-img.c |
46 | +++ b/qemu-img.c | 21 | +++ b/qemu-img.c |
47 | @@ -XXX,XX +XXX,XX @@ static int print_block_option_help(const char *filename, const char *fmt) | 22 | @@ -XXX,XX +XXX,XX @@ static int print_block_option_help(const char *filename, const char *fmt) |
23 | create_opts = qemu_opts_append(create_opts, proto_drv->create_opts); | ||
48 | } | 24 | } |
49 | 25 | ||
50 | printf("Supported options:\n"); | 26 | - printf("Supported options:\n"); |
51 | - qemu_opts_print_help(create_opts); | 27 | + if (filename) { |
52 | + qemu_opts_print_help(create_opts, false); | 28 | + printf("Supported options:\n"); |
29 | + } else { | ||
30 | + printf("Supported %s options:\n", fmt); | ||
31 | + } | ||
32 | qemu_opts_print_help(create_opts, false); | ||
53 | qemu_opts_free(create_opts); | 33 | qemu_opts_free(create_opts); |
34 | + | ||
35 | + if (!filename) { | ||
36 | + printf("\n" | ||
37 | + "The protocol level may support further options.\n" | ||
38 | + "Specify the target filename to include those options.\n"); | ||
39 | + } | ||
40 | + | ||
54 | return 0; | 41 | return 0; |
55 | } | 42 | } |
56 | @@ -XXX,XX +XXX,XX @@ static int print_amend_option_help(const char *format) | 43 | |
57 | assert(drv->create_opts); | ||
58 | |||
59 | printf("Creation options for '%s':\n", format); | ||
60 | - qemu_opts_print_help(drv->create_opts); | ||
61 | + qemu_opts_print_help(drv->create_opts, false); | ||
62 | printf("\nNote that not all of these options may be amendable.\n"); | ||
63 | return 0; | ||
64 | } | ||
65 | diff --git a/util/qemu-option.c b/util/qemu-option.c | ||
66 | index XXXXXXX..XXXXXXX 100644 | ||
67 | --- a/util/qemu-option.c | ||
68 | +++ b/util/qemu-option.c | ||
69 | @@ -XXX,XX +XXX,XX @@ static const char *opt_type_to_string(enum QemuOptType type) | ||
70 | g_assert_not_reached(); | ||
71 | } | ||
72 | |||
73 | -void qemu_opts_print_help(QemuOptsList *list) | ||
74 | +/** | ||
75 | + * Print the list of options available in the given list. If | ||
76 | + * @print_caption is true, a caption (including the list name, if it | ||
77 | + * exists) is printed. The options itself will be indented, so | ||
78 | + * @print_caption should only be set to false if the caller prints its | ||
79 | + * own custom caption (so that the indentation makes sense). | ||
80 | + */ | ||
81 | +void qemu_opts_print_help(QemuOptsList *list, bool print_caption) | ||
82 | { | ||
83 | QemuOptDesc *desc; | ||
84 | int i; | ||
85 | @@ -XXX,XX +XXX,XX @@ void qemu_opts_print_help(QemuOptsList *list) | ||
86 | desc = list->desc; | ||
87 | while (desc && desc->name) { | ||
88 | GString *str = g_string_new(NULL); | ||
89 | - if (list->name) { | ||
90 | - g_string_append_printf(str, "%s.", list->name); | ||
91 | - } | ||
92 | - g_string_append_printf(str, "%s=%s", desc->name, | ||
93 | + g_string_append_printf(str, " %s=<%s>", desc->name, | ||
94 | opt_type_to_string(desc->type)); | ||
95 | if (desc->help) { | ||
96 | + if (str->len < 24) { | ||
97 | + g_string_append_printf(str, "%*s", 24 - (int)str->len, ""); | ||
98 | + } | ||
99 | g_string_append_printf(str, " - %s", desc->help); | ||
100 | } | ||
101 | g_ptr_array_add(array, g_string_free(str, false)); | ||
102 | @@ -XXX,XX +XXX,XX @@ void qemu_opts_print_help(QemuOptsList *list) | ||
103 | } | ||
104 | |||
105 | g_ptr_array_sort(array, (GCompareFunc)qemu_pstrcmp0); | ||
106 | + if (print_caption && array->len > 0) { | ||
107 | + if (list->name) { | ||
108 | + printf("%s options:\n", list->name); | ||
109 | + } else { | ||
110 | + printf("Options:\n"); | ||
111 | + } | ||
112 | + } else if (array->len == 0) { | ||
113 | + if (list->name) { | ||
114 | + printf("There are no options for %s.\n", list->name); | ||
115 | + } else { | ||
116 | + printf("No options available.\n"); | ||
117 | + } | ||
118 | + } | ||
119 | for (i = 0; i < array->len; i++) { | ||
120 | printf("%s\n", (char *)array->pdata[i]); | ||
121 | } | ||
122 | @@ -XXX,XX +XXX,XX @@ QemuOpts *qemu_opts_parse_noisily(QemuOptsList *list, const char *params, | ||
123 | opts = opts_parse(list, params, permit_abbrev, false, &invalidp, &err); | ||
124 | if (err) { | ||
125 | if (invalidp && has_help_option(params)) { | ||
126 | - qemu_opts_print_help(list); | ||
127 | + qemu_opts_print_help(list, true); | ||
128 | error_free(err); | ||
129 | } else { | ||
130 | error_report_err(err); | ||
131 | diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out | 44 | diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out |
132 | index XXXXXXX..XXXXXXX 100644 | 45 | index XXXXXXX..XXXXXXX 100644 |
133 | --- a/tests/qemu-iotests/082.out | 46 | --- a/tests/qemu-iotests/082.out |
134 | +++ b/tests/qemu-iotests/082.out | 47 | +++ b/tests/qemu-iotests/082.out |
135 | @@ -XXX,XX +XXX,XX @@ cluster_size: 8192 | 48 | @@ -XXX,XX +XXX,XX @@ Testing: create -f qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,, -o help TEST_DIR |
136 | 49 | qemu-img: Invalid option list: ,, | |
137 | Testing: create -f qcow2 -o help TEST_DIR/t.qcow2 128M | ||
138 | Supported options: | ||
139 | -size Virtual disk size | ||
140 | -compat Compatibility level (0.10 or 1.1) | ||
141 | -backing_file File name of a base image | ||
142 | -backing_fmt Image format of the base image | ||
143 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
144 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
145 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
146 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
147 | -encrypt.cipher-mode Name of encryption cipher mode | ||
148 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
149 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
150 | -encrypt.hash-alg Name of encryption hash algorithm | ||
151 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
152 | -cluster_size qcow2 cluster size | ||
153 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
154 | -lazy_refcounts Postpone refcount updates | ||
155 | -refcount_bits Width of a reference count entry in bits | ||
156 | -nocow Turn off copy-on-write (valid only on btrfs) | ||
157 | + backing_file=<str> - File name of a base image | ||
158 | + backing_fmt=<str> - Image format of the base image | ||
159 | + cluster_size=<size> - qcow2 cluster size | ||
160 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
161 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
162 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
163 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
164 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
165 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
166 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
167 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
168 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
169 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
170 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
171 | + nocow=<bool (on/off)> - Turn off copy-on-write (valid only on btrfs) | ||
172 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
173 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
174 | + size=<size> - Virtual disk size | ||
175 | |||
176 | Testing: create -f qcow2 -o ? TEST_DIR/t.qcow2 128M | ||
177 | Supported options: | ||
178 | -size Virtual disk size | ||
179 | -compat Compatibility level (0.10 or 1.1) | ||
180 | -backing_file File name of a base image | ||
181 | -backing_fmt Image format of the base image | ||
182 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
183 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
184 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
185 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
186 | -encrypt.cipher-mode Name of encryption cipher mode | ||
187 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
188 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
189 | -encrypt.hash-alg Name of encryption hash algorithm | ||
190 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
191 | -cluster_size qcow2 cluster size | ||
192 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
193 | -lazy_refcounts Postpone refcount updates | ||
194 | -refcount_bits Width of a reference count entry in bits | ||
195 | -nocow Turn off copy-on-write (valid only on btrfs) | ||
196 | + backing_file=<str> - File name of a base image | ||
197 | + backing_fmt=<str> - Image format of the base image | ||
198 | + cluster_size=<size> - qcow2 cluster size | ||
199 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
200 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
201 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
202 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
203 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
204 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
205 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
206 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
207 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
208 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
209 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
210 | + nocow=<bool (on/off)> - Turn off copy-on-write (valid only on btrfs) | ||
211 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
212 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
213 | + size=<size> - Virtual disk size | ||
214 | |||
215 | Testing: create -f qcow2 -o cluster_size=4k,help TEST_DIR/t.qcow2 128M | ||
216 | Supported options: | ||
217 | -size Virtual disk size | ||
218 | -compat Compatibility level (0.10 or 1.1) | ||
219 | -backing_file File name of a base image | ||
220 | -backing_fmt Image format of the base image | ||
221 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
222 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
223 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
224 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
225 | -encrypt.cipher-mode Name of encryption cipher mode | ||
226 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
227 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
228 | -encrypt.hash-alg Name of encryption hash algorithm | ||
229 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
230 | -cluster_size qcow2 cluster size | ||
231 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
232 | -lazy_refcounts Postpone refcount updates | ||
233 | -refcount_bits Width of a reference count entry in bits | ||
234 | -nocow Turn off copy-on-write (valid only on btrfs) | ||
235 | + backing_file=<str> - File name of a base image | ||
236 | + backing_fmt=<str> - Image format of the base image | ||
237 | + cluster_size=<size> - qcow2 cluster size | ||
238 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
239 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
240 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
241 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
242 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
243 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
244 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
245 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
246 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
247 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
248 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
249 | + nocow=<bool (on/off)> - Turn off copy-on-write (valid only on btrfs) | ||
250 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
251 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
252 | + size=<size> - Virtual disk size | ||
253 | |||
254 | Testing: create -f qcow2 -o cluster_size=4k,? TEST_DIR/t.qcow2 128M | ||
255 | Supported options: | ||
256 | -size Virtual disk size | ||
257 | -compat Compatibility level (0.10 or 1.1) | ||
258 | -backing_file File name of a base image | ||
259 | -backing_fmt Image format of the base image | ||
260 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
261 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
262 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
263 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
264 | -encrypt.cipher-mode Name of encryption cipher mode | ||
265 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
266 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
267 | -encrypt.hash-alg Name of encryption hash algorithm | ||
268 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
269 | -cluster_size qcow2 cluster size | ||
270 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
271 | -lazy_refcounts Postpone refcount updates | ||
272 | -refcount_bits Width of a reference count entry in bits | ||
273 | -nocow Turn off copy-on-write (valid only on btrfs) | ||
274 | + backing_file=<str> - File name of a base image | ||
275 | + backing_fmt=<str> - Image format of the base image | ||
276 | + cluster_size=<size> - qcow2 cluster size | ||
277 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
278 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
279 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
280 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
281 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
282 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
283 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
284 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
285 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
286 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
287 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
288 | + nocow=<bool (on/off)> - Turn off copy-on-write (valid only on btrfs) | ||
289 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
290 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
291 | + size=<size> - Virtual disk size | ||
292 | |||
293 | Testing: create -f qcow2 -o help,cluster_size=4k TEST_DIR/t.qcow2 128M | ||
294 | Supported options: | ||
295 | -size Virtual disk size | ||
296 | -compat Compatibility level (0.10 or 1.1) | ||
297 | -backing_file File name of a base image | ||
298 | -backing_fmt Image format of the base image | ||
299 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
300 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
301 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
302 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
303 | -encrypt.cipher-mode Name of encryption cipher mode | ||
304 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
305 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
306 | -encrypt.hash-alg Name of encryption hash algorithm | ||
307 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
308 | -cluster_size qcow2 cluster size | ||
309 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
310 | -lazy_refcounts Postpone refcount updates | ||
311 | -refcount_bits Width of a reference count entry in bits | ||
312 | -nocow Turn off copy-on-write (valid only on btrfs) | ||
313 | + backing_file=<str> - File name of a base image | ||
314 | + backing_fmt=<str> - Image format of the base image | ||
315 | + cluster_size=<size> - qcow2 cluster size | ||
316 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
317 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
318 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
319 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
320 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
321 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
322 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
323 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
324 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
325 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
326 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
327 | + nocow=<bool (on/off)> - Turn off copy-on-write (valid only on btrfs) | ||
328 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
329 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
330 | + size=<size> - Virtual disk size | ||
331 | |||
332 | Testing: create -f qcow2 -o ?,cluster_size=4k TEST_DIR/t.qcow2 128M | ||
333 | Supported options: | ||
334 | -size Virtual disk size | ||
335 | -compat Compatibility level (0.10 or 1.1) | ||
336 | -backing_file File name of a base image | ||
337 | -backing_fmt Image format of the base image | ||
338 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
339 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
340 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
341 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
342 | -encrypt.cipher-mode Name of encryption cipher mode | ||
343 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
344 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
345 | -encrypt.hash-alg Name of encryption hash algorithm | ||
346 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
347 | -cluster_size qcow2 cluster size | ||
348 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
349 | -lazy_refcounts Postpone refcount updates | ||
350 | -refcount_bits Width of a reference count entry in bits | ||
351 | -nocow Turn off copy-on-write (valid only on btrfs) | ||
352 | + backing_file=<str> - File name of a base image | ||
353 | + backing_fmt=<str> - Image format of the base image | ||
354 | + cluster_size=<size> - qcow2 cluster size | ||
355 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
356 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
357 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
358 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
359 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
360 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
361 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
362 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
363 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
364 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
365 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
366 | + nocow=<bool (on/off)> - Turn off copy-on-write (valid only on btrfs) | ||
367 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
368 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
369 | + size=<size> - Virtual disk size | ||
370 | |||
371 | Testing: create -f qcow2 -o cluster_size=4k -o help TEST_DIR/t.qcow2 128M | ||
372 | Supported options: | ||
373 | -size Virtual disk size | ||
374 | -compat Compatibility level (0.10 or 1.1) | ||
375 | -backing_file File name of a base image | ||
376 | -backing_fmt Image format of the base image | ||
377 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
378 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
379 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
380 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
381 | -encrypt.cipher-mode Name of encryption cipher mode | ||
382 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
383 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
384 | -encrypt.hash-alg Name of encryption hash algorithm | ||
385 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
386 | -cluster_size qcow2 cluster size | ||
387 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
388 | -lazy_refcounts Postpone refcount updates | ||
389 | -refcount_bits Width of a reference count entry in bits | ||
390 | -nocow Turn off copy-on-write (valid only on btrfs) | ||
391 | + backing_file=<str> - File name of a base image | ||
392 | + backing_fmt=<str> - Image format of the base image | ||
393 | + cluster_size=<size> - qcow2 cluster size | ||
394 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
395 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
396 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
397 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
398 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
399 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
400 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
401 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
402 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
403 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
404 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
405 | + nocow=<bool (on/off)> - Turn off copy-on-write (valid only on btrfs) | ||
406 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
407 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
408 | + size=<size> - Virtual disk size | ||
409 | |||
410 | Testing: create -f qcow2 -o cluster_size=4k -o ? TEST_DIR/t.qcow2 128M | ||
411 | Supported options: | ||
412 | -size Virtual disk size | ||
413 | -compat Compatibility level (0.10 or 1.1) | ||
414 | -backing_file File name of a base image | ||
415 | -backing_fmt Image format of the base image | ||
416 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
417 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
418 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
419 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
420 | -encrypt.cipher-mode Name of encryption cipher mode | ||
421 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
422 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
423 | -encrypt.hash-alg Name of encryption hash algorithm | ||
424 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
425 | -cluster_size qcow2 cluster size | ||
426 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
427 | -lazy_refcounts Postpone refcount updates | ||
428 | -refcount_bits Width of a reference count entry in bits | ||
429 | -nocow Turn off copy-on-write (valid only on btrfs) | ||
430 | + backing_file=<str> - File name of a base image | ||
431 | + backing_fmt=<str> - Image format of the base image | ||
432 | + cluster_size=<size> - qcow2 cluster size | ||
433 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
434 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
435 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
436 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
437 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
438 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
439 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
440 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
441 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
442 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
443 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
444 | + nocow=<bool (on/off)> - Turn off copy-on-write (valid only on btrfs) | ||
445 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
446 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
447 | + size=<size> - Virtual disk size | ||
448 | |||
449 | Testing: create -f qcow2 -u -o backing_file=TEST_DIR/t.qcow2,,help TEST_DIR/t.qcow2 128M | ||
450 | Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 backing_file=TEST_DIR/t.qcow2,,help cluster_size=65536 lazy_refcounts=off refcount_bits=16 | ||
451 | @@ -XXX,XX +XXX,XX @@ qemu-img: Invalid option list: ,, | ||
452 | 50 | ||
453 | Testing: create -f qcow2 -o help | 51 | Testing: create -f qcow2 -o help |
454 | Supported options: | 52 | -Supported options: |
455 | -size Virtual disk size | 53 | +Supported qcow2 options: |
456 | -compat Compatibility level (0.10 or 1.1) | 54 | backing_file=<str> - File name of a base image |
457 | -backing_file File name of a base image | 55 | backing_fmt=<str> - Image format of the base image |
458 | -backing_fmt Image format of the base image | 56 | cluster_size=<size> - qcow2 cluster size |
459 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | 57 | @@ -XXX,XX +XXX,XX @@ Supported options: |
460 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | 58 | refcount_bits=<num> - Width of a reference count entry in bits |
461 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | 59 | size=<size> - Virtual disk size |
462 | -encrypt.cipher-alg Name of encryption cipher algorithm | 60 | |
463 | -encrypt.cipher-mode Name of encryption cipher mode | 61 | +The protocol level may support further options. |
464 | -encrypt.ivgen-alg Name of IV generator algorithm | 62 | +Specify the target filename to include those options. |
465 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | 63 | + |
466 | -encrypt.hash-alg Name of encryption hash algorithm | ||
467 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
468 | -cluster_size qcow2 cluster size | ||
469 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
470 | -lazy_refcounts Postpone refcount updates | ||
471 | -refcount_bits Width of a reference count entry in bits | ||
472 | + backing_file=<str> - File name of a base image | ||
473 | + backing_fmt=<str> - Image format of the base image | ||
474 | + cluster_size=<size> - qcow2 cluster size | ||
475 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
476 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
477 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
478 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
479 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
480 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
481 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
482 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
483 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
484 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
485 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
486 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
487 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
488 | + size=<size> - Virtual disk size | ||
489 | |||
490 | Testing: create -o help | 64 | Testing: create -o help |
491 | Supported options: | 65 | -Supported options: |
492 | -size Virtual disk size | 66 | +Supported raw options: |
493 | + size=<size> - Virtual disk size | 67 | size=<size> - Virtual disk size |
494 | 68 | ||
69 | +The protocol level may support further options. | ||
70 | +Specify the target filename to include those options. | ||
71 | + | ||
495 | Testing: create -f bochs -o help | 72 | Testing: create -f bochs -o help |
496 | qemu-img: Format driver 'bochs' does not support image creation | 73 | qemu-img: Format driver 'bochs' does not support image creation |
497 | @@ -XXX,XX +XXX,XX @@ cluster_size: 8192 | 74 | |
498 | 75 | @@ -XXX,XX +XXX,XX @@ Testing: convert -O qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,, -o help TEST_DI | |
499 | Testing: convert -O qcow2 -o help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | 76 | qemu-img: Invalid option list: ,, |
500 | Supported options: | ||
501 | -size Virtual disk size | ||
502 | -compat Compatibility level (0.10 or 1.1) | ||
503 | -backing_file File name of a base image | ||
504 | -backing_fmt Image format of the base image | ||
505 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
506 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
507 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
508 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
509 | -encrypt.cipher-mode Name of encryption cipher mode | ||
510 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
511 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
512 | -encrypt.hash-alg Name of encryption hash algorithm | ||
513 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
514 | -cluster_size qcow2 cluster size | ||
515 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
516 | -lazy_refcounts Postpone refcount updates | ||
517 | -refcount_bits Width of a reference count entry in bits | ||
518 | -nocow Turn off copy-on-write (valid only on btrfs) | ||
519 | + backing_file=<str> - File name of a base image | ||
520 | + backing_fmt=<str> - Image format of the base image | ||
521 | + cluster_size=<size> - qcow2 cluster size | ||
522 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
523 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
524 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
525 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
526 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
527 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
528 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
529 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
530 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
531 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
532 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
533 | + nocow=<bool (on/off)> - Turn off copy-on-write (valid only on btrfs) | ||
534 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
535 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
536 | + size=<size> - Virtual disk size | ||
537 | |||
538 | Testing: convert -O qcow2 -o ? TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
539 | Supported options: | ||
540 | -size Virtual disk size | ||
541 | -compat Compatibility level (0.10 or 1.1) | ||
542 | -backing_file File name of a base image | ||
543 | -backing_fmt Image format of the base image | ||
544 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
545 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
546 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
547 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
548 | -encrypt.cipher-mode Name of encryption cipher mode | ||
549 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
550 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
551 | -encrypt.hash-alg Name of encryption hash algorithm | ||
552 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
553 | -cluster_size qcow2 cluster size | ||
554 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
555 | -lazy_refcounts Postpone refcount updates | ||
556 | -refcount_bits Width of a reference count entry in bits | ||
557 | -nocow Turn off copy-on-write (valid only on btrfs) | ||
558 | + backing_file=<str> - File name of a base image | ||
559 | + backing_fmt=<str> - Image format of the base image | ||
560 | + cluster_size=<size> - qcow2 cluster size | ||
561 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
562 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
563 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
564 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
565 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
566 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
567 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
568 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
569 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
570 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
571 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
572 | + nocow=<bool (on/off)> - Turn off copy-on-write (valid only on btrfs) | ||
573 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
574 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
575 | + size=<size> - Virtual disk size | ||
576 | |||
577 | Testing: convert -O qcow2 -o cluster_size=4k,help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
578 | Supported options: | ||
579 | -size Virtual disk size | ||
580 | -compat Compatibility level (0.10 or 1.1) | ||
581 | -backing_file File name of a base image | ||
582 | -backing_fmt Image format of the base image | ||
583 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
584 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
585 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
586 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
587 | -encrypt.cipher-mode Name of encryption cipher mode | ||
588 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
589 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
590 | -encrypt.hash-alg Name of encryption hash algorithm | ||
591 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
592 | -cluster_size qcow2 cluster size | ||
593 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
594 | -lazy_refcounts Postpone refcount updates | ||
595 | -refcount_bits Width of a reference count entry in bits | ||
596 | -nocow Turn off copy-on-write (valid only on btrfs) | ||
597 | + backing_file=<str> - File name of a base image | ||
598 | + backing_fmt=<str> - Image format of the base image | ||
599 | + cluster_size=<size> - qcow2 cluster size | ||
600 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
601 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
602 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
603 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
604 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
605 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
606 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
607 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
608 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
609 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
610 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
611 | + nocow=<bool (on/off)> - Turn off copy-on-write (valid only on btrfs) | ||
612 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
613 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
614 | + size=<size> - Virtual disk size | ||
615 | |||
616 | Testing: convert -O qcow2 -o cluster_size=4k,? TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
617 | Supported options: | ||
618 | -size Virtual disk size | ||
619 | -compat Compatibility level (0.10 or 1.1) | ||
620 | -backing_file File name of a base image | ||
621 | -backing_fmt Image format of the base image | ||
622 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
623 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
624 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
625 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
626 | -encrypt.cipher-mode Name of encryption cipher mode | ||
627 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
628 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
629 | -encrypt.hash-alg Name of encryption hash algorithm | ||
630 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
631 | -cluster_size qcow2 cluster size | ||
632 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
633 | -lazy_refcounts Postpone refcount updates | ||
634 | -refcount_bits Width of a reference count entry in bits | ||
635 | -nocow Turn off copy-on-write (valid only on btrfs) | ||
636 | + backing_file=<str> - File name of a base image | ||
637 | + backing_fmt=<str> - Image format of the base image | ||
638 | + cluster_size=<size> - qcow2 cluster size | ||
639 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
640 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
641 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
642 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
643 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
644 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
645 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
646 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
647 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
648 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
649 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
650 | + nocow=<bool (on/off)> - Turn off copy-on-write (valid only on btrfs) | ||
651 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
652 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
653 | + size=<size> - Virtual disk size | ||
654 | |||
655 | Testing: convert -O qcow2 -o help,cluster_size=4k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
656 | Supported options: | ||
657 | -size Virtual disk size | ||
658 | -compat Compatibility level (0.10 or 1.1) | ||
659 | -backing_file File name of a base image | ||
660 | -backing_fmt Image format of the base image | ||
661 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
662 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
663 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
664 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
665 | -encrypt.cipher-mode Name of encryption cipher mode | ||
666 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
667 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
668 | -encrypt.hash-alg Name of encryption hash algorithm | ||
669 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
670 | -cluster_size qcow2 cluster size | ||
671 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
672 | -lazy_refcounts Postpone refcount updates | ||
673 | -refcount_bits Width of a reference count entry in bits | ||
674 | -nocow Turn off copy-on-write (valid only on btrfs) | ||
675 | + backing_file=<str> - File name of a base image | ||
676 | + backing_fmt=<str> - Image format of the base image | ||
677 | + cluster_size=<size> - qcow2 cluster size | ||
678 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
679 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
680 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
681 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
682 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
683 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
684 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
685 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
686 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
687 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
688 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
689 | + nocow=<bool (on/off)> - Turn off copy-on-write (valid only on btrfs) | ||
690 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
691 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
692 | + size=<size> - Virtual disk size | ||
693 | |||
694 | Testing: convert -O qcow2 -o ?,cluster_size=4k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
695 | Supported options: | ||
696 | -size Virtual disk size | ||
697 | -compat Compatibility level (0.10 or 1.1) | ||
698 | -backing_file File name of a base image | ||
699 | -backing_fmt Image format of the base image | ||
700 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
701 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
702 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
703 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
704 | -encrypt.cipher-mode Name of encryption cipher mode | ||
705 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
706 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
707 | -encrypt.hash-alg Name of encryption hash algorithm | ||
708 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
709 | -cluster_size qcow2 cluster size | ||
710 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
711 | -lazy_refcounts Postpone refcount updates | ||
712 | -refcount_bits Width of a reference count entry in bits | ||
713 | -nocow Turn off copy-on-write (valid only on btrfs) | ||
714 | + backing_file=<str> - File name of a base image | ||
715 | + backing_fmt=<str> - Image format of the base image | ||
716 | + cluster_size=<size> - qcow2 cluster size | ||
717 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
718 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
719 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
720 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
721 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
722 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
723 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
724 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
725 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
726 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
727 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
728 | + nocow=<bool (on/off)> - Turn off copy-on-write (valid only on btrfs) | ||
729 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
730 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
731 | + size=<size> - Virtual disk size | ||
732 | |||
733 | Testing: convert -O qcow2 -o cluster_size=4k -o help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
734 | Supported options: | ||
735 | -size Virtual disk size | ||
736 | -compat Compatibility level (0.10 or 1.1) | ||
737 | -backing_file File name of a base image | ||
738 | -backing_fmt Image format of the base image | ||
739 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
740 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
741 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
742 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
743 | -encrypt.cipher-mode Name of encryption cipher mode | ||
744 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
745 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
746 | -encrypt.hash-alg Name of encryption hash algorithm | ||
747 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
748 | -cluster_size qcow2 cluster size | ||
749 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
750 | -lazy_refcounts Postpone refcount updates | ||
751 | -refcount_bits Width of a reference count entry in bits | ||
752 | -nocow Turn off copy-on-write (valid only on btrfs) | ||
753 | + backing_file=<str> - File name of a base image | ||
754 | + backing_fmt=<str> - Image format of the base image | ||
755 | + cluster_size=<size> - qcow2 cluster size | ||
756 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
757 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
758 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
759 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
760 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
761 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
762 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
763 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
764 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
765 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
766 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
767 | + nocow=<bool (on/off)> - Turn off copy-on-write (valid only on btrfs) | ||
768 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
769 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
770 | + size=<size> - Virtual disk size | ||
771 | |||
772 | Testing: convert -O qcow2 -o cluster_size=4k -o ? TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
773 | Supported options: | ||
774 | -size Virtual disk size | ||
775 | -compat Compatibility level (0.10 or 1.1) | ||
776 | -backing_file File name of a base image | ||
777 | -backing_fmt Image format of the base image | ||
778 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
779 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
780 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
781 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
782 | -encrypt.cipher-mode Name of encryption cipher mode | ||
783 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
784 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
785 | -encrypt.hash-alg Name of encryption hash algorithm | ||
786 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
787 | -cluster_size qcow2 cluster size | ||
788 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
789 | -lazy_refcounts Postpone refcount updates | ||
790 | -refcount_bits Width of a reference count entry in bits | ||
791 | -nocow Turn off copy-on-write (valid only on btrfs) | ||
792 | + backing_file=<str> - File name of a base image | ||
793 | + backing_fmt=<str> - Image format of the base image | ||
794 | + cluster_size=<size> - qcow2 cluster size | ||
795 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
796 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
797 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
798 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
799 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
800 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
801 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
802 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
803 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
804 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
805 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
806 | + nocow=<bool (on/off)> - Turn off copy-on-write (valid only on btrfs) | ||
807 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
808 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
809 | + size=<size> - Virtual disk size | ||
810 | |||
811 | Testing: convert -O qcow2 -o backing_file=TEST_DIR/t.qcow2,,help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base | ||
812 | qemu-img: Could not open 'TEST_DIR/t.qcow2.base': Could not open backing file: Could not open 'TEST_DIR/t.qcow2,help': No such file or directory | ||
813 | @@ -XXX,XX +XXX,XX @@ qemu-img: Invalid option list: ,, | ||
814 | 77 | ||
815 | Testing: convert -O qcow2 -o help | 78 | Testing: convert -O qcow2 -o help |
816 | Supported options: | 79 | -Supported options: |
817 | -size Virtual disk size | 80 | +Supported qcow2 options: |
818 | -compat Compatibility level (0.10 or 1.1) | 81 | backing_file=<str> - File name of a base image |
819 | -backing_file File name of a base image | 82 | backing_fmt=<str> - Image format of the base image |
820 | -backing_fmt Image format of the base image | 83 | cluster_size=<size> - qcow2 cluster size |
821 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | 84 | @@ -XXX,XX +XXX,XX @@ Supported options: |
822 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | 85 | refcount_bits=<num> - Width of a reference count entry in bits |
823 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | 86 | size=<size> - Virtual disk size |
824 | -encrypt.cipher-alg Name of encryption cipher algorithm | 87 | |
825 | -encrypt.cipher-mode Name of encryption cipher mode | 88 | +The protocol level may support further options. |
826 | -encrypt.ivgen-alg Name of IV generator algorithm | 89 | +Specify the target filename to include those options. |
827 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | 90 | + |
828 | -encrypt.hash-alg Name of encryption hash algorithm | ||
829 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
830 | -cluster_size qcow2 cluster size | ||
831 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
832 | -lazy_refcounts Postpone refcount updates | ||
833 | -refcount_bits Width of a reference count entry in bits | ||
834 | + backing_file=<str> - File name of a base image | ||
835 | + backing_fmt=<str> - Image format of the base image | ||
836 | + cluster_size=<size> - qcow2 cluster size | ||
837 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
838 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
839 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
840 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
841 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
842 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
843 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
844 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
845 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
846 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
847 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
848 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
849 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
850 | + size=<size> - Virtual disk size | ||
851 | |||
852 | Testing: convert -o help | 91 | Testing: convert -o help |
853 | Supported options: | 92 | -Supported options: |
854 | -size Virtual disk size | 93 | +Supported raw options: |
855 | + size=<size> - Virtual disk size | 94 | size=<size> - Virtual disk size |
856 | 95 | ||
96 | +The protocol level may support further options. | ||
97 | +Specify the target filename to include those options. | ||
98 | + | ||
857 | Testing: convert -O bochs -o help | 99 | Testing: convert -O bochs -o help |
858 | qemu-img: Format driver 'bochs' does not support image creation | 100 | qemu-img: Format driver 'bochs' does not support image creation |
859 | @@ -XXX,XX +XXX,XX @@ cluster_size: 65536 | 101 | |
860 | |||
861 | Testing: amend -f qcow2 -o help TEST_DIR/t.qcow2 | ||
862 | Creation options for 'qcow2': | ||
863 | -size Virtual disk size | ||
864 | -compat Compatibility level (0.10 or 1.1) | ||
865 | -backing_file File name of a base image | ||
866 | -backing_fmt Image format of the base image | ||
867 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
868 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
869 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
870 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
871 | -encrypt.cipher-mode Name of encryption cipher mode | ||
872 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
873 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
874 | -encrypt.hash-alg Name of encryption hash algorithm | ||
875 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
876 | -cluster_size qcow2 cluster size | ||
877 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
878 | -lazy_refcounts Postpone refcount updates | ||
879 | -refcount_bits Width of a reference count entry in bits | ||
880 | + backing_file=<str> - File name of a base image | ||
881 | + backing_fmt=<str> - Image format of the base image | ||
882 | + cluster_size=<size> - qcow2 cluster size | ||
883 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
884 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
885 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
886 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
887 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
888 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
889 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
890 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
891 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
892 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
893 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
894 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
895 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
896 | + size=<size> - Virtual disk size | ||
897 | |||
898 | Note that not all of these options may be amendable. | ||
899 | |||
900 | Testing: amend -f qcow2 -o ? TEST_DIR/t.qcow2 | ||
901 | Creation options for 'qcow2': | ||
902 | -size Virtual disk size | ||
903 | -compat Compatibility level (0.10 or 1.1) | ||
904 | -backing_file File name of a base image | ||
905 | -backing_fmt Image format of the base image | ||
906 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
907 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
908 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
909 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
910 | -encrypt.cipher-mode Name of encryption cipher mode | ||
911 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
912 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
913 | -encrypt.hash-alg Name of encryption hash algorithm | ||
914 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
915 | -cluster_size qcow2 cluster size | ||
916 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
917 | -lazy_refcounts Postpone refcount updates | ||
918 | -refcount_bits Width of a reference count entry in bits | ||
919 | + backing_file=<str> - File name of a base image | ||
920 | + backing_fmt=<str> - Image format of the base image | ||
921 | + cluster_size=<size> - qcow2 cluster size | ||
922 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
923 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
924 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
925 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
926 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
927 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
928 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
929 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
930 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
931 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
932 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
933 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
934 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
935 | + size=<size> - Virtual disk size | ||
936 | |||
937 | Note that not all of these options may be amendable. | ||
938 | |||
939 | Testing: amend -f qcow2 -o cluster_size=4k,help TEST_DIR/t.qcow2 | ||
940 | Creation options for 'qcow2': | ||
941 | -size Virtual disk size | ||
942 | -compat Compatibility level (0.10 or 1.1) | ||
943 | -backing_file File name of a base image | ||
944 | -backing_fmt Image format of the base image | ||
945 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
946 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
947 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
948 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
949 | -encrypt.cipher-mode Name of encryption cipher mode | ||
950 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
951 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
952 | -encrypt.hash-alg Name of encryption hash algorithm | ||
953 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
954 | -cluster_size qcow2 cluster size | ||
955 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
956 | -lazy_refcounts Postpone refcount updates | ||
957 | -refcount_bits Width of a reference count entry in bits | ||
958 | + backing_file=<str> - File name of a base image | ||
959 | + backing_fmt=<str> - Image format of the base image | ||
960 | + cluster_size=<size> - qcow2 cluster size | ||
961 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
962 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
963 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
964 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
965 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
966 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
967 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
968 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
969 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
970 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
971 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
972 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
973 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
974 | + size=<size> - Virtual disk size | ||
975 | |||
976 | Note that not all of these options may be amendable. | ||
977 | |||
978 | Testing: amend -f qcow2 -o cluster_size=4k,? TEST_DIR/t.qcow2 | ||
979 | Creation options for 'qcow2': | ||
980 | -size Virtual disk size | ||
981 | -compat Compatibility level (0.10 or 1.1) | ||
982 | -backing_file File name of a base image | ||
983 | -backing_fmt Image format of the base image | ||
984 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
985 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
986 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
987 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
988 | -encrypt.cipher-mode Name of encryption cipher mode | ||
989 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
990 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
991 | -encrypt.hash-alg Name of encryption hash algorithm | ||
992 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
993 | -cluster_size qcow2 cluster size | ||
994 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
995 | -lazy_refcounts Postpone refcount updates | ||
996 | -refcount_bits Width of a reference count entry in bits | ||
997 | + backing_file=<str> - File name of a base image | ||
998 | + backing_fmt=<str> - Image format of the base image | ||
999 | + cluster_size=<size> - qcow2 cluster size | ||
1000 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
1001 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1002 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
1003 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
1004 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
1005 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
1006 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
1007 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
1008 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
1009 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
1010 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
1011 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
1012 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
1013 | + size=<size> - Virtual disk size | ||
1014 | |||
1015 | Note that not all of these options may be amendable. | ||
1016 | |||
1017 | Testing: amend -f qcow2 -o help,cluster_size=4k TEST_DIR/t.qcow2 | ||
1018 | Creation options for 'qcow2': | ||
1019 | -size Virtual disk size | ||
1020 | -compat Compatibility level (0.10 or 1.1) | ||
1021 | -backing_file File name of a base image | ||
1022 | -backing_fmt Image format of the base image | ||
1023 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
1024 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
1025 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
1026 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
1027 | -encrypt.cipher-mode Name of encryption cipher mode | ||
1028 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
1029 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
1030 | -encrypt.hash-alg Name of encryption hash algorithm | ||
1031 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
1032 | -cluster_size qcow2 cluster size | ||
1033 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
1034 | -lazy_refcounts Postpone refcount updates | ||
1035 | -refcount_bits Width of a reference count entry in bits | ||
1036 | + backing_file=<str> - File name of a base image | ||
1037 | + backing_fmt=<str> - Image format of the base image | ||
1038 | + cluster_size=<size> - qcow2 cluster size | ||
1039 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
1040 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1041 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
1042 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
1043 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
1044 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
1045 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
1046 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
1047 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
1048 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
1049 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
1050 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
1051 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
1052 | + size=<size> - Virtual disk size | ||
1053 | |||
1054 | Note that not all of these options may be amendable. | ||
1055 | |||
1056 | Testing: amend -f qcow2 -o ?,cluster_size=4k TEST_DIR/t.qcow2 | ||
1057 | Creation options for 'qcow2': | ||
1058 | -size Virtual disk size | ||
1059 | -compat Compatibility level (0.10 or 1.1) | ||
1060 | -backing_file File name of a base image | ||
1061 | -backing_fmt Image format of the base image | ||
1062 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
1063 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
1064 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
1065 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
1066 | -encrypt.cipher-mode Name of encryption cipher mode | ||
1067 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
1068 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
1069 | -encrypt.hash-alg Name of encryption hash algorithm | ||
1070 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
1071 | -cluster_size qcow2 cluster size | ||
1072 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
1073 | -lazy_refcounts Postpone refcount updates | ||
1074 | -refcount_bits Width of a reference count entry in bits | ||
1075 | + backing_file=<str> - File name of a base image | ||
1076 | + backing_fmt=<str> - Image format of the base image | ||
1077 | + cluster_size=<size> - qcow2 cluster size | ||
1078 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
1079 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1080 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
1081 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
1082 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
1083 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
1084 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
1085 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
1086 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
1087 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
1088 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
1089 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
1090 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
1091 | + size=<size> - Virtual disk size | ||
1092 | |||
1093 | Note that not all of these options may be amendable. | ||
1094 | |||
1095 | Testing: amend -f qcow2 -o cluster_size=4k -o help TEST_DIR/t.qcow2 | ||
1096 | Creation options for 'qcow2': | ||
1097 | -size Virtual disk size | ||
1098 | -compat Compatibility level (0.10 or 1.1) | ||
1099 | -backing_file File name of a base image | ||
1100 | -backing_fmt Image format of the base image | ||
1101 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
1102 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
1103 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
1104 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
1105 | -encrypt.cipher-mode Name of encryption cipher mode | ||
1106 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
1107 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
1108 | -encrypt.hash-alg Name of encryption hash algorithm | ||
1109 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
1110 | -cluster_size qcow2 cluster size | ||
1111 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
1112 | -lazy_refcounts Postpone refcount updates | ||
1113 | -refcount_bits Width of a reference count entry in bits | ||
1114 | + backing_file=<str> - File name of a base image | ||
1115 | + backing_fmt=<str> - Image format of the base image | ||
1116 | + cluster_size=<size> - qcow2 cluster size | ||
1117 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
1118 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1119 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
1120 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
1121 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
1122 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
1123 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
1124 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
1125 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
1126 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
1127 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
1128 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
1129 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
1130 | + size=<size> - Virtual disk size | ||
1131 | |||
1132 | Note that not all of these options may be amendable. | ||
1133 | |||
1134 | Testing: amend -f qcow2 -o cluster_size=4k -o ? TEST_DIR/t.qcow2 | ||
1135 | Creation options for 'qcow2': | ||
1136 | -size Virtual disk size | ||
1137 | -compat Compatibility level (0.10 or 1.1) | ||
1138 | -backing_file File name of a base image | ||
1139 | -backing_fmt Image format of the base image | ||
1140 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
1141 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
1142 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
1143 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
1144 | -encrypt.cipher-mode Name of encryption cipher mode | ||
1145 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
1146 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
1147 | -encrypt.hash-alg Name of encryption hash algorithm | ||
1148 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
1149 | -cluster_size qcow2 cluster size | ||
1150 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
1151 | -lazy_refcounts Postpone refcount updates | ||
1152 | -refcount_bits Width of a reference count entry in bits | ||
1153 | + backing_file=<str> - File name of a base image | ||
1154 | + backing_fmt=<str> - Image format of the base image | ||
1155 | + cluster_size=<size> - qcow2 cluster size | ||
1156 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
1157 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1158 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
1159 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
1160 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
1161 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
1162 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
1163 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
1164 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
1165 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
1166 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
1167 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
1168 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
1169 | + size=<size> - Virtual disk size | ||
1170 | |||
1171 | Note that not all of these options may be amendable. | ||
1172 | |||
1173 | @@ -XXX,XX +XXX,XX @@ qemu-img: Invalid option list: ,, | ||
1174 | |||
1175 | Testing: amend -f qcow2 -o help | ||
1176 | Creation options for 'qcow2': | ||
1177 | -size Virtual disk size | ||
1178 | -compat Compatibility level (0.10 or 1.1) | ||
1179 | -backing_file File name of a base image | ||
1180 | -backing_fmt Image format of the base image | ||
1181 | -encryption Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
1182 | -encrypt.format Encrypt the image, format choices: 'aes', 'luks' | ||
1183 | -encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase | ||
1184 | -encrypt.cipher-alg Name of encryption cipher algorithm | ||
1185 | -encrypt.cipher-mode Name of encryption cipher mode | ||
1186 | -encrypt.ivgen-alg Name of IV generator algorithm | ||
1187 | -encrypt.ivgen-hash-alg Name of IV generator hash algorithm | ||
1188 | -encrypt.hash-alg Name of encryption hash algorithm | ||
1189 | -encrypt.iter-time Time to spend in PBKDF in milliseconds | ||
1190 | -cluster_size qcow2 cluster size | ||
1191 | -preallocation Preallocation mode (allowed values: off, metadata, falloc, full) | ||
1192 | -lazy_refcounts Postpone refcount updates | ||
1193 | -refcount_bits Width of a reference count entry in bits | ||
1194 | + backing_file=<str> - File name of a base image | ||
1195 | + backing_fmt=<str> - Image format of the base image | ||
1196 | + cluster_size=<size> - qcow2 cluster size | ||
1197 | + compat=<str> - Compatibility level (0.10 or 1.1) | ||
1198 | + encrypt.cipher-alg=<str> - Name of encryption cipher algorithm | ||
1199 | + encrypt.cipher-mode=<str> - Name of encryption cipher mode | ||
1200 | + encrypt.format=<str> - Encrypt the image, format choices: 'aes', 'luks' | ||
1201 | + encrypt.hash-alg=<str> - Name of encryption hash algorithm | ||
1202 | + encrypt.iter-time=<num> - Time to spend in PBKDF in milliseconds | ||
1203 | + encrypt.ivgen-alg=<str> - Name of IV generator algorithm | ||
1204 | + encrypt.ivgen-hash-alg=<str> - Name of IV generator hash algorithm | ||
1205 | + encrypt.key-secret=<str> - ID of secret providing qcow AES key or LUKS passphrase | ||
1206 | + encryption=<bool (on/off)> - Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes) | ||
1207 | + lazy_refcounts=<bool (on/off)> - Postpone refcount updates | ||
1208 | + preallocation=<str> - Preallocation mode (allowed values: off, metadata, falloc, full) | ||
1209 | + refcount_bits=<num> - Width of a reference count entry in bits | ||
1210 | + size=<size> - Virtual disk size | ||
1211 | |||
1212 | Note that not all of these options may be amendable. | ||
1213 | |||
1214 | Testing: convert -o help | ||
1215 | Supported options: | ||
1216 | -size Virtual disk size | ||
1217 | + size=<size> - Virtual disk size | ||
1218 | |||
1219 | Testing: amend -f bochs -o help | ||
1220 | qemu-img: Format driver 'bochs' does not support option amendment | ||
1221 | -- | 102 | -- |
1222 | 2.19.1 | 103 | 2.20.1 |
1223 | 104 | ||
1224 | 105 | diff view generated by jsdifflib |
1 | If read-only=off, but auto-read-only=on is given, open the volume | 1 | make_completely_empty() is an optimisated path for bdrv_make_empty() |
---|---|---|---|
2 | read-write if we have the permissions, but instead of erroring out for | 2 | where completely new metadata is created inside the image file instead |
3 | read-only volumes, just degrade to read-only. | 3 | of going through all clusters and discarding them. For an external data |
4 | file, however, we actually need to do discard operations on the data | ||
5 | file; just overwriting the qcow2 file doesn't get rid of the data. | ||
4 | 6 | ||
7 | The necessary slow path with an explicit discard operation already | ||
8 | exists for other cases. Use it for external data files, too. | ||
9 | |||
10 | Cc: qemu-stable@nongnu.org | ||
5 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
6 | Reviewed-by: Eric Blake <eblake@redhat.com> | 12 | Reviewed-by: Eric Blake <eblake@redhat.com> |
7 | --- | 13 | --- |
8 | block/iscsi.c | 8 +++++--- | 14 | block/qcow2.c | 7 +++++-- |
9 | 1 file changed, 5 insertions(+), 3 deletions(-) | 15 | 1 file changed, 5 insertions(+), 2 deletions(-) |
10 | 16 | ||
11 | diff --git a/block/iscsi.c b/block/iscsi.c | 17 | diff --git a/block/qcow2.c b/block/qcow2.c |
12 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/block/iscsi.c | 19 | --- a/block/qcow2.c |
14 | +++ b/block/iscsi.c | 20 | +++ b/block/qcow2.c |
15 | @@ -XXX,XX +XXX,XX @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, | 21 | @@ -XXX,XX +XXX,XX @@ static int qcow2_make_empty(BlockDriverState *bs) |
16 | /* Check the write protect flag of the LUN if we want to write */ | 22 | |
17 | if (iscsilun->type == TYPE_DISK && (flags & BDRV_O_RDWR) && | 23 | if (s->qcow_version >= 3 && !s->snapshots && !s->nb_bitmaps && |
18 | iscsilun->write_protected) { | 24 | 3 + l1_clusters <= s->refcount_block_size && |
19 | - error_setg(errp, "Cannot open a write protected LUN as read-write"); | 25 | - s->crypt_method_header != QCOW_CRYPT_LUKS) { |
20 | - ret = -EACCES; | 26 | + s->crypt_method_header != QCOW_CRYPT_LUKS && |
21 | - goto out; | 27 | + !has_data_file(bs)) { |
22 | + ret = bdrv_apply_auto_read_only(bs, "LUN is write protected", errp); | 28 | /* The following function only works for qcow2 v3 images (it |
23 | + if (ret < 0) { | 29 | * requires the dirty flag) and only as long as there are no |
24 | + goto out; | 30 | * features that reserve extra clusters (such as snapshots, |
25 | + } | 31 | * LUKS header, or persistent bitmaps), because it completely |
26 | + flags &= ~BDRV_O_RDWR; | 32 | * empties the image. Furthermore, the L1 table and three |
33 | * additional clusters (image header, refcount table, one | ||
34 | - * refcount block) have to fit inside one refcount block. */ | ||
35 | + * refcount block) have to fit inside one refcount block. It | ||
36 | + * only resets the image file, i.e. does not work with an | ||
37 | + * external data file. */ | ||
38 | return make_completely_empty(bs); | ||
27 | } | 39 | } |
28 | 40 | ||
29 | iscsi_readcapacity_sync(iscsilun, &local_err); | ||
30 | -- | 41 | -- |
31 | 2.19.1 | 42 | 2.20.1 |
32 | 43 | ||
33 | 44 | diff view generated by jsdifflib |
1 | From: Alberto Garcia <berto@igalia.com> | 1 | From: Alberto Garcia <berto@igalia.com> |
---|---|---|---|
2 | |||
3 | This patch fixes a few things in the way error codes are handled in | ||
4 | the qcow2 compression code: | ||
5 | |||
6 | a) qcow2_co_pwritev_compressed() expects qcow2_co_compress() to only | ||
7 | return -1 or -2 on failure, but this is not correct. Since the | ||
8 | change from qcow2_compress() to qcow2_co_compress() in commit | ||
9 | ceb029cd6feccf9f7607 the new code can also return -EINVAL (although | ||
10 | there does not seem to exist any code path that would cause that | ||
11 | error in the current implementation). | ||
12 | |||
13 | b) -1 and -2 are ad-hoc error codes defined in qcow2_compress(). | ||
14 | This patch replaces them with standard constants from errno.h. | ||
15 | |||
16 | c) Both qcow2_compress() and qcow2_co_do_compress() return a negative | ||
17 | value on failure, but qcow2_co_pwritev_compressed() stores the | ||
18 | value in an unsigned data type. | ||
2 | 19 | ||
3 | Signed-off-by: Alberto Garcia <berto@igalia.com> | 20 | Signed-off-by: Alberto Garcia <berto@igalia.com> |
4 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 21 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
5 | --- | 22 | --- |
6 | block.c | 6 +++--- | 23 | block/qcow2.c | 18 +++++++++--------- |
7 | 1 file changed, 3 insertions(+), 3 deletions(-) | 24 | 1 file changed, 9 insertions(+), 9 deletions(-) |
8 | 25 | ||
9 | diff --git a/block.c b/block.c | 26 | diff --git a/block/qcow2.c b/block/qcow2.c |
10 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
11 | --- a/block.c | 28 | --- a/block/qcow2.c |
12 | +++ b/block.c | 29 | +++ b/block/qcow2.c |
13 | @@ -XXX,XX +XXX,XX @@ QemuOptsList bdrv_runtime_opts = { | 30 | @@ -XXX,XX +XXX,XX @@ fail: |
14 | .help = "try to optimize zero writes (off, on, unmap)", | 31 | * @src - source buffer, @src_size bytes |
15 | }, | 32 | * |
16 | { | 33 | * Returns: compressed size on success |
17 | - .name = "discard", | 34 | - * -1 destination buffer is not enough to store compressed data |
18 | + .name = BDRV_OPT_DISCARD, | 35 | - * -2 on any other error |
19 | .type = QEMU_OPT_STRING, | 36 | + * -ENOMEM destination buffer is not enough to store compressed data |
20 | .help = "discard operation (ignore/off, unmap/on)", | 37 | + * -EIO on any other error |
21 | }, | 38 | */ |
22 | @@ -XXX,XX +XXX,XX @@ static int bdrv_open_common(BlockDriverState *bs, BlockBackend *file, | 39 | static ssize_t qcow2_compress(void *dest, size_t dest_size, |
40 | const void *src, size_t src_size) | ||
41 | @@ -XXX,XX +XXX,XX @@ static ssize_t qcow2_compress(void *dest, size_t dest_size, | ||
42 | ret = deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, | ||
43 | -12, 9, Z_DEFAULT_STRATEGY); | ||
44 | if (ret != Z_OK) { | ||
45 | - return -2; | ||
46 | + return -EIO; | ||
47 | } | ||
48 | |||
49 | /* strm.next_in is not const in old zlib versions, such as those used on | ||
50 | @@ -XXX,XX +XXX,XX @@ static ssize_t qcow2_compress(void *dest, size_t dest_size, | ||
51 | if (ret == Z_STREAM_END) { | ||
52 | ret = dest_size - strm.avail_out; | ||
53 | } else { | ||
54 | - ret = (ret == Z_OK ? -1 : -2); | ||
55 | + ret = (ret == Z_OK ? -ENOMEM : -EIO); | ||
56 | } | ||
57 | |||
58 | deflateEnd(&strm); | ||
59 | @@ -XXX,XX +XXX,XX @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, | ||
60 | BDRVQcow2State *s = bs->opaque; | ||
61 | QEMUIOVector hd_qiov; | ||
62 | int ret; | ||
63 | - size_t out_len; | ||
64 | + ssize_t out_len; | ||
65 | uint8_t *buf, *out_buf; | ||
66 | uint64_t cluster_offset; | ||
67 | |||
68 | @@ -XXX,XX +XXX,XX @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, | ||
69 | |||
70 | out_len = qcow2_co_compress(bs, out_buf, s->cluster_size - 1, | ||
71 | buf, s->cluster_size); | ||
72 | - if (out_len == -2) { | ||
73 | - ret = -EINVAL; | ||
74 | - goto fail; | ||
75 | - } else if (out_len == -1) { | ||
76 | + if (out_len == -ENOMEM) { | ||
77 | /* could not compress: write normal cluster */ | ||
78 | ret = qcow2_co_pwritev(bs, offset, bytes, qiov, 0); | ||
79 | if (ret < 0) { | ||
80 | goto fail; | ||
23 | } | 81 | } |
82 | goto success; | ||
83 | + } else if (out_len < 0) { | ||
84 | + ret = -EINVAL; | ||
85 | + goto fail; | ||
24 | } | 86 | } |
25 | 87 | ||
26 | - discard = qemu_opt_get(opts, "discard"); | 88 | qemu_co_mutex_lock(&s->lock); |
27 | + discard = qemu_opt_get(opts, BDRV_OPT_DISCARD); | ||
28 | if (discard != NULL) { | ||
29 | if (bdrv_parse_discard_flags(discard, &bs->open_flags) != 0) { | ||
30 | error_setg(errp, "Invalid discard option"); | ||
31 | @@ -XXX,XX +XXX,XX @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue, | ||
32 | |||
33 | update_flags_from_options(&reopen_state->flags, opts); | ||
34 | |||
35 | - discard = qemu_opt_get_del(opts, "discard"); | ||
36 | + discard = qemu_opt_get_del(opts, BDRV_OPT_DISCARD); | ||
37 | if (discard != NULL) { | ||
38 | if (bdrv_parse_discard_flags(discard, &reopen_state->flags) != 0) { | ||
39 | error_setg(errp, "Invalid discard option"); | ||
40 | -- | 89 | -- |
41 | 2.19.1 | 90 | 2.20.1 |
42 | 91 | ||
43 | 92 | diff view generated by jsdifflib |
1 | From: Li Qiang <liq3ea@163.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Li Qiang <liq3ea@163.com> | 3 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
4 | Reviewed-by: Alberto Garcia <berto@igalia.com> | 4 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> |
5 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | ||
5 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
6 | --- | 7 | --- |
7 | include/sysemu/block-backend.h | 6 +++--- | 8 | include/block/block_int.h | 16 ++++++++++++++++ |
8 | block/block-backend.c | 8 ++++---- | 9 | include/sysemu/block-backend.h | 19 +++++++++++++++++++ |
9 | 2 files changed, 7 insertions(+), 7 deletions(-) | 10 | 2 files changed, 35 insertions(+) |
10 | 11 | ||
12 | diff --git a/include/block/block_int.h b/include/block/block_int.h | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/include/block/block_int.h | ||
15 | +++ b/include/block/block_int.h | ||
16 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_pwritev(BdrvChild *child, | ||
17 | int64_t offset, unsigned int bytes, QEMUIOVector *qiov, | ||
18 | BdrvRequestFlags flags); | ||
19 | |||
20 | +static inline int coroutine_fn bdrv_co_pread(BdrvChild *child, | ||
21 | + int64_t offset, unsigned int bytes, void *buf, BdrvRequestFlags flags) | ||
22 | +{ | ||
23 | + QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); | ||
24 | + | ||
25 | + return bdrv_co_preadv(child, offset, bytes, &qiov, flags); | ||
26 | +} | ||
27 | + | ||
28 | +static inline int coroutine_fn bdrv_co_pwrite(BdrvChild *child, | ||
29 | + int64_t offset, unsigned int bytes, void *buf, BdrvRequestFlags flags) | ||
30 | +{ | ||
31 | + QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); | ||
32 | + | ||
33 | + return bdrv_co_pwritev(child, offset, bytes, &qiov, flags); | ||
34 | +} | ||
35 | + | ||
36 | extern unsigned int bdrv_drain_all_count; | ||
37 | void bdrv_apply_subtree_drain(BdrvChild *child, BlockDriverState *new_parent); | ||
38 | void bdrv_unapply_subtree_drain(BdrvChild *child, BlockDriverState *old_parent); | ||
11 | diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h | 39 | diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h |
12 | index XXXXXXX..XXXXXXX 100644 | 40 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/include/sysemu/block-backend.h | 41 | --- a/include/sysemu/block-backend.h |
14 | +++ b/include/sysemu/block-backend.h | 42 | +++ b/include/sysemu/block-backend.h |
15 | @@ -XXX,XX +XXX,XX @@ BlockErrorAction blk_get_error_action(BlockBackend *blk, bool is_read, | 43 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset, |
16 | int error); | 44 | int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset, |
17 | void blk_error_action(BlockBackend *blk, BlockErrorAction action, | 45 | unsigned int bytes, QEMUIOVector *qiov, |
18 | bool is_read, int error); | 46 | BdrvRequestFlags flags); |
19 | -int blk_is_read_only(BlockBackend *blk); | 47 | + |
20 | -int blk_is_sg(BlockBackend *blk); | 48 | +static inline int coroutine_fn blk_co_pread(BlockBackend *blk, int64_t offset, |
21 | -int blk_enable_write_cache(BlockBackend *blk); | 49 | + unsigned int bytes, void *buf, |
22 | +bool blk_is_read_only(BlockBackend *blk); | 50 | + BdrvRequestFlags flags) |
23 | +bool blk_is_sg(BlockBackend *blk); | 51 | +{ |
24 | +bool blk_enable_write_cache(BlockBackend *blk); | 52 | + QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); |
25 | void blk_set_enable_write_cache(BlockBackend *blk, bool wce); | 53 | + |
26 | void blk_invalidate_cache(BlockBackend *blk, Error **errp); | 54 | + return blk_co_preadv(blk, offset, bytes, &qiov, flags); |
27 | bool blk_is_inserted(BlockBackend *blk); | 55 | +} |
28 | diff --git a/block/block-backend.c b/block/block-backend.c | 56 | + |
29 | index XXXXXXX..XXXXXXX 100644 | 57 | +static inline int coroutine_fn blk_co_pwrite(BlockBackend *blk, int64_t offset, |
30 | --- a/block/block-backend.c | 58 | + unsigned int bytes, void *buf, |
31 | +++ b/block/block-backend.c | 59 | + BdrvRequestFlags flags) |
32 | @@ -XXX,XX +XXX,XX @@ void blk_error_action(BlockBackend *blk, BlockErrorAction action, | 60 | +{ |
33 | } | 61 | + QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); |
34 | } | 62 | + |
35 | 63 | + return blk_co_pwritev(blk, offset, bytes, &qiov, flags); | |
36 | -int blk_is_read_only(BlockBackend *blk) | 64 | +} |
37 | +bool blk_is_read_only(BlockBackend *blk) | 65 | + |
38 | { | 66 | int blk_pwrite_zeroes(BlockBackend *blk, int64_t offset, |
39 | BlockDriverState *bs = blk_bs(blk); | 67 | int bytes, BdrvRequestFlags flags); |
40 | 68 | BlockAIOCB *blk_aio_pwrite_zeroes(BlockBackend *blk, int64_t offset, | |
41 | @@ -XXX,XX +XXX,XX @@ int blk_is_read_only(BlockBackend *blk) | ||
42 | } | ||
43 | } | ||
44 | |||
45 | -int blk_is_sg(BlockBackend *blk) | ||
46 | +bool blk_is_sg(BlockBackend *blk) | ||
47 | { | ||
48 | BlockDriverState *bs = blk_bs(blk); | ||
49 | |||
50 | if (!bs) { | ||
51 | - return 0; | ||
52 | + return false; | ||
53 | } | ||
54 | |||
55 | return bdrv_is_sg(bs); | ||
56 | } | ||
57 | |||
58 | -int blk_enable_write_cache(BlockBackend *blk) | ||
59 | +bool blk_enable_write_cache(BlockBackend *blk) | ||
60 | { | ||
61 | return blk->enable_write_cache; | ||
62 | } | ||
63 | -- | 69 | -- |
64 | 2.19.1 | 70 | 2.20.1 |
65 | 71 | ||
66 | 72 | diff view generated by jsdifflib |
1 | From: Peter Maydell <peter.maydell@linaro.org> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | Taking the address of a field in a packed struct is a bad idea, because | 3 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
4 | it might not be actually aligned enough for that pointer type (and | 4 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> |
5 | thus cause a crash on dereference on some host architectures). Newer | 5 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> |
6 | versions of clang warn about this. Avoid the bug by not using the | ||
7 | "modify in place" byte swapping functions. | ||
8 | |||
9 | There are a few places where the in-place swap function is | ||
10 | used on something other than a packed struct field; we convert | ||
11 | those anyway, for consistency. | ||
12 | |||
13 | This patch was produced with the following spatch script | ||
14 | (and hand-editing to fold a few resulting overlength lines): | ||
15 | |||
16 | @@ | ||
17 | expression E; | ||
18 | @@ | ||
19 | -be16_to_cpus(&E); | ||
20 | +E = be16_to_cpu(E); | ||
21 | @@ | ||
22 | expression E; | ||
23 | @@ | ||
24 | -be32_to_cpus(&E); | ||
25 | +E = be32_to_cpu(E); | ||
26 | @@ | ||
27 | expression E; | ||
28 | @@ | ||
29 | -be64_to_cpus(&E); | ||
30 | +E = be64_to_cpu(E); | ||
31 | @@ | ||
32 | expression E; | ||
33 | @@ | ||
34 | -cpu_to_be16s(&E); | ||
35 | +E = cpu_to_be16(E); | ||
36 | @@ | ||
37 | expression E; | ||
38 | @@ | ||
39 | -cpu_to_be32s(&E); | ||
40 | +E = cpu_to_be32(E); | ||
41 | @@ | ||
42 | expression E; | ||
43 | @@ | ||
44 | -cpu_to_be64s(&E); | ||
45 | +E = cpu_to_be64(E); | ||
46 | |||
47 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
48 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
49 | Tested-by: John Snow <jsnow@redhat.com> | ||
50 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
51 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
52 | --- | 7 | --- |
53 | block/qcow2.c | 64 +++++++++++++++++++++++++++------------------------ | 8 | block/qcow2.c | 9 ++------- |
54 | 1 file changed, 34 insertions(+), 30 deletions(-) | 9 | 1 file changed, 2 insertions(+), 7 deletions(-) |
55 | 10 | ||
56 | diff --git a/block/qcow2.c b/block/qcow2.c | 11 | diff --git a/block/qcow2.c b/block/qcow2.c |
57 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
58 | --- a/block/qcow2.c | 13 | --- a/block/qcow2.c |
59 | +++ b/block/qcow2.c | 14 | +++ b/block/qcow2.c |
60 | @@ -XXX,XX +XXX,XX @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, | 15 | @@ -XXX,XX +XXX,XX @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, |
61 | "pread fail from offset %" PRIu64, offset); | 16 | uint64_t bytes, QEMUIOVector *qiov) |
62 | return 1; | 17 | { |
63 | } | 18 | BDRVQcow2State *s = bs->opaque; |
64 | - be32_to_cpus(&ext.magic); | 19 | - QEMUIOVector hd_qiov; |
65 | - be32_to_cpus(&ext.len); | 20 | int ret; |
66 | + ext.magic = be32_to_cpu(ext.magic); | 21 | ssize_t out_len; |
67 | + ext.len = be32_to_cpu(ext.len); | 22 | uint8_t *buf, *out_buf; |
68 | offset += sizeof(ext); | 23 | @@ -XXX,XX +XXX,XX @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, |
69 | #ifdef DEBUG_EXT | ||
70 | printf("ext.magic = 0x%x\n", ext.magic); | ||
71 | @@ -XXX,XX +XXX,XX @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, | ||
72 | "Unable to read CRYPTO header extension"); | ||
73 | return ret; | ||
74 | } | ||
75 | - be64_to_cpus(&s->crypto_header.offset); | ||
76 | - be64_to_cpus(&s->crypto_header.length); | ||
77 | + s->crypto_header.offset = be64_to_cpu(s->crypto_header.offset); | ||
78 | + s->crypto_header.length = be64_to_cpu(s->crypto_header.length); | ||
79 | |||
80 | if ((s->crypto_header.offset % s->cluster_size) != 0) { | ||
81 | error_setg(errp, "Encryption header offset '%" PRIu64 "' is " | ||
82 | @@ -XXX,XX +XXX,XX @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, | ||
83 | return -EINVAL; | ||
84 | } | ||
85 | |||
86 | - be32_to_cpus(&bitmaps_ext.nb_bitmaps); | ||
87 | - be64_to_cpus(&bitmaps_ext.bitmap_directory_size); | ||
88 | - be64_to_cpus(&bitmaps_ext.bitmap_directory_offset); | ||
89 | + bitmaps_ext.nb_bitmaps = be32_to_cpu(bitmaps_ext.nb_bitmaps); | ||
90 | + bitmaps_ext.bitmap_directory_size = | ||
91 | + be64_to_cpu(bitmaps_ext.bitmap_directory_size); | ||
92 | + bitmaps_ext.bitmap_directory_offset = | ||
93 | + be64_to_cpu(bitmaps_ext.bitmap_directory_offset); | ||
94 | |||
95 | if (bitmaps_ext.nb_bitmaps > QCOW2_MAX_BITMAPS) { | ||
96 | error_setg(errp, | ||
97 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, | ||
98 | error_setg_errno(errp, -ret, "Could not read qcow2 header"); | ||
99 | goto fail; | 24 | goto fail; |
100 | } | 25 | } |
101 | - be32_to_cpus(&header.magic); | 26 | |
102 | - be32_to_cpus(&header.version); | 27 | - qemu_iovec_init_buf(&hd_qiov, out_buf, out_len); |
103 | - be64_to_cpus(&header.backing_file_offset); | 28 | - |
104 | - be32_to_cpus(&header.backing_file_size); | 29 | BLKDBG_EVENT(s->data_file, BLKDBG_WRITE_COMPRESSED); |
105 | - be64_to_cpus(&header.size); | 30 | - ret = bdrv_co_pwritev(s->data_file, cluster_offset, out_len, &hd_qiov, 0); |
106 | - be32_to_cpus(&header.cluster_bits); | 31 | + ret = bdrv_co_pwrite(s->data_file, cluster_offset, out_len, out_buf, 0); |
107 | - be32_to_cpus(&header.crypt_method); | 32 | if (ret < 0) { |
108 | - be64_to_cpus(&header.l1_table_offset); | 33 | goto fail; |
109 | - be32_to_cpus(&header.l1_size); | ||
110 | - be64_to_cpus(&header.refcount_table_offset); | ||
111 | - be32_to_cpus(&header.refcount_table_clusters); | ||
112 | - be64_to_cpus(&header.snapshots_offset); | ||
113 | - be32_to_cpus(&header.nb_snapshots); | ||
114 | + header.magic = be32_to_cpu(header.magic); | ||
115 | + header.version = be32_to_cpu(header.version); | ||
116 | + header.backing_file_offset = be64_to_cpu(header.backing_file_offset); | ||
117 | + header.backing_file_size = be32_to_cpu(header.backing_file_size); | ||
118 | + header.size = be64_to_cpu(header.size); | ||
119 | + header.cluster_bits = be32_to_cpu(header.cluster_bits); | ||
120 | + header.crypt_method = be32_to_cpu(header.crypt_method); | ||
121 | + header.l1_table_offset = be64_to_cpu(header.l1_table_offset); | ||
122 | + header.l1_size = be32_to_cpu(header.l1_size); | ||
123 | + header.refcount_table_offset = be64_to_cpu(header.refcount_table_offset); | ||
124 | + header.refcount_table_clusters = | ||
125 | + be32_to_cpu(header.refcount_table_clusters); | ||
126 | + header.snapshots_offset = be64_to_cpu(header.snapshots_offset); | ||
127 | + header.nb_snapshots = be32_to_cpu(header.nb_snapshots); | ||
128 | |||
129 | if (header.magic != QCOW_MAGIC) { | ||
130 | error_setg(errp, "Image is not in qcow2 format"); | ||
131 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, | ||
132 | header.refcount_order = 4; | ||
133 | header.header_length = 72; | ||
134 | } else { | ||
135 | - be64_to_cpus(&header.incompatible_features); | ||
136 | - be64_to_cpus(&header.compatible_features); | ||
137 | - be64_to_cpus(&header.autoclear_features); | ||
138 | - be32_to_cpus(&header.refcount_order); | ||
139 | - be32_to_cpus(&header.header_length); | ||
140 | + header.incompatible_features = | ||
141 | + be64_to_cpu(header.incompatible_features); | ||
142 | + header.compatible_features = be64_to_cpu(header.compatible_features); | ||
143 | + header.autoclear_features = be64_to_cpu(header.autoclear_features); | ||
144 | + header.refcount_order = be32_to_cpu(header.refcount_order); | ||
145 | + header.header_length = be32_to_cpu(header.header_length); | ||
146 | |||
147 | if (header.header_length < 104) { | ||
148 | error_setg(errp, "qcow2 header too short"); | ||
149 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, | ||
150 | goto fail; | ||
151 | } | ||
152 | for(i = 0;i < s->l1_size; i++) { | ||
153 | - be64_to_cpus(&s->l1_table[i]); | ||
154 | + s->l1_table[i] = be64_to_cpu(s->l1_table[i]); | ||
155 | } | ||
156 | } | 34 | } |
157 | 35 | @@ -XXX,XX +XXX,XX @@ qcow2_co_preadv_compressed(BlockDriverState *bs, | |
158 | @@ -XXX,XX +XXX,XX @@ int qcow2_update_header(BlockDriverState *bs) | 36 | int ret = 0, csize, nb_csectors; |
159 | 37 | uint64_t coffset; | |
160 | /* Full disk encryption header pointer extension */ | 38 | uint8_t *buf, *out_buf; |
161 | if (s->crypto_header.offset != 0) { | 39 | - QEMUIOVector local_qiov; |
162 | - cpu_to_be64s(&s->crypto_header.offset); | 40 | int offset_in_cluster = offset_into_cluster(s, offset); |
163 | - cpu_to_be64s(&s->crypto_header.length); | 41 | |
164 | + s->crypto_header.offset = cpu_to_be64(s->crypto_header.offset); | 42 | coffset = file_cluster_offset & s->cluster_offset_mask; |
165 | + s->crypto_header.length = cpu_to_be64(s->crypto_header.length); | 43 | @@ -XXX,XX +XXX,XX @@ qcow2_co_preadv_compressed(BlockDriverState *bs, |
166 | ret = header_ext_add(buf, QCOW2_EXT_MAGIC_CRYPTO_HEADER, | 44 | if (!buf) { |
167 | &s->crypto_header, sizeof(s->crypto_header), | 45 | return -ENOMEM; |
168 | buflen); | 46 | } |
169 | - be64_to_cpus(&s->crypto_header.offset); | 47 | - qemu_iovec_init_buf(&local_qiov, buf, csize); |
170 | - be64_to_cpus(&s->crypto_header.length); | 48 | |
171 | + s->crypto_header.offset = be64_to_cpu(s->crypto_header.offset); | 49 | out_buf = qemu_blockalign(bs, s->cluster_size); |
172 | + s->crypto_header.length = be64_to_cpu(s->crypto_header.length); | 50 | |
173 | if (ret < 0) { | 51 | BLKDBG_EVENT(bs->file, BLKDBG_READ_COMPRESSED); |
174 | goto fail; | 52 | - ret = bdrv_co_preadv(bs->file, coffset, csize, &local_qiov, 0); |
175 | } | 53 | + ret = bdrv_co_pread(bs->file, coffset, csize, buf, 0); |
54 | if (ret < 0) { | ||
55 | goto fail; | ||
56 | } | ||
176 | -- | 57 | -- |
177 | 2.19.1 | 58 | 2.20.1 |
178 | 59 | ||
179 | 60 | diff view generated by jsdifflib |
1 | From: Peter Maydell <peter.maydell@linaro.org> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | Taking the address of a field in a packed struct is a bad idea, because | 3 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
4 | it might not be actually aligned enough for that pointer type (and | 4 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> |
5 | thus cause a crash on dereference on some host architectures). Newer | 5 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> |
6 | versions of clang warn about this. Avoid the bug by not using the | ||
7 | "modify in place" byte swapping functions. | ||
8 | |||
9 | There are a few places where the in-place swap function is | ||
10 | used on something other than a packed struct field; we convert | ||
11 | those anyway, for consistency. | ||
12 | |||
13 | This patch was produced with the following spatch script: | ||
14 | |||
15 | @@ | ||
16 | expression E; | ||
17 | @@ | ||
18 | -be16_to_cpus(&E); | ||
19 | +E = be16_to_cpu(E); | ||
20 | @@ | ||
21 | expression E; | ||
22 | @@ | ||
23 | -be32_to_cpus(&E); | ||
24 | +E = be32_to_cpu(E); | ||
25 | @@ | ||
26 | expression E; | ||
27 | @@ | ||
28 | -be64_to_cpus(&E); | ||
29 | +E = be64_to_cpu(E); | ||
30 | @@ | ||
31 | expression E; | ||
32 | @@ | ||
33 | -cpu_to_be16s(&E); | ||
34 | +E = cpu_to_be16(E); | ||
35 | @@ | ||
36 | expression E; | ||
37 | @@ | ||
38 | -cpu_to_be32s(&E); | ||
39 | +E = cpu_to_be32(E); | ||
40 | @@ | ||
41 | expression E; | ||
42 | @@ | ||
43 | -cpu_to_be64s(&E); | ||
44 | +E = cpu_to_be64(E); | ||
45 | |||
46 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
47 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
48 | Tested-by: John Snow <jsnow@redhat.com> | ||
49 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
50 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
51 | --- | 7 | --- |
52 | block/qcow.c | 18 +++++++++--------- | 8 | block/qcow.c | 19 ++++++------------- |
53 | 1 file changed, 9 insertions(+), 9 deletions(-) | 9 | 1 file changed, 6 insertions(+), 13 deletions(-) |
54 | 10 | ||
55 | diff --git a/block/qcow.c b/block/qcow.c | 11 | diff --git a/block/qcow.c b/block/qcow.c |
56 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
57 | --- a/block/qcow.c | 13 | --- a/block/qcow.c |
58 | +++ b/block/qcow.c | 14 | +++ b/block/qcow.c |
59 | @@ -XXX,XX +XXX,XX @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags, | 15 | @@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_preadv(BlockDriverState *bs, uint64_t offset, |
16 | int offset_in_cluster; | ||
17 | int ret = 0, n; | ||
18 | uint64_t cluster_offset; | ||
19 | - QEMUIOVector hd_qiov; | ||
20 | uint8_t *buf; | ||
21 | void *orig_buf; | ||
22 | |||
23 | @@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_preadv(BlockDriverState *bs, uint64_t offset, | ||
24 | if (!cluster_offset) { | ||
25 | if (bs->backing) { | ||
26 | /* read from the base image */ | ||
27 | - qemu_iovec_init_buf(&hd_qiov, buf, n); | ||
28 | qemu_co_mutex_unlock(&s->lock); | ||
29 | /* qcow2 emits this on bs->file instead of bs->backing */ | ||
30 | BLKDBG_EVENT(bs->file, BLKDBG_READ_BACKING_AIO); | ||
31 | - ret = bdrv_co_preadv(bs->backing, offset, n, &hd_qiov, 0); | ||
32 | + ret = bdrv_co_pread(bs->backing, offset, n, buf, 0); | ||
33 | qemu_co_mutex_lock(&s->lock); | ||
34 | if (ret < 0) { | ||
35 | break; | ||
36 | @@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_preadv(BlockDriverState *bs, uint64_t offset, | ||
37 | ret = -EIO; | ||
38 | break; | ||
39 | } | ||
40 | - qemu_iovec_init_buf(&hd_qiov, buf, n); | ||
41 | qemu_co_mutex_unlock(&s->lock); | ||
42 | BLKDBG_EVENT(bs->file, BLKDBG_READ_AIO); | ||
43 | - ret = bdrv_co_preadv(bs->file, cluster_offset + offset_in_cluster, | ||
44 | - n, &hd_qiov, 0); | ||
45 | + ret = bdrv_co_pread(bs->file, cluster_offset + offset_in_cluster, | ||
46 | + n, buf, 0); | ||
47 | qemu_co_mutex_lock(&s->lock); | ||
48 | if (ret < 0) { | ||
49 | break; | ||
50 | @@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_pwritev(BlockDriverState *bs, uint64_t offset, | ||
51 | int offset_in_cluster; | ||
52 | uint64_t cluster_offset; | ||
53 | int ret = 0, n; | ||
54 | - QEMUIOVector hd_qiov; | ||
55 | uint8_t *buf; | ||
56 | void *orig_buf; | ||
57 | |||
58 | @@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_pwritev(BlockDriverState *bs, uint64_t offset, | ||
59 | } | ||
60 | } | ||
61 | |||
62 | - qemu_iovec_init_buf(&hd_qiov, buf, n); | ||
63 | qemu_co_mutex_unlock(&s->lock); | ||
64 | BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO); | ||
65 | - ret = bdrv_co_pwritev(bs->file, cluster_offset + offset_in_cluster, | ||
66 | - n, &hd_qiov, 0); | ||
67 | + ret = bdrv_co_pwrite(bs->file, cluster_offset + offset_in_cluster, | ||
68 | + n, buf, 0); | ||
69 | qemu_co_mutex_lock(&s->lock); | ||
70 | if (ret < 0) { | ||
71 | break; | ||
72 | @@ -XXX,XX +XXX,XX @@ qcow_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, | ||
73 | uint64_t bytes, QEMUIOVector *qiov) | ||
74 | { | ||
75 | BDRVQcowState *s = bs->opaque; | ||
76 | - QEMUIOVector hd_qiov; | ||
77 | z_stream strm; | ||
78 | int ret, out_len; | ||
79 | uint8_t *buf, *out_buf; | ||
80 | @@ -XXX,XX +XXX,XX @@ qcow_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, | ||
81 | } | ||
82 | cluster_offset &= s->cluster_offset_mask; | ||
83 | |||
84 | - qemu_iovec_init_buf(&hd_qiov, out_buf, out_len); | ||
85 | BLKDBG_EVENT(bs->file, BLKDBG_WRITE_COMPRESSED); | ||
86 | - ret = bdrv_co_pwritev(bs->file, cluster_offset, out_len, &hd_qiov, 0); | ||
87 | + ret = bdrv_co_pwrite(bs->file, cluster_offset, out_len, out_buf, 0); | ||
60 | if (ret < 0) { | 88 | if (ret < 0) { |
61 | goto fail; | 89 | goto fail; |
62 | } | 90 | } |
63 | - be32_to_cpus(&header.magic); | ||
64 | - be32_to_cpus(&header.version); | ||
65 | - be64_to_cpus(&header.backing_file_offset); | ||
66 | - be32_to_cpus(&header.backing_file_size); | ||
67 | - be32_to_cpus(&header.mtime); | ||
68 | - be64_to_cpus(&header.size); | ||
69 | - be32_to_cpus(&header.crypt_method); | ||
70 | - be64_to_cpus(&header.l1_table_offset); | ||
71 | + header.magic = be32_to_cpu(header.magic); | ||
72 | + header.version = be32_to_cpu(header.version); | ||
73 | + header.backing_file_offset = be64_to_cpu(header.backing_file_offset); | ||
74 | + header.backing_file_size = be32_to_cpu(header.backing_file_size); | ||
75 | + header.mtime = be32_to_cpu(header.mtime); | ||
76 | + header.size = be64_to_cpu(header.size); | ||
77 | + header.crypt_method = be32_to_cpu(header.crypt_method); | ||
78 | + header.l1_table_offset = be64_to_cpu(header.l1_table_offset); | ||
79 | |||
80 | if (header.magic != QCOW_MAGIC) { | ||
81 | error_setg(errp, "Image not in qcow format"); | ||
82 | @@ -XXX,XX +XXX,XX @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags, | ||
83 | } | ||
84 | |||
85 | for(i = 0;i < s->l1_size; i++) { | ||
86 | - be64_to_cpus(&s->l1_table[i]); | ||
87 | + s->l1_table[i] = be64_to_cpu(s->l1_table[i]); | ||
88 | } | ||
89 | |||
90 | /* alloc L2 cache (max. 64k * 16 * 8 = 8 MB) */ | ||
91 | -- | 91 | -- |
92 | 2.19.1 | 92 | 2.20.1 |
93 | 93 | ||
94 | 94 | diff view generated by jsdifflib |
1 | From: Stefan Weil <sw@weilnetz.de> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | Use %zu instead of %zd for unsigned numbers. | 3 | Move to _co_ versions of io functions qed_read_table() and |
4 | qed_write_table(), as we use qemu_co_mutex_unlock() | ||
5 | anyway. | ||
4 | 6 | ||
5 | This fixes two error messages from the LSTM static code analyzer: | 7 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
6 | 8 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | |
7 | This argument should be of type 'ssize_t' but is of type 'unsigned long' | 9 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> |
8 | |||
9 | Signed-off-by: Stefan Weil <sw@weilnetz.de> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 10 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
12 | --- | 11 | --- |
13 | qemu-io-cmds.c | 4 ++-- | 12 | block/qed-table.c | 12 +++++------- |
14 | 1 file changed, 2 insertions(+), 2 deletions(-) | 13 | block/qed.c | 6 ++---- |
14 | 2 files changed, 7 insertions(+), 11 deletions(-) | ||
15 | 15 | ||
16 | diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c | 16 | diff --git a/block/qed-table.c b/block/qed-table.c |
17 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/qemu-io-cmds.c | 18 | --- a/block/qed-table.c |
19 | +++ b/qemu-io-cmds.c | 19 | +++ b/block/qed-table.c |
20 | @@ -XXX,XX +XXX,XX @@ static int readv_f(BlockBackend *blk, int argc, char **argv) | 20 | @@ -XXX,XX +XXX,XX @@ |
21 | memset(cmp_buf, pattern, qiov.size); | 21 | /* Called with table_lock held. */ |
22 | if (memcmp(buf, cmp_buf, qiov.size)) { | 22 | static int qed_read_table(BDRVQEDState *s, uint64_t offset, QEDTable *table) |
23 | printf("Pattern verification failed at offset %" | 23 | { |
24 | - PRId64 ", %zd bytes\n", offset, qiov.size); | 24 | - QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF( |
25 | + PRId64 ", %zu bytes\n", offset, qiov.size); | 25 | - qiov, table->offsets, s->header.cluster_size * s->header.table_size); |
26 | ret = -EINVAL; | 26 | + unsigned int bytes = s->header.cluster_size * s->header.table_size; |
27 | } | 27 | + |
28 | g_free(cmp_buf); | 28 | int noffsets; |
29 | @@ -XXX,XX +XXX,XX @@ static void aio_read_done(void *opaque, int ret) | 29 | int i, ret; |
30 | memset(cmp_buf, ctx->pattern, ctx->qiov.size); | 30 | |
31 | if (memcmp(ctx->buf, cmp_buf, ctx->qiov.size)) { | 31 | trace_qed_read_table(s, offset, table); |
32 | printf("Pattern verification failed at offset %" | 32 | |
33 | - PRId64 ", %zd bytes\n", ctx->offset, ctx->qiov.size); | 33 | qemu_co_mutex_unlock(&s->table_lock); |
34 | + PRId64 ", %zu bytes\n", ctx->offset, ctx->qiov.size); | 34 | - ret = bdrv_preadv(s->bs->file, offset, &qiov); |
35 | } | 35 | + ret = bdrv_co_pread(s->bs->file, offset, bytes, table->offsets, 0); |
36 | g_free(cmp_buf); | 36 | qemu_co_mutex_lock(&s->table_lock); |
37 | if (ret < 0) { | ||
38 | goto out; | ||
39 | } | ||
40 | |||
41 | /* Byteswap offsets */ | ||
42 | - noffsets = qiov.size / sizeof(uint64_t); | ||
43 | + noffsets = bytes / sizeof(uint64_t); | ||
44 | for (i = 0; i < noffsets; i++) { | ||
45 | table->offsets[i] = le64_to_cpu(table->offsets[i]); | ||
46 | } | ||
47 | @@ -XXX,XX +XXX,XX @@ static int qed_write_table(BDRVQEDState *s, uint64_t offset, QEDTable *table, | ||
48 | unsigned int sector_mask = BDRV_SECTOR_SIZE / sizeof(uint64_t) - 1; | ||
49 | unsigned int start, end, i; | ||
50 | QEDTable *new_table; | ||
51 | - QEMUIOVector qiov; | ||
52 | size_t len_bytes; | ||
53 | int ret; | ||
54 | |||
55 | @@ -XXX,XX +XXX,XX @@ static int qed_write_table(BDRVQEDState *s, uint64_t offset, QEDTable *table, | ||
56 | len_bytes = (end - start) * sizeof(uint64_t); | ||
57 | |||
58 | new_table = qemu_blockalign(s->bs, len_bytes); | ||
59 | - qemu_iovec_init_buf(&qiov, new_table->offsets, len_bytes); | ||
60 | |||
61 | /* Byteswap table */ | ||
62 | for (i = start; i < end; i++) { | ||
63 | @@ -XXX,XX +XXX,XX @@ static int qed_write_table(BDRVQEDState *s, uint64_t offset, QEDTable *table, | ||
64 | offset += start * sizeof(uint64_t); | ||
65 | |||
66 | qemu_co_mutex_unlock(&s->table_lock); | ||
67 | - ret = bdrv_pwritev(s->bs->file, offset, &qiov); | ||
68 | + ret = bdrv_co_pwrite(s->bs->file, offset, len_bytes, new_table->offsets, 0); | ||
69 | qemu_co_mutex_lock(&s->table_lock); | ||
70 | trace_qed_write_table_cb(s, table, flush, ret); | ||
71 | if (ret < 0) { | ||
72 | diff --git a/block/qed.c b/block/qed.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/block/qed.c | ||
75 | +++ b/block/qed.c | ||
76 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qed_write_header(BDRVQEDState *s) | ||
77 | int nsectors = DIV_ROUND_UP(sizeof(QEDHeader), BDRV_SECTOR_SIZE); | ||
78 | size_t len = nsectors * BDRV_SECTOR_SIZE; | ||
79 | uint8_t *buf; | ||
80 | - QEMUIOVector qiov; | ||
81 | int ret; | ||
82 | |||
83 | assert(s->allocating_acb || s->allocating_write_reqs_plugged); | ||
84 | |||
85 | buf = qemu_blockalign(s->bs, len); | ||
86 | - qemu_iovec_init_buf(&qiov, buf, len); | ||
87 | |||
88 | - ret = bdrv_co_preadv(s->bs->file, 0, qiov.size, &qiov, 0); | ||
89 | + ret = bdrv_co_pread(s->bs->file, 0, len, buf, 0); | ||
90 | if (ret < 0) { | ||
91 | goto out; | ||
92 | } | ||
93 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn qed_write_header(BDRVQEDState *s) | ||
94 | /* Update header */ | ||
95 | qed_header_cpu_to_le(&s->header, (QEDHeader *) buf); | ||
96 | |||
97 | - ret = bdrv_co_pwritev(s->bs->file, 0, qiov.size, &qiov, 0); | ||
98 | + ret = bdrv_co_pwrite(s->bs->file, 0, len, buf, 0); | ||
99 | if (ret < 0) { | ||
100 | goto out; | ||
37 | } | 101 | } |
38 | -- | 102 | -- |
39 | 2.19.1 | 103 | 2.20.1 |
40 | 104 | ||
41 | 105 | diff view generated by jsdifflib |
1 | From: Alberto Garcia <berto@igalia.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | The blkverify mode of Quorum can only be enabled if the number of | 3 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
4 | children is exactly two and the value of vote-threshold is also two. | 4 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> |
5 | 5 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | |
6 | If the user tries to enable it but the other settings are incorrect | ||
7 | then QEMU simply prints an error message to stderr and carries on | ||
8 | disabling the blkverify setting. | ||
9 | |||
10 | This patch makes quorum_open() fail and return an error in this case. | ||
11 | |||
12 | Signed-off-by: Alberto Garcia <berto@igalia.com> | ||
13 | Reported-by: Markus Armbruster <armbru@redhat.com> | ||
14 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
15 | --- | 7 | --- |
16 | block/quorum.c | 13 ++++++------- | 8 | block/parallels.c | 14 ++++++-------- |
17 | 1 file changed, 6 insertions(+), 7 deletions(-) | 9 | 1 file changed, 6 insertions(+), 8 deletions(-) |
18 | 10 | ||
19 | diff --git a/block/quorum.c b/block/quorum.c | 11 | diff --git a/block/parallels.c b/block/parallels.c |
20 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/block/quorum.c | 13 | --- a/block/parallels.c |
22 | +++ b/block/quorum.c | 14 | +++ b/block/parallels.c |
23 | @@ -XXX,XX +XXX,XX @@ static int quorum_open(BlockDriverState *bs, QDict *options, int flags, | 15 | @@ -XXX,XX +XXX,XX @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num, |
24 | s->read_pattern = ret; | 16 | if (bs->backing) { |
25 | 17 | int64_t nb_cow_sectors = to_allocate * s->tracks; | |
26 | if (s->read_pattern == QUORUM_READ_PATTERN_QUORUM) { | 18 | int64_t nb_cow_bytes = nb_cow_sectors << BDRV_SECTOR_BITS; |
27 | - /* is the driver in blkverify mode */ | 19 | - QEMUIOVector qiov = |
28 | - if (qemu_opt_get_bool(opts, QUORUM_OPT_BLKVERIFY, false) && | 20 | - QEMU_IOVEC_INIT_BUF(qiov, qemu_blockalign(bs, nb_cow_bytes), |
29 | - s->num_children == 2 && s->threshold == 2) { | 21 | - nb_cow_bytes); |
30 | - s->is_blkverify = true; | 22 | + void *buf = qemu_blockalign(bs, nb_cow_bytes); |
31 | - } else if (qemu_opt_get_bool(opts, QUORUM_OPT_BLKVERIFY, false)) { | 23 | |
32 | - fprintf(stderr, "blkverify mode is set by setting blkverify=on " | 24 | - ret = bdrv_co_preadv(bs->backing, idx * s->tracks * BDRV_SECTOR_SIZE, |
33 | - "and using two files with vote_threshold=2\n"); | 25 | - nb_cow_bytes, &qiov, 0); |
34 | + s->is_blkverify = qemu_opt_get_bool(opts, QUORUM_OPT_BLKVERIFY, false); | 26 | + ret = bdrv_co_pread(bs->backing, idx * s->tracks * BDRV_SECTOR_SIZE, |
35 | + if (s->is_blkverify && (s->num_children != 2 || s->threshold != 2)) { | 27 | + nb_cow_bytes, buf, 0); |
36 | + error_setg(&local_err, "blkverify=on can only be set if there are " | 28 | if (ret < 0) { |
37 | + "exactly two files and vote-threshold is 2"); | 29 | - qemu_vfree(qemu_iovec_buf(&qiov)); |
38 | + ret = -EINVAL; | 30 | + qemu_vfree(buf); |
39 | + goto exit; | 31 | return ret; |
40 | } | 32 | } |
41 | 33 | ||
42 | s->rewrite_corrupted = qemu_opt_get_bool(opts, QUORUM_OPT_REWRITE, | 34 | ret = bdrv_co_pwritev(bs->file, s->data_end * BDRV_SECTOR_SIZE, |
35 | - nb_cow_bytes, &qiov, 0); | ||
36 | - qemu_vfree(qemu_iovec_buf(&qiov)); | ||
37 | + nb_cow_bytes, buf, 0); | ||
38 | + qemu_vfree(buf); | ||
39 | if (ret < 0) { | ||
40 | return ret; | ||
41 | } | ||
43 | -- | 42 | -- |
44 | 2.19.1 | 43 | 2.20.1 |
45 | 44 | ||
46 | 45 | diff view generated by jsdifflib |
1 | From: Leonid Bloch <lbloch@janustech.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | The lookup table for power-of-two sizes was added in commit 540b8492618eb | 3 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
4 | for the purpose of having convenient shortcuts for these sizes in cases | 4 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> |
5 | when the literal number has to be present at compile time, and | 5 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> |
6 | expressions as '(1 * KiB)' can not be used. One such case is the | ||
7 | stringification of sizes. Beyond that, it is convenient to use these | ||
8 | shortcuts for all power-of-two sizes, even if they don't have to be | ||
9 | literal numbers. | ||
10 | |||
11 | Despite its convenience, this table introduced 55 lines of "dumb" code, | ||
12 | the purpose and origin of which are obscure without reading the message | ||
13 | of the commit which introduced it. This patch fixes that by adding a | ||
14 | comment to the code itself with a brief explanation for the reasoning | ||
15 | behind this table. This comment includes the short AWK script that | ||
16 | generated the table, so that anyone who's interested could make sure | ||
17 | that the values in it are correct (otherwise these values look as if | ||
18 | they were typed manually). | ||
19 | |||
20 | Signed-off-by: Leonid Bloch <lbloch@janustech.com> | ||
21 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
22 | --- | 7 | --- |
23 | include/qemu/units.h | 18 ++++++++++++++++++ | 8 | block/backup.c | 14 ++++++-------- |
24 | 1 file changed, 18 insertions(+) | 9 | 1 file changed, 6 insertions(+), 8 deletions(-) |
25 | 10 | ||
26 | diff --git a/include/qemu/units.h b/include/qemu/units.h | 11 | diff --git a/block/backup.c b/block/backup.c |
27 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
28 | --- a/include/qemu/units.h | 13 | --- a/block/backup.c |
29 | +++ b/include/qemu/units.h | 14 | +++ b/block/backup.c |
30 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job, |
31 | #define PiB (INT64_C(1) << 50) | 16 | void **bounce_buffer) |
32 | #define EiB (INT64_C(1) << 60) | 17 | { |
33 | 18 | int ret; | |
34 | +/* | 19 | - QEMUIOVector qiov; |
35 | + * The following lookup table is intended to be used when a literal string of | 20 | BlockBackend *blk = job->common.blk; |
36 | + * the number of bytes is required (for example if it needs to be stringified). | 21 | int nbytes; |
37 | + * It can also be used for generic shortcuts of power-of-two sizes. | 22 | int read_flags = is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0; |
38 | + * This table is generated using the AWK script below: | 23 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job, |
39 | + * | 24 | if (!*bounce_buffer) { |
40 | + * BEGIN { | 25 | *bounce_buffer = blk_blockalign(blk, job->cluster_size); |
41 | + * suffix="KMGTPE"; | 26 | } |
42 | + * for(i=10; i<64; i++) { | 27 | - qemu_iovec_init_buf(&qiov, *bounce_buffer, nbytes); |
43 | + * val=2**i; | 28 | |
44 | + * s=substr(suffix, int(i/10), 1); | 29 | - ret = blk_co_preadv(blk, start, qiov.size, &qiov, read_flags); |
45 | + * n=2**(i%10); | 30 | + ret = blk_co_pread(blk, start, nbytes, *bounce_buffer, read_flags); |
46 | + * pad=21-int(log(n)/log(10)); | 31 | if (ret < 0) { |
47 | + * printf("#define S_%d%siB %*d\n", n, s, pad, val); | 32 | trace_backup_do_cow_read_fail(job, start, ret); |
48 | + * } | 33 | if (error_is_read) { |
49 | + * } | 34 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job, |
50 | + */ | 35 | goto fail; |
51 | + | 36 | } |
52 | #define S_1KiB 1024 | 37 | |
53 | #define S_2KiB 2048 | 38 | - if (qemu_iovec_is_zero(&qiov)) { |
54 | #define S_4KiB 4096 | 39 | + if (buffer_is_zero(*bounce_buffer, nbytes)) { |
40 | ret = blk_co_pwrite_zeroes(job->target, start, | ||
41 | - qiov.size, write_flags | BDRV_REQ_MAY_UNMAP); | ||
42 | + nbytes, write_flags | BDRV_REQ_MAY_UNMAP); | ||
43 | } else { | ||
44 | - ret = blk_co_pwritev(job->target, start, | ||
45 | - qiov.size, &qiov, write_flags | | ||
46 | - (job->compress ? BDRV_REQ_WRITE_COMPRESSED : 0)); | ||
47 | + ret = blk_co_pwrite(job->target, start, | ||
48 | + nbytes, *bounce_buffer, write_flags | | ||
49 | + (job->compress ? BDRV_REQ_WRITE_COMPRESSED : 0)); | ||
50 | } | ||
51 | if (ret < 0) { | ||
52 | trace_backup_do_cow_write_fail(job, start, ret); | ||
55 | -- | 53 | -- |
56 | 2.19.1 | 54 | 2.20.1 |
57 | 55 | ||
58 | 56 | diff view generated by jsdifflib |
1 | Some block drivers have traditionally changed their node to read-only | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | mode without asking the user. This behaviour has been marked deprecated | ||
3 | since 2.11, expecting users to provide an explicit read-only=on option. | ||
4 | 2 | ||
5 | Now that we have auto-read-only=on, enable these drivers to make use of | 3 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
6 | the option. | 4 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> |
5 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | ||
6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
7 | --- | ||
8 | block/commit.c | 5 ++--- | ||
9 | 1 file changed, 2 insertions(+), 3 deletions(-) | ||
7 | 10 | ||
8 | This is the only use of bdrv_set_read_only(), so we can make it a bit | 11 | diff --git a/block/commit.c b/block/commit.c |
9 | more specific and turn it into a bdrv_apply_auto_read_only() that is | ||
10 | more convenient for drivers to use. | ||
11 | |||
12 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
13 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
14 | --- | ||
15 | include/block/block.h | 3 ++- | ||
16 | block.c | 42 +++++++++++++++++++++++++++--------------- | ||
17 | block/bochs.c | 17 ++++++----------- | ||
18 | block/cloop.c | 16 +++++----------- | ||
19 | block/dmg.c | 16 +++++----------- | ||
20 | block/rbd.c | 15 ++++----------- | ||
21 | block/vvfat.c | 10 ++-------- | ||
22 | 7 files changed, 51 insertions(+), 68 deletions(-) | ||
23 | |||
24 | diff --git a/include/block/block.h b/include/block/block.h | ||
25 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/include/block/block.h | 13 | --- a/block/commit.c |
27 | +++ b/include/block/block.h | 14 | +++ b/block/commit.c |
28 | @@ -XXX,XX +XXX,XX @@ int bdrv_is_allocated_above(BlockDriverState *top, BlockDriverState *base, | 15 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn commit_populate(BlockBackend *bs, BlockBackend *base, |
29 | bool bdrv_is_read_only(BlockDriverState *bs); | 16 | void *buf) |
30 | int bdrv_can_set_read_only(BlockDriverState *bs, bool read_only, | ||
31 | bool ignore_allow_rdw, Error **errp); | ||
32 | -int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp); | ||
33 | +int bdrv_apply_auto_read_only(BlockDriverState *bs, const char *errmsg, | ||
34 | + Error **errp); | ||
35 | bool bdrv_is_writable(BlockDriverState *bs); | ||
36 | bool bdrv_is_sg(BlockDriverState *bs); | ||
37 | bool bdrv_is_inserted(BlockDriverState *bs); | ||
38 | diff --git a/block.c b/block.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/block.c | ||
41 | +++ b/block.c | ||
42 | @@ -XXX,XX +XXX,XX @@ int bdrv_can_set_read_only(BlockDriverState *bs, bool read_only, | ||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | -/* TODO Remove (deprecated since 2.11) | ||
47 | - * Block drivers are not supposed to automatically change bs->read_only. | ||
48 | - * Instead, they should just check whether they can provide what the user | ||
49 | - * explicitly requested and error out if read-write is requested, but they can | ||
50 | - * only provide read-only access. */ | ||
51 | -int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp) | ||
52 | +/* | ||
53 | + * Called by a driver that can only provide a read-only image. | ||
54 | + * | ||
55 | + * Returns 0 if the node is already read-only or it could switch the node to | ||
56 | + * read-only because BDRV_O_AUTO_RDONLY is set. | ||
57 | + * | ||
58 | + * Returns -EACCES if the node is read-write and BDRV_O_AUTO_RDONLY is not set | ||
59 | + * or bdrv_can_set_read_only() forbids making the node read-only. If @errmsg | ||
60 | + * is not NULL, it is used as the error message for the Error object. | ||
61 | + */ | ||
62 | +int bdrv_apply_auto_read_only(BlockDriverState *bs, const char *errmsg, | ||
63 | + Error **errp) | ||
64 | { | 17 | { |
65 | int ret = 0; | 18 | int ret = 0; |
66 | 19 | - QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); | |
67 | - ret = bdrv_can_set_read_only(bs, read_only, false, errp); | 20 | |
68 | - if (ret < 0) { | 21 | assert(bytes < SIZE_MAX); |
69 | - return ret; | 22 | |
70 | + if (!(bs->open_flags & BDRV_O_RDWR)) { | 23 | - ret = blk_co_preadv(bs, offset, qiov.size, &qiov, 0); |
71 | + return 0; | 24 | + ret = blk_co_pread(bs, offset, bytes, buf, 0); |
72 | + } | ||
73 | + if (!(bs->open_flags & BDRV_O_AUTO_RDONLY)) { | ||
74 | + goto fail; | ||
75 | } | ||
76 | |||
77 | - bs->read_only = read_only; | ||
78 | - | ||
79 | - if (read_only) { | ||
80 | - bs->open_flags &= ~BDRV_O_RDWR; | ||
81 | - } else { | ||
82 | - bs->open_flags |= BDRV_O_RDWR; | ||
83 | + ret = bdrv_can_set_read_only(bs, true, false, NULL); | ||
84 | + if (ret < 0) { | ||
85 | + goto fail; | ||
86 | } | ||
87 | |||
88 | + bs->read_only = true; | ||
89 | + bs->open_flags &= ~BDRV_O_RDWR; | ||
90 | + | ||
91 | return 0; | ||
92 | + | ||
93 | +fail: | ||
94 | + error_setg(errp, "%s", errmsg ?: "Image is read-only"); | ||
95 | + return -EACCES; | ||
96 | } | ||
97 | |||
98 | void bdrv_get_full_backing_filename_from_filename(const char *backed, | ||
99 | diff --git a/block/bochs.c b/block/bochs.c | ||
100 | index XXXXXXX..XXXXXXX 100644 | ||
101 | --- a/block/bochs.c | ||
102 | +++ b/block/bochs.c | ||
103 | @@ -XXX,XX +XXX,XX @@ static int bochs_open(BlockDriverState *bs, QDict *options, int flags, | ||
104 | struct bochs_header bochs; | ||
105 | int ret; | ||
106 | |||
107 | + /* No write support yet */ | ||
108 | + ret = bdrv_apply_auto_read_only(bs, NULL, errp); | ||
109 | + if (ret < 0) { | ||
110 | + return ret; | ||
111 | + } | ||
112 | + | ||
113 | bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, | ||
114 | false, errp); | ||
115 | if (!bs->file) { | ||
116 | return -EINVAL; | ||
117 | } | ||
118 | |||
119 | - if (!bdrv_is_read_only(bs)) { | ||
120 | - error_report("Opening bochs images without an explicit read-only=on " | ||
121 | - "option is deprecated. Future versions will refuse to " | ||
122 | - "open the image instead of automatically marking the " | ||
123 | - "image read-only."); | ||
124 | - ret = bdrv_set_read_only(bs, true, errp); /* no write support yet */ | ||
125 | - if (ret < 0) { | ||
126 | - return ret; | ||
127 | - } | ||
128 | - } | ||
129 | - | ||
130 | ret = bdrv_pread(bs->file, 0, &bochs, sizeof(bochs)); | ||
131 | if (ret < 0) { | 25 | if (ret < 0) { |
132 | return ret; | 26 | return ret; |
133 | diff --git a/block/cloop.c b/block/cloop.c | ||
134 | index XXXXXXX..XXXXXXX 100644 | ||
135 | --- a/block/cloop.c | ||
136 | +++ b/block/cloop.c | ||
137 | @@ -XXX,XX +XXX,XX @@ static int cloop_open(BlockDriverState *bs, QDict *options, int flags, | ||
138 | uint32_t offsets_size, max_compressed_block_size = 1, i; | ||
139 | int ret; | ||
140 | |||
141 | + ret = bdrv_apply_auto_read_only(bs, NULL, errp); | ||
142 | + if (ret < 0) { | ||
143 | + return ret; | ||
144 | + } | ||
145 | + | ||
146 | bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, | ||
147 | false, errp); | ||
148 | if (!bs->file) { | ||
149 | return -EINVAL; | ||
150 | } | 27 | } |
151 | 28 | ||
152 | - if (!bdrv_is_read_only(bs)) { | 29 | - ret = blk_co_pwritev(base, offset, qiov.size, &qiov, 0); |
153 | - error_report("Opening cloop images without an explicit read-only=on " | 30 | + ret = blk_co_pwrite(base, offset, bytes, buf, 0); |
154 | - "option is deprecated. Future versions will refuse to " | ||
155 | - "open the image instead of automatically marking the " | ||
156 | - "image read-only."); | ||
157 | - ret = bdrv_set_read_only(bs, true, errp); | ||
158 | - if (ret < 0) { | ||
159 | - return ret; | ||
160 | - } | ||
161 | - } | ||
162 | - | ||
163 | /* read header */ | ||
164 | ret = bdrv_pread(bs->file, 128, &s->block_size, 4); | ||
165 | if (ret < 0) { | 31 | if (ret < 0) { |
166 | diff --git a/block/dmg.c b/block/dmg.c | 32 | return ret; |
167 | index XXXXXXX..XXXXXXX 100644 | ||
168 | --- a/block/dmg.c | ||
169 | +++ b/block/dmg.c | ||
170 | @@ -XXX,XX +XXX,XX @@ static int dmg_open(BlockDriverState *bs, QDict *options, int flags, | ||
171 | int64_t offset; | ||
172 | int ret; | ||
173 | |||
174 | + ret = bdrv_apply_auto_read_only(bs, NULL, errp); | ||
175 | + if (ret < 0) { | ||
176 | + return ret; | ||
177 | + } | ||
178 | + | ||
179 | bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, | ||
180 | false, errp); | ||
181 | if (!bs->file) { | ||
182 | return -EINVAL; | ||
183 | } | ||
184 | |||
185 | - if (!bdrv_is_read_only(bs)) { | ||
186 | - error_report("Opening dmg images without an explicit read-only=on " | ||
187 | - "option is deprecated. Future versions will refuse to " | ||
188 | - "open the image instead of automatically marking the " | ||
189 | - "image read-only."); | ||
190 | - ret = bdrv_set_read_only(bs, true, errp); | ||
191 | - if (ret < 0) { | ||
192 | - return ret; | ||
193 | - } | ||
194 | - } | ||
195 | - | ||
196 | block_module_load_one("dmg-bz2"); | ||
197 | |||
198 | s->n_chunks = 0; | ||
199 | diff --git a/block/rbd.c b/block/rbd.c | ||
200 | index XXXXXXX..XXXXXXX 100644 | ||
201 | --- a/block/rbd.c | ||
202 | +++ b/block/rbd.c | ||
203 | @@ -XXX,XX +XXX,XX @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, | ||
204 | /* If we are using an rbd snapshot, we must be r/o, otherwise | ||
205 | * leave as-is */ | ||
206 | if (s->snap != NULL) { | ||
207 | - if (!bdrv_is_read_only(bs)) { | ||
208 | - error_report("Opening rbd snapshots without an explicit " | ||
209 | - "read-only=on option is deprecated. Future versions " | ||
210 | - "will refuse to open the image instead of " | ||
211 | - "automatically marking the image read-only."); | ||
212 | - r = bdrv_set_read_only(bs, true, &local_err); | ||
213 | - if (r < 0) { | ||
214 | - rbd_close(s->image); | ||
215 | - error_propagate(errp, local_err); | ||
216 | - goto failed_open; | ||
217 | - } | ||
218 | + r = bdrv_apply_auto_read_only(bs, "rbd snapshots are read-only", errp); | ||
219 | + if (r < 0) { | ||
220 | + rbd_close(s->image); | ||
221 | + goto failed_open; | ||
222 | } | ||
223 | } | ||
224 | |||
225 | diff --git a/block/vvfat.c b/block/vvfat.c | ||
226 | index XXXXXXX..XXXXXXX 100644 | ||
227 | --- a/block/vvfat.c | ||
228 | +++ b/block/vvfat.c | ||
229 | @@ -XXX,XX +XXX,XX @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, | ||
230 | "Unable to set VVFAT to 'rw' when drive is read-only"); | ||
231 | goto fail; | ||
232 | } | ||
233 | - } else if (!bdrv_is_read_only(bs)) { | ||
234 | - error_report("Opening non-rw vvfat images without an explicit " | ||
235 | - "read-only=on option is deprecated. Future versions " | ||
236 | - "will refuse to open the image instead of " | ||
237 | - "automatically marking the image read-only."); | ||
238 | - /* read only is the default for safety */ | ||
239 | - ret = bdrv_set_read_only(bs, true, &local_err); | ||
240 | + } else { | ||
241 | + ret = bdrv_apply_auto_read_only(bs, NULL, errp); | ||
242 | if (ret < 0) { | ||
243 | - error_propagate(errp, local_err); | ||
244 | goto fail; | ||
245 | } | ||
246 | } | 33 | } |
247 | -- | 34 | -- |
248 | 2.19.1 | 35 | 2.20.1 |
249 | 36 | ||
250 | 37 | diff view generated by jsdifflib |
1 | From: Max Reitz <mreitz@redhat.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | Following the example of qemu_opts_print_help(), indent all entries in | 3 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
4 | the list of character devices. | 4 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> |
5 | 5 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | |
6 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
7 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> | ||
8 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
9 | --- | 7 | --- |
10 | chardev/char.c | 2 +- | 8 | block/stream.c | 4 +--- |
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | 9 | 1 file changed, 1 insertion(+), 3 deletions(-) |
12 | 10 | ||
13 | diff --git a/chardev/char.c b/chardev/char.c | 11 | diff --git a/block/stream.c b/block/stream.c |
14 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/chardev/char.c | 13 | --- a/block/stream.c |
16 | +++ b/chardev/char.c | 14 | +++ b/block/stream.c |
17 | @@ -XXX,XX +XXX,XX @@ help_string_append(const char *name, void *opaque) | 15 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn stream_populate(BlockBackend *blk, |
16 | int64_t offset, uint64_t bytes, | ||
17 | void *buf) | ||
18 | { | 18 | { |
19 | GString *str = opaque; | 19 | - QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); |
20 | 20 | - | |
21 | - g_string_append_printf(str, "\n%s", name); | 21 | assert(bytes < SIZE_MAX); |
22 | + g_string_append_printf(str, "\n %s", name); | 22 | |
23 | /* Copy-on-read the unallocated clusters */ | ||
24 | - return blk_co_preadv(blk, offset, qiov.size, &qiov, BDRV_REQ_COPY_ON_READ); | ||
25 | + return blk_co_pread(blk, offset, bytes, buf, BDRV_REQ_COPY_ON_READ); | ||
23 | } | 26 | } |
24 | 27 | ||
25 | static const char *chardev_alias_translate(const char *name) | 28 | static void stream_abort(Job *job) |
26 | -- | 29 | -- |
27 | 2.19.1 | 30 | 2.20.1 |
28 | 31 | ||
29 | 32 | diff view generated by jsdifflib |
1 | From: Leonid Bloch <lbloch@janustech.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | If an expression is used to define DEFAULT_CLUSTER_SIZE, when compiled, | 3 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
4 | it will be embedded as a literal expression in the binary (as the | 4 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> |
5 | default value) because it is stringified to mark the size of the default | 5 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> |
6 | value. Now this is fixed by using a defined number to define this value. | ||
7 | |||
8 | Signed-off-by: Leonid Bloch <lbloch@janustech.com> | ||
9 | Reviewed-by: Stefan Weil <sw@weilnetz.de> | ||
10 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
11 | --- | 7 | --- |
12 | block/vdi.c | 4 ++-- | 8 | qemu-img.c | 13 ++++--------- |
13 | 1 file changed, 2 insertions(+), 2 deletions(-) | 9 | 1 file changed, 4 insertions(+), 9 deletions(-) |
14 | 10 | ||
15 | diff --git a/block/vdi.c b/block/vdi.c | 11 | diff --git a/qemu-img.c b/qemu-img.c |
16 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/block/vdi.c | 13 | --- a/qemu-img.c |
18 | +++ b/block/vdi.c | 14 | +++ b/qemu-img.c |
19 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn convert_co_read(ImgConvertState *s, int64_t sector_num, |
20 | #define BLOCK_OPT_STATIC "static" | 16 | int nb_sectors, uint8_t *buf) |
21 | 17 | { | |
22 | #define SECTOR_SIZE 512 | 18 | int n, ret; |
23 | -#define DEFAULT_CLUSTER_SIZE (1 * MiB) | 19 | - QEMUIOVector qiov; |
24 | +#define DEFAULT_CLUSTER_SIZE S_1MiB | 20 | |
25 | 21 | assert(nb_sectors <= s->buf_sectors); | |
26 | #if defined(CONFIG_VDI_DEBUG) | 22 | while (nb_sectors > 0) { |
27 | #define VDI_DEBUG 1 | 23 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn convert_co_read(ImgConvertState *s, int64_t sector_num, |
28 | @@ -XXX,XX +XXX,XX @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags, | 24 | bs_sectors = s->src_sectors[src_cur]; |
29 | goto fail; | 25 | |
30 | } else if (header.block_size != DEFAULT_CLUSTER_SIZE) { | 26 | n = MIN(nb_sectors, bs_sectors - (sector_num - src_cur_offset)); |
31 | error_setg(errp, "unsupported VDI image (block size %" PRIu32 | 27 | - qemu_iovec_init_buf(&qiov, buf, n << BDRV_SECTOR_BITS); |
32 | - " is not %" PRIu64 ")", | 28 | |
33 | + " is not %" PRIu32 ")", | 29 | - ret = blk_co_preadv( |
34 | header.block_size, DEFAULT_CLUSTER_SIZE); | 30 | + ret = blk_co_pread( |
35 | ret = -ENOTSUP; | 31 | blk, (sector_num - src_cur_offset) << BDRV_SECTOR_BITS, |
36 | goto fail; | 32 | - n << BDRV_SECTOR_BITS, &qiov, 0); |
33 | + n << BDRV_SECTOR_BITS, buf, 0); | ||
34 | if (ret < 0) { | ||
35 | return ret; | ||
36 | } | ||
37 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn convert_co_write(ImgConvertState *s, int64_t sector_num, | ||
38 | enum ImgConvertBlockStatus status) | ||
39 | { | ||
40 | int ret; | ||
41 | - QEMUIOVector qiov; | ||
42 | |||
43 | while (nb_sectors > 0) { | ||
44 | int n = nb_sectors; | ||
45 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn convert_co_write(ImgConvertState *s, int64_t sector_num, | ||
46 | (s->compressed && | ||
47 | !buffer_is_zero(buf, n * BDRV_SECTOR_SIZE))) | ||
48 | { | ||
49 | - qemu_iovec_init_buf(&qiov, buf, n << BDRV_SECTOR_BITS); | ||
50 | - | ||
51 | - ret = blk_co_pwritev(s->target, sector_num << BDRV_SECTOR_BITS, | ||
52 | - n << BDRV_SECTOR_BITS, &qiov, flags); | ||
53 | + ret = blk_co_pwrite(s->target, sector_num << BDRV_SECTOR_BITS, | ||
54 | + n << BDRV_SECTOR_BITS, buf, flags); | ||
55 | if (ret < 0) { | ||
56 | return ret; | ||
57 | } | ||
37 | -- | 58 | -- |
38 | 2.19.1 | 59 | 2.20.1 |
39 | 60 | ||
40 | 61 | diff view generated by jsdifflib |
1 | From: Alberto Garcia <berto@igalia.com> | 1 | From: Alberto Garcia <berto@igalia.com> |
---|---|---|---|
2 | 2 | ||
3 | The blkverify mode of Quorum only works when the number of children is | 3 | You can reproduce this by passing an invalid filter-node-name (like |
4 | exactly two, so any attempt to add a new one must return an error. | 4 | "1234") to block-commit. In this case the base image is put in |
5 | 5 | read-write mode but is never reset back to read-only. | |
6 | quorum_del_child() on the other hand doesn't need any additional check | ||
7 | because decreasing the number of children would make it go under the | ||
8 | vote threshold. | ||
9 | 6 | ||
10 | Signed-off-by: Alberto Garcia <berto@igalia.com> | 7 | Signed-off-by: Alberto Garcia <berto@igalia.com> |
11 | Reported-by: Kevin Wolf <kwolf@redhat.com> | 8 | Reviewed-by: Max Reitz <mreitz@redhat.com> |
12 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 9 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
13 | --- | 10 | --- |
14 | block/quorum.c | 8 ++++++++ | 11 | block/commit.c | 3 +++ |
15 | 1 file changed, 8 insertions(+) | 12 | 1 file changed, 3 insertions(+) |
16 | 13 | ||
17 | diff --git a/block/quorum.c b/block/quorum.c | 14 | diff --git a/block/commit.c b/block/commit.c |
18 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/block/quorum.c | 16 | --- a/block/commit.c |
20 | +++ b/block/quorum.c | 17 | +++ b/block/commit.c |
21 | @@ -XXX,XX +XXX,XX @@ static void quorum_add_child(BlockDriverState *bs, BlockDriverState *child_bs, | 18 | @@ -XXX,XX +XXX,XX @@ fail: |
22 | char indexstr[32]; | 19 | if (s->top) { |
23 | int ret; | 20 | blk_unref(s->top); |
24 | 21 | } | |
25 | + if (s->is_blkverify) { | 22 | + if (s->base_read_only) { |
26 | + error_setg(errp, "Cannot add a child to a quorum in blkverify mode"); | 23 | + bdrv_reopen_set_read_only(base, true, NULL); |
27 | + return; | ||
28 | + } | 24 | + } |
29 | + | 25 | job_early_fail(&s->common.job); |
30 | assert(s->num_children <= INT_MAX / sizeof(BdrvChild *)); | 26 | /* commit_top_bs has to be replaced after deleting the block job, |
31 | if (s->num_children == INT_MAX / sizeof(BdrvChild *) || | 27 | * otherwise this would fail because of lack of permissions. */ |
32 | s->next_child_index == UINT_MAX) { | ||
33 | @@ -XXX,XX +XXX,XX @@ static void quorum_del_child(BlockDriverState *bs, BdrvChild *child, | ||
34 | return; | ||
35 | } | ||
36 | |||
37 | + /* We know now that num_children > threshold, so blkverify must be false */ | ||
38 | + assert(!s->is_blkverify); | ||
39 | + | ||
40 | bdrv_drained_begin(bs); | ||
41 | |||
42 | /* We can safely remove this child now */ | ||
43 | -- | 28 | -- |
44 | 2.19.1 | 29 | 2.20.1 |
45 | 30 | ||
46 | 31 | diff view generated by jsdifflib |
1 | From: Alberto Garcia <berto@igalia.com> | ||
---|---|---|---|
2 | |||
3 | This tests the fix from the previous patch. | ||
4 | |||
5 | Signed-off-by: Alberto Garcia <berto@igalia.com> | ||
1 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
2 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
3 | --- | 7 | --- |
4 | tests/qemu-iotests/232 | 147 +++++++++++++++++++++++++++++++++++++ | 8 | tests/qemu-iotests/249 | 115 +++++++++++++++++++++++++++++++++++++ |
5 | tests/qemu-iotests/232.out | 59 +++++++++++++++ | 9 | tests/qemu-iotests/249.out | 35 +++++++++++ |
6 | tests/qemu-iotests/group | 1 + | 10 | tests/qemu-iotests/group | 1 + |
7 | 3 files changed, 207 insertions(+) | 11 | 3 files changed, 151 insertions(+) |
8 | create mode 100755 tests/qemu-iotests/232 | 12 | create mode 100755 tests/qemu-iotests/249 |
9 | create mode 100644 tests/qemu-iotests/232.out | 13 | create mode 100644 tests/qemu-iotests/249.out |
10 | 14 | ||
11 | diff --git a/tests/qemu-iotests/232 b/tests/qemu-iotests/232 | 15 | diff --git a/tests/qemu-iotests/249 b/tests/qemu-iotests/249 |
12 | new file mode 100755 | 16 | new file mode 100755 |
13 | index XXXXXXX..XXXXXXX | 17 | index XXXXXXX..XXXXXXX |
14 | --- /dev/null | 18 | --- /dev/null |
15 | +++ b/tests/qemu-iotests/232 | 19 | +++ b/tests/qemu-iotests/249 |
16 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ |
17 | +#!/bin/bash | 21 | +#!/usr/bin/env bash |
18 | +# | 22 | +# |
19 | +# Test for auto-read-only | 23 | +# Test that a backing image is put back in read-only mode after |
24 | +# block-commit (both when it fails and when it succeeds). | ||
20 | +# | 25 | +# |
21 | +# Copyright (C) 2018 Red Hat, Inc. | 26 | +# Copyright (C) 2019 Igalia, S.L. |
22 | +# | 27 | +# |
23 | +# This program is free software; you can redistribute it and/or modify | 28 | +# This program is free software; you can redistribute it and/or modify |
24 | +# it under the terms of the GNU General Public License as published by | 29 | +# it under the terms of the GNU General Public License as published by |
25 | +# the Free Software Foundation; either version 2 of the License, or | 30 | +# the Free Software Foundation; either version 2 of the License, or |
26 | +# (at your option) any later version. | 31 | +# (at your option) any later version. |
... | ... | ||
33 | +# You should have received a copy of the GNU General Public License | 38 | +# You should have received a copy of the GNU General Public License |
34 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. | 39 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
35 | +# | 40 | +# |
36 | + | 41 | + |
37 | +# creator | 42 | +# creator |
38 | +owner=kwolf@redhat.com | 43 | +owner=berto@igalia.com |
39 | + | 44 | + |
40 | +seq=`basename $0` | 45 | +seq="$(basename $0)" |
41 | +echo "QA output created by $seq" | 46 | +echo "QA output created by $seq" |
42 | + | 47 | + |
43 | +here=`pwd` | ||
44 | +status=1 # failure is the default! | 48 | +status=1 # failure is the default! |
45 | + | 49 | + |
46 | +_cleanup() | 50 | +_cleanup() |
47 | +{ | 51 | +{ |
48 | + _cleanup_test_img | 52 | + _cleanup_test_img |
49 | + rm -f $TEST_IMG.snap | 53 | + rm -f "$TEST_IMG.base" |
54 | + rm -f "$TEST_IMG.int" | ||
50 | +} | 55 | +} |
51 | +trap "_cleanup; exit \$status" 0 1 2 3 15 | 56 | +trap "_cleanup; exit \$status" 0 1 2 3 15 |
52 | + | 57 | + |
53 | +# get standard environment, filters and checks | 58 | +# get standard environment, filters and checks |
54 | +. ./common.rc | 59 | +. ./common.rc |
55 | +. ./common.filter | 60 | +. ./common.filter |
61 | +. ./common.qemu | ||
56 | + | 62 | + |
57 | +_supported_fmt generic | 63 | +# Any format implementing BlockDriver.bdrv_change_backing_file |
64 | +_supported_fmt qcow2 qed | ||
58 | +_supported_proto file | 65 | +_supported_proto file |
59 | +_supported_os Linux | 66 | +_supported_os Linux |
60 | + | 67 | + |
61 | +function do_run_qemu() | 68 | +IMG_SIZE=1M |
62 | +{ | ||
63 | + echo Testing: "$@" | ||
64 | + ( | ||
65 | + if ! test -t 0; then | ||
66 | + while read cmd; do | ||
67 | + echo $cmd | ||
68 | + done | ||
69 | + fi | ||
70 | + echo quit | ||
71 | + ) | $QEMU -nographic -monitor stdio -nodefaults "$@" | ||
72 | + echo | ||
73 | +} | ||
74 | + | 69 | + |
75 | +function run_qemu() | 70 | +# Create the images: base <- int <- active |
76 | +{ | 71 | +TEST_IMG="$TEST_IMG.base" _make_test_img $IMG_SIZE | _filter_imgfmt |
77 | + do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp | | 72 | +TEST_IMG="$TEST_IMG.int" _make_test_img -b "$TEST_IMG.base" | _filter_imgfmt |
78 | + _filter_generated_node_ids | _filter_imgfmt | 73 | +_make_test_img -b "$TEST_IMG.int" | _filter_imgfmt |
79 | +} | ||
80 | + | 74 | + |
81 | +function run_qemu_info_block() | 75 | +# Launch QEMU with these two drives: |
82 | +{ | 76 | +# none0: base (read-only) |
83 | + echo "info block -n" | run_qemu "$@" | grep -e "(file" -e "QEMU_PROG" | 77 | +# none1: base <- int <- active |
84 | +} | 78 | +_launch_qemu -drive if=none,file="${TEST_IMG}.base",node-name=base,read-only=on \ |
79 | + -drive if=none,file="${TEST_IMG}",backing.node-name=int,backing.backing=base | ||
85 | + | 80 | + |
86 | +size=128M | 81 | +_send_qemu_cmd $QEMU_HANDLE \ |
87 | + | 82 | + "{ 'execute': 'qmp_capabilities' }" \ |
88 | +_make_test_img $size | 83 | + 'return' |
89 | + | 84 | + |
90 | +echo | 85 | +echo |
91 | +echo "=== -drive with read-write image: read-only/auto-read-only combinations ===" | 86 | +echo '=== Send a write command to a drive opened in read-only mode (1)' |
92 | +echo | 87 | +echo |
93 | + | 88 | +_send_qemu_cmd $QEMU_HANDLE \ |
94 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on,auto-read-only=off | 89 | + "{ 'execute': 'human-monitor-command', |
95 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on,auto-read-only=on | 90 | + 'arguments': {'command-line': 'qemu-io none0 \"aio_write 0 2k\"'}}" \ |
96 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on | 91 | + 'return' |
97 | +echo | ||
98 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off,auto-read-only=off | ||
99 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off,auto-read-only=on | ||
100 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off | ||
101 | +echo | ||
102 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,auto-read-only=off | ||
103 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,auto-read-only=on | ||
104 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none | ||
105 | + | 92 | + |
106 | +echo | 93 | +echo |
107 | +echo "=== -drive with read-only image: read-only/auto-read-only combinations ===" | 94 | +echo '=== Run block-commit on base using an invalid filter node name' |
108 | +echo | 95 | +echo |
109 | + | 96 | +_send_qemu_cmd $QEMU_HANDLE \ |
110 | +chmod a-w $TEST_IMG | 97 | + "{ 'execute': 'block-commit', |
111 | + | 98 | + 'arguments': {'job-id': 'job0', 'device': 'none1', 'top-node': 'int', |
112 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on,auto-read-only=off | 99 | + 'filter-node-name': '1234'}}" \ |
113 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on,auto-read-only=on | 100 | + 'error' |
114 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on | ||
115 | +echo | ||
116 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off,auto-read-only=off | ||
117 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off,auto-read-only=on | ||
118 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off | ||
119 | +echo | ||
120 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,auto-read-only=off | ||
121 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,auto-read-only=on | ||
122 | +run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none | ||
123 | + | 101 | + |
124 | +echo | 102 | +echo |
125 | +echo "=== -blockdev with read-write image: read-only/auto-read-only combinations ===" | 103 | +echo '=== Send a write command to a drive opened in read-only mode (2)' |
126 | +echo | 104 | +echo |
127 | + | 105 | +_send_qemu_cmd $QEMU_HANDLE \ |
128 | +chmod a+w $TEST_IMG | 106 | + "{ 'execute': 'human-monitor-command', |
129 | + | 107 | + 'arguments': {'command-line': 'qemu-io none0 \"aio_write 0 2k\"'}}" \ |
130 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on,auto-read-only=off | 108 | + 'return' |
131 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on,auto-read-only=on | ||
132 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on | ||
133 | +echo | ||
134 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off,auto-read-only=off | ||
135 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off,auto-read-only=on | ||
136 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off | ||
137 | +echo | ||
138 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,auto-read-only=off | ||
139 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,auto-read-only=on | ||
140 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0 | ||
141 | + | 109 | + |
142 | +echo | 110 | +echo |
143 | +echo "=== -blockdev with read-only image: read-only/auto-read-only combinations ===" | 111 | +echo '=== Run block-commit on base using the default filter node name' |
144 | +echo | 112 | +echo |
113 | +_send_qemu_cmd $QEMU_HANDLE \ | ||
114 | + "{ 'execute': 'block-commit', | ||
115 | + 'arguments': {'job-id': 'job0', 'device': 'none1', 'top-node': 'int'}}" \ | ||
116 | + 'return' | ||
145 | + | 117 | + |
146 | +chmod a-w $TEST_IMG | 118 | +# Wait for block-commit to finish |
119 | +_send_qemu_cmd $QEMU_HANDLE '' \ | ||
120 | + '"status": "null"' | ||
147 | + | 121 | + |
148 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on,auto-read-only=off | ||
149 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on,auto-read-only=on | ||
150 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on | ||
151 | +echo | 122 | +echo |
152 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off,auto-read-only=off | 123 | +echo '=== Send a write command to a drive opened in read-only mode (3)' |
153 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off,auto-read-only=on | ||
154 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off | ||
155 | +echo | 124 | +echo |
156 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,auto-read-only=off | 125 | +_send_qemu_cmd $QEMU_HANDLE \ |
157 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,auto-read-only=on | 126 | + "{ 'execute': 'human-monitor-command', |
158 | +run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0 | 127 | + 'arguments': {'command-line': 'qemu-io none0 \"aio_write 0 2k\"'}}" \ |
128 | + 'return' | ||
129 | + | ||
130 | +_cleanup_qemu | ||
159 | + | 131 | + |
160 | +# success, all done | 132 | +# success, all done |
161 | +echo "*** done" | 133 | +echo "*** done" |
162 | +rm -f $seq.full | 134 | +rm -f $seq.full |
163 | +status=0 | 135 | +status=0 |
164 | diff --git a/tests/qemu-iotests/232.out b/tests/qemu-iotests/232.out | 136 | diff --git a/tests/qemu-iotests/249.out b/tests/qemu-iotests/249.out |
165 | new file mode 100644 | 137 | new file mode 100644 |
166 | index XXXXXXX..XXXXXXX | 138 | index XXXXXXX..XXXXXXX |
167 | --- /dev/null | 139 | --- /dev/null |
168 | +++ b/tests/qemu-iotests/232.out | 140 | +++ b/tests/qemu-iotests/249.out |
169 | @@ -XXX,XX +XXX,XX @@ | 141 | @@ -XXX,XX +XXX,XX @@ |
170 | +QA output created by 232 | 142 | +QA output created by 249 |
171 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | 143 | +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=1048576 |
144 | +Formatting 'TEST_DIR/t.IMGFMT.int', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT.base | ||
145 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT.int | ||
146 | +{"return": {}} | ||
172 | + | 147 | + |
173 | +=== -drive with read-write image: read-only/auto-read-only combinations === | 148 | +=== Send a write command to a drive opened in read-only mode (1) |
174 | + | 149 | + |
175 | +NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) | 150 | +{"return": "Block node is read-onlyrn"} |
176 | +NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) | ||
177 | +NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) | ||
178 | + | 151 | + |
179 | +NODE_NAME: TEST_DIR/t.IMGFMT (file) | 152 | +=== Run block-commit on base using an invalid filter node name |
180 | +NODE_NAME: TEST_DIR/t.IMGFMT (file) | ||
181 | +NODE_NAME: TEST_DIR/t.IMGFMT (file) | ||
182 | + | 153 | + |
183 | +NODE_NAME: TEST_DIR/t.IMGFMT (file) | 154 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}} |
184 | +NODE_NAME: TEST_DIR/t.IMGFMT (file) | 155 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}} |
185 | +NODE_NAME: TEST_DIR/t.IMGFMT (file) | 156 | +{"error": {"class": "GenericError", "desc": "Invalid node name"}} |
186 | + | 157 | + |
187 | +=== -drive with read-only image: read-only/auto-read-only combinations === | 158 | +=== Send a write command to a drive opened in read-only mode (2) |
188 | + | 159 | + |
189 | +NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) | 160 | +{"return": "Block node is read-onlyrn"} |
190 | +NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) | ||
191 | +NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) | ||
192 | + | 161 | + |
193 | +QEMU_PROG: -drive driver=file,file=TEST_DIR/t.IMGFMT,if=none,read-only=off,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied | 162 | +=== Run block-commit on base using the default filter node name |
194 | +NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) | ||
195 | +NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) | ||
196 | + | 163 | + |
197 | +QEMU_PROG: -drive driver=file,file=TEST_DIR/t.IMGFMT,if=none,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied | 164 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}} |
198 | +NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) | 165 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}} |
199 | +NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) | 166 | +{"return": {}} |
167 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "job0"}} | ||
168 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "job0"}} | ||
169 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "job0", "len": 1048576, "offset": 1048576, "speed": 0, "type": "commit"}} | ||
170 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "job0"}} | ||
171 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}} | ||
200 | + | 172 | + |
201 | +=== -blockdev with read-write image: read-only/auto-read-only combinations === | 173 | +=== Send a write command to a drive opened in read-only mode (3) |
202 | + | 174 | + |
203 | +node0: TEST_DIR/t.IMGFMT (file, read-only) | 175 | +{"return": "Block node is read-onlyrn"} |
204 | +node0: TEST_DIR/t.IMGFMT (file, read-only) | ||
205 | +node0: TEST_DIR/t.IMGFMT (file, read-only) | ||
206 | + | ||
207 | +node0: TEST_DIR/t.IMGFMT (file) | ||
208 | +node0: TEST_DIR/t.IMGFMT (file) | ||
209 | +node0: TEST_DIR/t.IMGFMT (file) | ||
210 | + | ||
211 | +node0: TEST_DIR/t.IMGFMT (file) | ||
212 | +node0: TEST_DIR/t.IMGFMT (file) | ||
213 | +node0: TEST_DIR/t.IMGFMT (file) | ||
214 | + | ||
215 | +=== -blockdev with read-only image: read-only/auto-read-only combinations === | ||
216 | + | ||
217 | +node0: TEST_DIR/t.IMGFMT (file, read-only) | ||
218 | +node0: TEST_DIR/t.IMGFMT (file, read-only) | ||
219 | +node0: TEST_DIR/t.IMGFMT (file, read-only) | ||
220 | + | ||
221 | +QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0,read-only=off,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied | ||
222 | +node0: TEST_DIR/t.IMGFMT (file, read-only) | ||
223 | +QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0,read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied | ||
224 | + | ||
225 | +QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied | ||
226 | +node0: TEST_DIR/t.IMGFMT (file, read-only) | ||
227 | +QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0: Could not open 'TEST_DIR/t.IMGFMT': Permission denied | ||
228 | +*** done | 176 | +*** done |
229 | diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group | 177 | diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group |
230 | index XXXXXXX..XXXXXXX 100644 | 178 | index XXXXXXX..XXXXXXX 100644 |
231 | --- a/tests/qemu-iotests/group | 179 | --- a/tests/qemu-iotests/group |
232 | +++ b/tests/qemu-iotests/group | 180 | +++ b/tests/qemu-iotests/group |
233 | @@ -XXX,XX +XXX,XX @@ | 181 | @@ -XXX,XX +XXX,XX @@ |
234 | 227 auto quick | 182 | 246 rw auto quick |
235 | 229 auto quick | 183 | 247 rw auto quick |
236 | 231 auto quick | 184 | 248 rw auto quick |
237 | +232 auto quick | 185 | +249 rw auto quick |
238 | -- | 186 | -- |
239 | 2.19.1 | 187 | 2.20.1 |
240 | 188 | ||
241 | 189 | diff view generated by jsdifflib |
1 | From: Peter Maydell <peter.maydell@linaro.org> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | Taking the address of a field in a packed struct is a bad idea, because | 3 | qed_read_table and qed_write_table use coroutine-only interfaces but |
4 | it might not be actually aligned enough for that pointer type (and | 4 | are not marked coroutine_fn. Happily, they are called only from |
5 | thus cause a crash on dereference on some host architectures). Newer | 5 | coroutine context, so we only need to add missed markers. |
6 | versions of clang warn about this. Avoid the bug by not using the | ||
7 | "modify in place" byte swapping functions. | ||
8 | 6 | ||
9 | There are a few places where the in-place swap function is | 7 | Reported-by: Kevin Wolf <kwolf@redhat.com> |
10 | used on something other than a packed struct field; we convert | 8 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
11 | those anyway, for consistency. | ||
12 | |||
13 | This patch was produced with the following spatch script: | ||
14 | |||
15 | @@ | ||
16 | expression E; | ||
17 | @@ | ||
18 | -be16_to_cpus(&E); | ||
19 | +E = be16_to_cpu(E); | ||
20 | @@ | ||
21 | expression E; | ||
22 | @@ | ||
23 | -be32_to_cpus(&E); | ||
24 | +E = be32_to_cpu(E); | ||
25 | @@ | ||
26 | expression E; | ||
27 | @@ | ||
28 | -be64_to_cpus(&E); | ||
29 | +E = be64_to_cpu(E); | ||
30 | @@ | ||
31 | expression E; | ||
32 | @@ | ||
33 | -cpu_to_be16s(&E); | ||
34 | +E = cpu_to_be16(E); | ||
35 | @@ | ||
36 | expression E; | ||
37 | @@ | ||
38 | -cpu_to_be32s(&E); | ||
39 | +E = cpu_to_be32(E); | ||
40 | @@ | ||
41 | expression E; | ||
42 | @@ | ||
43 | -cpu_to_be64s(&E); | ||
44 | +E = cpu_to_be64(E); | ||
45 | |||
46 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
47 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
48 | Tested-by: John Snow <jsnow@redhat.com> | ||
49 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
50 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 9 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
51 | --- | 10 | --- |
52 | block/qcow2-bitmap.c | 24 ++++++++++++------------ | 11 | block/qed.h | 28 ++++++++++++++++------------ |
53 | 1 file changed, 12 insertions(+), 12 deletions(-) | 12 | block/qed-check.c | 4 ++-- |
13 | block/qed-table.c | 33 ++++++++++++++++++++------------- | ||
14 | block/qed.c | 5 +++-- | ||
15 | 4 files changed, 41 insertions(+), 29 deletions(-) | ||
54 | 16 | ||
55 | diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c | 17 | diff --git a/block/qed.h b/block/qed.h |
56 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
57 | --- a/block/qcow2-bitmap.c | 19 | --- a/block/qed.h |
58 | +++ b/block/qcow2-bitmap.c | 20 | +++ b/block/qed.h |
59 | @@ -XXX,XX +XXX,XX @@ static inline void bitmap_table_to_be(uint64_t *bitmap_table, size_t size) | 21 | @@ -XXX,XX +XXX,XX @@ void qed_commit_l2_cache_entry(L2TableCache *l2_cache, CachedL2Table *l2_table); |
60 | size_t i; | 22 | /** |
61 | 23 | * Table I/O functions | |
62 | for (i = 0; i < size; ++i) { | 24 | */ |
63 | - cpu_to_be64s(&bitmap_table[i]); | 25 | -int qed_read_l1_table_sync(BDRVQEDState *s); |
64 | + bitmap_table[i] = cpu_to_be64(bitmap_table[i]); | 26 | -int qed_write_l1_table(BDRVQEDState *s, unsigned int index, unsigned int n); |
27 | -int qed_write_l1_table_sync(BDRVQEDState *s, unsigned int index, | ||
28 | - unsigned int n); | ||
29 | -int qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request, | ||
30 | - uint64_t offset); | ||
31 | -int qed_read_l2_table(BDRVQEDState *s, QEDRequest *request, uint64_t offset); | ||
32 | -int qed_write_l2_table(BDRVQEDState *s, QEDRequest *request, | ||
33 | - unsigned int index, unsigned int n, bool flush); | ||
34 | -int qed_write_l2_table_sync(BDRVQEDState *s, QEDRequest *request, | ||
35 | - unsigned int index, unsigned int n, bool flush); | ||
36 | +int coroutine_fn qed_read_l1_table_sync(BDRVQEDState *s); | ||
37 | +int coroutine_fn qed_write_l1_table(BDRVQEDState *s, unsigned int index, | ||
38 | + unsigned int n); | ||
39 | +int coroutine_fn qed_write_l1_table_sync(BDRVQEDState *s, unsigned int index, | ||
40 | + unsigned int n); | ||
41 | +int coroutine_fn qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request, | ||
42 | + uint64_t offset); | ||
43 | +int coroutine_fn qed_read_l2_table(BDRVQEDState *s, QEDRequest *request, | ||
44 | + uint64_t offset); | ||
45 | +int coroutine_fn qed_write_l2_table(BDRVQEDState *s, QEDRequest *request, | ||
46 | + unsigned int index, unsigned int n, | ||
47 | + bool flush); | ||
48 | +int coroutine_fn qed_write_l2_table_sync(BDRVQEDState *s, QEDRequest *request, | ||
49 | + unsigned int index, unsigned int n, | ||
50 | + bool flush); | ||
51 | |||
52 | /** | ||
53 | * Cluster functions | ||
54 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn qed_find_cluster(BDRVQEDState *s, QEDRequest *request, | ||
55 | /** | ||
56 | * Consistency check | ||
57 | */ | ||
58 | -int qed_check(BDRVQEDState *s, BdrvCheckResult *result, bool fix); | ||
59 | +int coroutine_fn qed_check(BDRVQEDState *s, BdrvCheckResult *result, bool fix); | ||
60 | |||
61 | QEDTable *qed_alloc_table(BDRVQEDState *s); | ||
62 | |||
63 | diff --git a/block/qed-check.c b/block/qed-check.c | ||
64 | index XXXXXXX..XXXXXXX 100644 | ||
65 | --- a/block/qed-check.c | ||
66 | +++ b/block/qed-check.c | ||
67 | @@ -XXX,XX +XXX,XX @@ static unsigned int qed_check_l2_table(QEDCheck *check, QEDTable *table) | ||
68 | /** | ||
69 | * Descend tables and check each cluster is referenced once only | ||
70 | */ | ||
71 | -static int qed_check_l1_table(QEDCheck *check, QEDTable *table) | ||
72 | +static int coroutine_fn qed_check_l1_table(QEDCheck *check, QEDTable *table) | ||
73 | { | ||
74 | BDRVQEDState *s = check->s; | ||
75 | unsigned int i, num_invalid_l1 = 0; | ||
76 | @@ -XXX,XX +XXX,XX @@ static void qed_check_mark_clean(BDRVQEDState *s, BdrvCheckResult *result) | ||
77 | } | ||
78 | |||
79 | /* Called with table_lock held. */ | ||
80 | -int qed_check(BDRVQEDState *s, BdrvCheckResult *result, bool fix) | ||
81 | +int coroutine_fn qed_check(BDRVQEDState *s, BdrvCheckResult *result, bool fix) | ||
82 | { | ||
83 | QEDCheck check = { | ||
84 | .s = s, | ||
85 | diff --git a/block/qed-table.c b/block/qed-table.c | ||
86 | index XXXXXXX..XXXXXXX 100644 | ||
87 | --- a/block/qed-table.c | ||
88 | +++ b/block/qed-table.c | ||
89 | @@ -XXX,XX +XXX,XX @@ | ||
90 | #include "qemu/bswap.h" | ||
91 | |||
92 | /* Called with table_lock held. */ | ||
93 | -static int qed_read_table(BDRVQEDState *s, uint64_t offset, QEDTable *table) | ||
94 | +static int coroutine_fn qed_read_table(BDRVQEDState *s, uint64_t offset, | ||
95 | + QEDTable *table) | ||
96 | { | ||
97 | unsigned int bytes = s->header.cluster_size * s->header.table_size; | ||
98 | |||
99 | @@ -XXX,XX +XXX,XX @@ out: | ||
100 | * | ||
101 | * Called with table_lock held. | ||
102 | */ | ||
103 | -static int qed_write_table(BDRVQEDState *s, uint64_t offset, QEDTable *table, | ||
104 | - unsigned int index, unsigned int n, bool flush) | ||
105 | +static int coroutine_fn qed_write_table(BDRVQEDState *s, uint64_t offset, | ||
106 | + QEDTable *table, unsigned int index, | ||
107 | + unsigned int n, bool flush) | ||
108 | { | ||
109 | unsigned int sector_mask = BDRV_SECTOR_SIZE / sizeof(uint64_t) - 1; | ||
110 | unsigned int start, end, i; | ||
111 | @@ -XXX,XX +XXX,XX @@ out: | ||
112 | return ret; | ||
113 | } | ||
114 | |||
115 | -int qed_read_l1_table_sync(BDRVQEDState *s) | ||
116 | +int coroutine_fn qed_read_l1_table_sync(BDRVQEDState *s) | ||
117 | { | ||
118 | return qed_read_table(s, s->header.l1_table_offset, s->l1_table); | ||
119 | } | ||
120 | |||
121 | /* Called with table_lock held. */ | ||
122 | -int qed_write_l1_table(BDRVQEDState *s, unsigned int index, unsigned int n) | ||
123 | +int coroutine_fn qed_write_l1_table(BDRVQEDState *s, unsigned int index, | ||
124 | + unsigned int n) | ||
125 | { | ||
126 | BLKDBG_EVENT(s->bs->file, BLKDBG_L1_UPDATE); | ||
127 | return qed_write_table(s, s->header.l1_table_offset, | ||
128 | s->l1_table, index, n, false); | ||
129 | } | ||
130 | |||
131 | -int qed_write_l1_table_sync(BDRVQEDState *s, unsigned int index, | ||
132 | - unsigned int n) | ||
133 | +int coroutine_fn qed_write_l1_table_sync(BDRVQEDState *s, unsigned int index, | ||
134 | + unsigned int n) | ||
135 | { | ||
136 | return qed_write_l1_table(s, index, n); | ||
137 | } | ||
138 | |||
139 | /* Called with table_lock held. */ | ||
140 | -int qed_read_l2_table(BDRVQEDState *s, QEDRequest *request, uint64_t offset) | ||
141 | +int coroutine_fn qed_read_l2_table(BDRVQEDState *s, QEDRequest *request, | ||
142 | + uint64_t offset) | ||
143 | { | ||
144 | int ret; | ||
145 | |||
146 | @@ -XXX,XX +XXX,XX @@ int qed_read_l2_table(BDRVQEDState *s, QEDRequest *request, uint64_t offset) | ||
147 | return ret; | ||
148 | } | ||
149 | |||
150 | -int qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request, uint64_t offset) | ||
151 | +int coroutine_fn qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request, | ||
152 | + uint64_t offset) | ||
153 | { | ||
154 | return qed_read_l2_table(s, request, offset); | ||
155 | } | ||
156 | |||
157 | /* Called with table_lock held. */ | ||
158 | -int qed_write_l2_table(BDRVQEDState *s, QEDRequest *request, | ||
159 | - unsigned int index, unsigned int n, bool flush) | ||
160 | +int coroutine_fn qed_write_l2_table(BDRVQEDState *s, QEDRequest *request, | ||
161 | + unsigned int index, unsigned int n, | ||
162 | + bool flush) | ||
163 | { | ||
164 | BLKDBG_EVENT(s->bs->file, BLKDBG_L2_UPDATE); | ||
165 | return qed_write_table(s, request->l2_table->offset, | ||
166 | request->l2_table->table, index, n, flush); | ||
167 | } | ||
168 | |||
169 | -int qed_write_l2_table_sync(BDRVQEDState *s, QEDRequest *request, | ||
170 | - unsigned int index, unsigned int n, bool flush) | ||
171 | +int coroutine_fn qed_write_l2_table_sync(BDRVQEDState *s, QEDRequest *request, | ||
172 | + unsigned int index, unsigned int n, | ||
173 | + bool flush) | ||
174 | { | ||
175 | return qed_write_l2_table(s, request, index, n, flush); | ||
176 | } | ||
177 | diff --git a/block/qed.c b/block/qed.c | ||
178 | index XXXXXXX..XXXXXXX 100644 | ||
179 | --- a/block/qed.c | ||
180 | +++ b/block/qed.c | ||
181 | @@ -XXX,XX +XXX,XX @@ static void coroutine_fn bdrv_qed_co_invalidate_cache(BlockDriverState *bs, | ||
65 | } | 182 | } |
66 | } | 183 | } |
67 | 184 | ||
68 | @@ -XXX,XX +XXX,XX @@ static int bitmap_table_load(BlockDriverState *bs, Qcow2BitmapTable *tb, | 185 | -static int bdrv_qed_co_check(BlockDriverState *bs, BdrvCheckResult *result, |
69 | } | 186 | - BdrvCheckMode fix) |
70 | 187 | +static int coroutine_fn bdrv_qed_co_check(BlockDriverState *bs, | |
71 | for (i = 0; i < tb->size; ++i) { | 188 | + BdrvCheckResult *result, |
72 | - be64_to_cpus(&table[i]); | 189 | + BdrvCheckMode fix) |
73 | + table[i] = be64_to_cpu(table[i]); | ||
74 | ret = check_table_entry(table[i], s->cluster_size); | ||
75 | if (ret < 0) { | ||
76 | goto fail; | ||
77 | @@ -XXX,XX +XXX,XX @@ fail: | ||
78 | |||
79 | static inline void bitmap_dir_entry_to_cpu(Qcow2BitmapDirEntry *entry) | ||
80 | { | 190 | { |
81 | - be64_to_cpus(&entry->bitmap_table_offset); | 191 | BDRVQEDState *s = bs->opaque; |
82 | - be32_to_cpus(&entry->bitmap_table_size); | 192 | int ret; |
83 | - be32_to_cpus(&entry->flags); | ||
84 | - be16_to_cpus(&entry->name_size); | ||
85 | - be32_to_cpus(&entry->extra_data_size); | ||
86 | + entry->bitmap_table_offset = be64_to_cpu(entry->bitmap_table_offset); | ||
87 | + entry->bitmap_table_size = be32_to_cpu(entry->bitmap_table_size); | ||
88 | + entry->flags = be32_to_cpu(entry->flags); | ||
89 | + entry->name_size = be16_to_cpu(entry->name_size); | ||
90 | + entry->extra_data_size = be32_to_cpu(entry->extra_data_size); | ||
91 | } | ||
92 | |||
93 | static inline void bitmap_dir_entry_to_be(Qcow2BitmapDirEntry *entry) | ||
94 | { | ||
95 | - cpu_to_be64s(&entry->bitmap_table_offset); | ||
96 | - cpu_to_be32s(&entry->bitmap_table_size); | ||
97 | - cpu_to_be32s(&entry->flags); | ||
98 | - cpu_to_be16s(&entry->name_size); | ||
99 | - cpu_to_be32s(&entry->extra_data_size); | ||
100 | + entry->bitmap_table_offset = cpu_to_be64(entry->bitmap_table_offset); | ||
101 | + entry->bitmap_table_size = cpu_to_be32(entry->bitmap_table_size); | ||
102 | + entry->flags = cpu_to_be32(entry->flags); | ||
103 | + entry->name_size = cpu_to_be16(entry->name_size); | ||
104 | + entry->extra_data_size = cpu_to_be32(entry->extra_data_size); | ||
105 | } | ||
106 | |||
107 | static inline int calc_dir_entry_size(size_t name_size, size_t extra_data_size) | ||
108 | -- | 193 | -- |
109 | 2.19.1 | 194 | 2.20.1 |
110 | 195 | ||
111 | 196 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Daniel P. Berrangé <berrange@redhat.com> | ||
2 | 1 | ||
3 | The qcow2 block driver expects to see a valid sector size even when it | ||
4 | has opened the crypto layer with QCRYPTO_BLOCK_OPEN_NO_IO. | ||
5 | |||
6 | Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> | ||
7 | Reviewed-by: Alberto Garcia <berto@igalia.com> | ||
8 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
9 | --- | ||
10 | crypto/block-qcow.c | 2 ++ | ||
11 | 1 file changed, 2 insertions(+) | ||
12 | |||
13 | diff --git a/crypto/block-qcow.c b/crypto/block-qcow.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/crypto/block-qcow.c | ||
16 | +++ b/crypto/block-qcow.c | ||
17 | @@ -XXX,XX +XXX,XX @@ qcrypto_block_qcow_open(QCryptoBlock *block, | ||
18 | Error **errp) | ||
19 | { | ||
20 | if (flags & QCRYPTO_BLOCK_OPEN_NO_IO) { | ||
21 | + block->sector_size = QCRYPTO_BLOCK_QCOW_SECTOR_SIZE; | ||
22 | + block->payload_offset = 0; | ||
23 | return 0; | ||
24 | } else { | ||
25 | if (!options->u.qcow.key_secret) { | ||
26 | -- | ||
27 | 2.19.1 | ||
28 | |||
29 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Peter Maydell <peter.maydell@linaro.org> | ||
2 | 1 | ||
3 | Taking the address of a field in a packed struct is a bad idea, because | ||
4 | it might not be actually aligned enough for that pointer type (and | ||
5 | thus cause a crash on dereference on some host architectures). Newer | ||
6 | versions of clang warn about this. Avoid the bug by not using the | ||
7 | "modify in place" byte swapping functions. | ||
8 | |||
9 | There are a few places where the in-place swap function is | ||
10 | used on something other than a packed struct field; we convert | ||
11 | those anyway, for consistency. | ||
12 | |||
13 | Patch produced with scripts/coccinelle/inplace-byteswaps.cocci. | ||
14 | |||
15 | There are other places where we take the address of a packed member | ||
16 | in this file for other purposes than passing it to a byteswap | ||
17 | function (all the calls to qemu_uuid_*()); we leave those for now. | ||
18 | |||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
20 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
21 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
22 | --- | ||
23 | block/vdi.c | 64 ++++++++++++++++++++++++++--------------------------- | ||
24 | 1 file changed, 32 insertions(+), 32 deletions(-) | ||
25 | |||
26 | diff --git a/block/vdi.c b/block/vdi.c | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/block/vdi.c | ||
29 | +++ b/block/vdi.c | ||
30 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
31 | |||
32 | static void vdi_header_to_cpu(VdiHeader *header) | ||
33 | { | ||
34 | - le32_to_cpus(&header->signature); | ||
35 | - le32_to_cpus(&header->version); | ||
36 | - le32_to_cpus(&header->header_size); | ||
37 | - le32_to_cpus(&header->image_type); | ||
38 | - le32_to_cpus(&header->image_flags); | ||
39 | - le32_to_cpus(&header->offset_bmap); | ||
40 | - le32_to_cpus(&header->offset_data); | ||
41 | - le32_to_cpus(&header->cylinders); | ||
42 | - le32_to_cpus(&header->heads); | ||
43 | - le32_to_cpus(&header->sectors); | ||
44 | - le32_to_cpus(&header->sector_size); | ||
45 | - le64_to_cpus(&header->disk_size); | ||
46 | - le32_to_cpus(&header->block_size); | ||
47 | - le32_to_cpus(&header->block_extra); | ||
48 | - le32_to_cpus(&header->blocks_in_image); | ||
49 | - le32_to_cpus(&header->blocks_allocated); | ||
50 | + header->signature = le32_to_cpu(header->signature); | ||
51 | + header->version = le32_to_cpu(header->version); | ||
52 | + header->header_size = le32_to_cpu(header->header_size); | ||
53 | + header->image_type = le32_to_cpu(header->image_type); | ||
54 | + header->image_flags = le32_to_cpu(header->image_flags); | ||
55 | + header->offset_bmap = le32_to_cpu(header->offset_bmap); | ||
56 | + header->offset_data = le32_to_cpu(header->offset_data); | ||
57 | + header->cylinders = le32_to_cpu(header->cylinders); | ||
58 | + header->heads = le32_to_cpu(header->heads); | ||
59 | + header->sectors = le32_to_cpu(header->sectors); | ||
60 | + header->sector_size = le32_to_cpu(header->sector_size); | ||
61 | + header->disk_size = le64_to_cpu(header->disk_size); | ||
62 | + header->block_size = le32_to_cpu(header->block_size); | ||
63 | + header->block_extra = le32_to_cpu(header->block_extra); | ||
64 | + header->blocks_in_image = le32_to_cpu(header->blocks_in_image); | ||
65 | + header->blocks_allocated = le32_to_cpu(header->blocks_allocated); | ||
66 | qemu_uuid_bswap(&header->uuid_image); | ||
67 | qemu_uuid_bswap(&header->uuid_last_snap); | ||
68 | qemu_uuid_bswap(&header->uuid_link); | ||
69 | @@ -XXX,XX +XXX,XX @@ static void vdi_header_to_cpu(VdiHeader *header) | ||
70 | |||
71 | static void vdi_header_to_le(VdiHeader *header) | ||
72 | { | ||
73 | - cpu_to_le32s(&header->signature); | ||
74 | - cpu_to_le32s(&header->version); | ||
75 | - cpu_to_le32s(&header->header_size); | ||
76 | - cpu_to_le32s(&header->image_type); | ||
77 | - cpu_to_le32s(&header->image_flags); | ||
78 | - cpu_to_le32s(&header->offset_bmap); | ||
79 | - cpu_to_le32s(&header->offset_data); | ||
80 | - cpu_to_le32s(&header->cylinders); | ||
81 | - cpu_to_le32s(&header->heads); | ||
82 | - cpu_to_le32s(&header->sectors); | ||
83 | - cpu_to_le32s(&header->sector_size); | ||
84 | - cpu_to_le64s(&header->disk_size); | ||
85 | - cpu_to_le32s(&header->block_size); | ||
86 | - cpu_to_le32s(&header->block_extra); | ||
87 | - cpu_to_le32s(&header->blocks_in_image); | ||
88 | - cpu_to_le32s(&header->blocks_allocated); | ||
89 | + header->signature = cpu_to_le32(header->signature); | ||
90 | + header->version = cpu_to_le32(header->version); | ||
91 | + header->header_size = cpu_to_le32(header->header_size); | ||
92 | + header->image_type = cpu_to_le32(header->image_type); | ||
93 | + header->image_flags = cpu_to_le32(header->image_flags); | ||
94 | + header->offset_bmap = cpu_to_le32(header->offset_bmap); | ||
95 | + header->offset_data = cpu_to_le32(header->offset_data); | ||
96 | + header->cylinders = cpu_to_le32(header->cylinders); | ||
97 | + header->heads = cpu_to_le32(header->heads); | ||
98 | + header->sectors = cpu_to_le32(header->sectors); | ||
99 | + header->sector_size = cpu_to_le32(header->sector_size); | ||
100 | + header->disk_size = cpu_to_le64(header->disk_size); | ||
101 | + header->block_size = cpu_to_le32(header->block_size); | ||
102 | + header->block_extra = cpu_to_le32(header->block_extra); | ||
103 | + header->blocks_in_image = cpu_to_le32(header->blocks_in_image); | ||
104 | + header->blocks_allocated = cpu_to_le32(header->blocks_allocated); | ||
105 | qemu_uuid_bswap(&header->uuid_image); | ||
106 | qemu_uuid_bswap(&header->uuid_last_snap); | ||
107 | qemu_uuid_bswap(&header->uuid_link); | ||
108 | -- | ||
109 | 2.19.1 | ||
110 | |||
111 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alberto Garcia <berto@igalia.com> | ||
2 | 1 | ||
3 | Signed-off-by: Alberto Garcia <berto@igalia.com> | ||
4 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
5 | --- | ||
6 | tests/qemu-iotests/081 | 30 ++++++++++++++++++++++++++++++ | ||
7 | tests/qemu-iotests/081.out | 16 ++++++++++++++++ | ||
8 | 2 files changed, 46 insertions(+) | ||
9 | |||
10 | diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081 | ||
11 | index XXXXXXX..XXXXXXX 100755 | ||
12 | --- a/tests/qemu-iotests/081 | ||
13 | +++ b/tests/qemu-iotests/081 | ||
14 | @@ -XXX,XX +XXX,XX @@ echo "== checking that quorum is broken ==" | ||
15 | |||
16 | $QEMU_IO -c "open -o $quorum" -c "read -P 0x32 0 $size" | _filter_qemu_io | ||
17 | |||
18 | +echo | ||
19 | +echo "== checking the blkverify mode with broken content ==" | ||
20 | + | ||
21 | +quorum="driver=raw,file.driver=quorum,file.vote-threshold=2,file.blkverify=on" | ||
22 | +quorum="$quorum,file.children.0.file.filename=$TEST_DIR/1.raw" | ||
23 | +quorum="$quorum,file.children.1.file.filename=$TEST_DIR/2.raw" | ||
24 | +quorum="$quorum,file.children.0.driver=raw" | ||
25 | +quorum="$quorum,file.children.1.driver=raw" | ||
26 | + | ||
27 | +$QEMU_IO -c "open -o $quorum" -c "read -P 0x32 0 $size" | _filter_qemu_io | ||
28 | + | ||
29 | +echo | ||
30 | +echo "== writing the same data to both files ==" | ||
31 | + | ||
32 | +$QEMU_IO -c "write -P 0x32 0 $size" "$TEST_DIR/1.raw" | _filter_qemu_io | ||
33 | +$QEMU_IO -c "write -P 0x32 0 $size" "$TEST_DIR/2.raw" | _filter_qemu_io | ||
34 | + | ||
35 | +echo | ||
36 | +echo "== checking the blkverify mode with valid content ==" | ||
37 | + | ||
38 | +$QEMU_IO -c "open -o $quorum" -c "read -P 0x32 0 $size" | _filter_qemu_io | ||
39 | + | ||
40 | +echo | ||
41 | +echo "== checking the blkverify mode with invalid settings ==" | ||
42 | + | ||
43 | +quorum="$quorum,file.children.2.file.filename=$TEST_DIR/3.raw" | ||
44 | +quorum="$quorum,file.children.2.driver=raw" | ||
45 | + | ||
46 | +$QEMU_IO -c "open -o $quorum" | _filter_qemu_io | ||
47 | + | ||
48 | # success, all done | ||
49 | echo "*** done" | ||
50 | rm -f $seq.full | ||
51 | diff --git a/tests/qemu-iotests/081.out b/tests/qemu-iotests/081.out | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/tests/qemu-iotests/081.out | ||
54 | +++ b/tests/qemu-iotests/081.out | ||
55 | @@ -XXX,XX +XXX,XX @@ wrote 10485760/10485760 bytes at offset 0 | ||
56 | |||
57 | == checking that quorum is broken == | ||
58 | read failed: Input/output error | ||
59 | + | ||
60 | +== checking the blkverify mode with broken content == | ||
61 | +quorum: offset=0 bytes=10485760 contents mismatch at offset 0 | ||
62 | + | ||
63 | +== writing the same data to both files == | ||
64 | +wrote 10485760/10485760 bytes at offset 0 | ||
65 | +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
66 | +wrote 10485760/10485760 bytes at offset 0 | ||
67 | +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
68 | + | ||
69 | +== checking the blkverify mode with valid content == | ||
70 | +read 10485760/10485760 bytes at offset 0 | ||
71 | +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
72 | + | ||
73 | +== checking the blkverify mode with invalid settings == | ||
74 | +can't open: blkverify=on can only be set if there are exactly two files and vote-threshold is 2 | ||
75 | *** done | ||
76 | -- | ||
77 | 2.19.1 | ||
78 | |||
79 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Commit e2b8247a322 introduced an error path in qemu_rbd_open() after | ||
2 | calling rbd_open(), but neglected to close the image again in this error | ||
3 | path. The error path should contain everything that the regular close | ||
4 | function qemu_rbd_close() contains. | ||
5 | 1 | ||
6 | This adds the missing rbd_close() call. | ||
7 | |||
8 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
9 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
10 | --- | ||
11 | block/rbd.c | 1 + | ||
12 | 1 file changed, 1 insertion(+) | ||
13 | |||
14 | diff --git a/block/rbd.c b/block/rbd.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/block/rbd.c | ||
17 | +++ b/block/rbd.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, | ||
19 | "automatically marking the image read-only."); | ||
20 | r = bdrv_set_read_only(bs, true, &local_err); | ||
21 | if (r < 0) { | ||
22 | + rbd_close(s->image); | ||
23 | error_propagate(errp, local_err); | ||
24 | goto failed_open; | ||
25 | } | ||
26 | -- | ||
27 | 2.19.1 | ||
28 | |||
29 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | If read-only=off, but auto-read-only=on is given, open a read-write NBD | ||
2 | connection if the server provides a read-write export, but instead of | ||
3 | erroring out for read-only exports, just degrade to read-only. | ||
4 | 1 | ||
5 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
6 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
7 | --- | ||
8 | block/nbd-client.c | 10 +++++----- | ||
9 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
10 | |||
11 | diff --git a/block/nbd-client.c b/block/nbd-client.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/block/nbd-client.c | ||
14 | +++ b/block/nbd-client.c | ||
15 | @@ -XXX,XX +XXX,XX @@ int nbd_client_init(BlockDriverState *bs, | ||
16 | logout("Failed to negotiate with the NBD server\n"); | ||
17 | return ret; | ||
18 | } | ||
19 | - if (client->info.flags & NBD_FLAG_READ_ONLY && | ||
20 | - !bdrv_is_read_only(bs)) { | ||
21 | - error_setg(errp, | ||
22 | - "request for write access conflicts with read-only export"); | ||
23 | - return -EACCES; | ||
24 | + if (client->info.flags & NBD_FLAG_READ_ONLY) { | ||
25 | + ret = bdrv_apply_auto_read_only(bs, "NBD export is read-only", errp); | ||
26 | + if (ret < 0) { | ||
27 | + return ret; | ||
28 | + } | ||
29 | } | ||
30 | if (client->info.flags & NBD_FLAG_SEND_FUA) { | ||
31 | bs->supported_write_flags = BDRV_REQ_FUA; | ||
32 | -- | ||
33 | 2.19.1 | ||
34 | |||
35 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | If read-only=off, but auto-read-only=on is given, just degrade to | ||
2 | read-only. | ||
3 | 1 | ||
4 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
5 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
6 | --- | ||
7 | block/curl.c | 8 ++++---- | ||
8 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
9 | |||
10 | diff --git a/block/curl.c b/block/curl.c | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/block/curl.c | ||
13 | +++ b/block/curl.c | ||
14 | @@ -XXX,XX +XXX,XX @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags, | ||
15 | const char *protocol_delimiter; | ||
16 | int ret; | ||
17 | |||
18 | - | ||
19 | - if (flags & BDRV_O_RDWR) { | ||
20 | - error_setg(errp, "curl block device does not support writes"); | ||
21 | - return -EROFS; | ||
22 | + ret = bdrv_apply_auto_read_only(bs, "curl driver does not support writes", | ||
23 | + errp); | ||
24 | + if (ret < 0) { | ||
25 | + return ret; | ||
26 | } | ||
27 | |||
28 | if (!libcurl_initialized) { | ||
29 | -- | ||
30 | 2.19.1 | ||
31 | |||
32 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | If read-only=off, but auto-read-only=on is given, open the file | ||
2 | read-write if we have the permissions, but instead of erroring out for | ||
3 | read-only files, just degrade to read-only. | ||
4 | 1 | ||
5 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
6 | Reviewed-by: Niels de Vos <ndevos@redhat.com> | ||
7 | --- | ||
8 | block/gluster.c | 12 ++++++++++-- | ||
9 | 1 file changed, 10 insertions(+), 2 deletions(-) | ||
10 | |||
11 | diff --git a/block/gluster.c b/block/gluster.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/block/gluster.c | ||
14 | +++ b/block/gluster.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static int qemu_gluster_open(BlockDriverState *bs, QDict *options, | ||
16 | qemu_gluster_parse_flags(bdrv_flags, &open_flags); | ||
17 | |||
18 | s->fd = glfs_open(s->glfs, gconf->path, open_flags); | ||
19 | - if (!s->fd) { | ||
20 | - ret = -errno; | ||
21 | + ret = s->fd ? 0 : -errno; | ||
22 | + | ||
23 | + if (ret == -EACCES || ret == -EROFS) { | ||
24 | + /* Try to degrade to read-only, but if it doesn't work, still use the | ||
25 | + * normal error message. */ | ||
26 | + if (bdrv_apply_auto_read_only(bs, NULL, NULL) == 0) { | ||
27 | + open_flags = (open_flags & ~O_RDWR) | O_RDONLY; | ||
28 | + s->fd = glfs_open(s->glfs, gconf->path, open_flags); | ||
29 | + ret = s->fd ? 0 : -errno; | ||
30 | + } | ||
31 | } | ||
32 | |||
33 | s->supports_seek_data = qemu_gluster_test_seek(s->fd); | ||
34 | -- | ||
35 | 2.19.1 | ||
36 | |||
37 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | While we want machine interfaces like -blockdev and QMP blockdev-add to | ||
2 | add as little auto-detection as possible so that management tools are | ||
3 | explicit about their needs, -drive is a convenience option for human | ||
4 | users. Enabling auto-read-only=on by default there enables users to use | ||
5 | read-only images for read-only guest devices without having to specify | ||
6 | read-only=on explicitly. If they try to attach the image to a read-write | ||
7 | device, they will still get an error message. | ||
8 | 1 | ||
9 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
10 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
11 | --- | ||
12 | blockdev.c | 1 + | ||
13 | 1 file changed, 1 insertion(+) | ||
14 | |||
15 | diff --git a/blockdev.c b/blockdev.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/blockdev.c | ||
18 | +++ b/blockdev.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, | ||
20 | qdict_set_default_str(bs_opts, BDRV_OPT_CACHE_NO_FLUSH, "off"); | ||
21 | qdict_set_default_str(bs_opts, BDRV_OPT_READ_ONLY, | ||
22 | read_only ? "on" : "off"); | ||
23 | + qdict_set_default_str(bs_opts, BDRV_OPT_AUTO_READ_ONLY, "on"); | ||
24 | assert((bdrv_flags & BDRV_O_CACHE_MASK) == 0); | ||
25 | |||
26 | if (runstate_check(RUN_STATE_INMIGRATE)) { | ||
27 | -- | ||
28 | 2.19.1 | ||
29 | |||
30 | diff view generated by jsdifflib |