1
The following changes since commit 22d96eac64877c4d96f9928babb6f2fcc68faacf:
1
The following changes since commit 9a7beaad3dbba982f7a461d676b55a5c3851d312:
2
2
3
Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging (2019-04-29 19:11:15 +0100)
3
Merge remote-tracking branch 'remotes/alistair/tags/pull-riscv-to-apply-20210304' into staging (2021-03-05 10:47:46 +0000)
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 54277a2aab876aba7b55c7e88e2b372691849741:
9
for you to fetch changes up to 67bedc3aed5c455b629c2cb5f523b536c46adff9:
10
10
11
block/qed: add missed coroutine_fn markers (2019-04-30 15:29:00 +0200)
11
docs: qsd: Explain --export nbd,name=... default (2021-03-05 17:09:46 +0100)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Block layer patches:
14
Block layer patches:
15
15
16
- iotests: Fix output of qemu-io related tests
16
- qemu-storage-daemon: add --pidfile option
17
- Don't ignore bdrv_set_aio_context() for nodes with bs->drv = NUL
17
- qemu-storage-daemon: CLI error messages include the option name now
18
- vmdk: Set vmdk parent backing_format to vmdk
18
- vhost-user-blk export: Misc fixes, added test cases
19
- qcow2: Preallocation fixes (especially for external data files)
19
- docs: Improvements for qemu-storage-daemon documentation
20
- Add linear-buffer-based APIs (as wrappers around qiov-based ones)
20
- parallels: load bitmap extension
21
- Various code cleanups and small corner case fixes
21
- backup-top: Don't crash on post-finalize accesses
22
- iotests improvements
22
23
23
----------------------------------------------------------------
24
----------------------------------------------------------------
24
Alberto Garcia (3):
25
Alberto Garcia (1):
25
qcow2: Fix error handling in the compression code
26
iotests: Drop deprecated 'props' from object-add
26
commit: Make base read-only if there is an early failure
27
iotests: Check that images are in read-only mode after block-commit
28
27
29
Eric Blake (2):
28
Coiby Xu (1):
30
cutils: Fix size_to_str() on 32-bit platforms
29
test: new qTest case to test the vhost-user-blk-server
31
qemu-img: Saner printing of large file sizes
32
30
33
Kevin Wolf (5):
31
Eric Blake (1):
34
block: Fix AioContext switch for bs->drv == NULL
32
iotests: Fix up python style in 300
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
39
33
40
Max Reitz (2):
34
Kevin Wolf (1):
41
iotests: Perform the correct test in 082
35
docs: qsd: Explain --export nbd,name=... default
42
qemu-img: Make create hint at protocol options
43
36
44
Sam Eiderman (1):
37
Max Reitz (3):
45
vmdk: Set vmdk parent backing_format to vmdk
38
backup: Remove nodes from job in .clean()
39
backup-top: Refuse I/O in inactive state
40
iotests/283: Check that finalize drops backup-top
46
41
47
Stefano Garzarella (2):
42
Paolo Bonzini (2):
48
block/vhdx: Remove redundant IEC binary prefixes definition
43
storage-daemon: report unexpected arguments on the fly
49
block/vhdx: Use IEC binary prefixes for size constants
44
storage-daemon: include current command line option in the errors
50
45
51
Thomas Huth (1):
46
Stefan Hajnoczi (14):
52
tests/qemu-iotests: Fix output of qemu-io related tests
47
qemu-storage-daemon: add --pidfile option
48
docs: show how to spawn qemu-storage-daemon with fd passing
49
docs: replace insecure /tmp examples in qsd docs
50
vhost-user-blk: fix blkcfg->num_queues endianness
51
libqtest: add qtest_socket_server()
52
libqtest: add qtest_kill_qemu()
53
libqtest: add qtest_remove_abrt_handler()
54
tests/qtest: add multi-queue test case to vhost-user-blk-test
55
block/export: fix blk_size double byteswap
56
block/export: use VIRTIO_BLK_SECTOR_BITS
57
block/export: fix vhost-user-blk export sector number calculation
58
block/export: port virtio-blk discard/write zeroes input validation
59
vhost-user-blk-test: test discard/write zeroes invalid inputs
60
block/export: port virtio-blk read/write range check
53
61
54
Vladimir Sementsov-Ogievskiy (10):
62
Stefano Garzarella (1):
55
block: introduce byte-based io helpers
63
blockjob: report a better error message
56
block/qcow2: use buffer-based io
57
block/qcow: use buffer-based io
58
block/qed: use buffer-based io
59
block/parallels: use buffer-based io
60
block/backup: use buffer-based io
61
block/commit: use buffer-based io
62
block/stream: use buffer-based io
63
qemu-img: use buffer-based io
64
block/qed: add missed coroutine_fn markers
65
64
66
Zhengui li (1):
65
Vladimir Sementsov-Ogievskiy (7):
67
vpc: unlock Coroutine lock to make IO submit Concurrently
66
qcow2-bitmap: make bytes_covered_by_bitmap_cluster() public
67
parallels.txt: fix bitmap L1 table description
68
block/parallels: BDRVParallelsState: add cluster_size field
69
parallels: support bitmap extension for read-only mode
70
iotests.py: add unarchive_sample_image() helper
71
iotests: add parallels-read-bitmap test
72
MAINTAINERS: update parallels block driver
68
73
69
block/qed.h | 28 ++++---
74
docs/interop/parallels.txt | 28 +-
70
block/vhdx.h | 16 ++--
75
docs/tools/qemu-storage-daemon.rst | 68 +-
71
include/block/block_int.h | 16 ++++
76
block/parallels.h | 7 +-
72
include/sysemu/block-backend.h | 19 +++++
77
include/block/dirty-bitmap.h | 2 +
73
block.c | 12 +--
78
tests/qtest/libqos/libqtest.h | 37 +
74
block/backup.c | 14 ++--
79
tests/qtest/libqos/vhost-user-blk.h | 48 +
75
block/commit.c | 8 +-
80
block/backup-top.c | 10 +
76
block/parallels.c | 14 ++--
81
block/backup.c | 1 +
77
block/qapi.c | 49 +++---------
82
block/dirty-bitmap.c | 13 +
78
block/qcow.c | 19 ++---
83
block/export/vhost-user-blk-server.c | 150 +++-
79
block/qcow2.c | 80 ++++++++++----------
84
block/parallels-ext.c | 300 +++++++
80
block/qed-check.c | 4 +-
85
block/parallels.c | 26 +-
81
block/qed-table.c | 45 ++++++-----
86
block/qcow2-bitmap.c | 16 +-
82
block/qed.c | 11 ++-
87
blockjob.c | 10 +-
83
block/stream.c | 4 +-
88
hw/block/vhost-user-blk.c | 7 +-
84
block/vhdx-log.c | 2 +-
89
storage-daemon/qemu-storage-daemon.c | 56 +-
85
block/vhdx.c | 7 +-
90
tests/qtest/libqos/vhost-user-blk.c | 130 +++
86
block/vmdk.c | 2 +
91
tests/qtest/libqtest.c | 82 +-
87
block/vpc.c | 4 +
92
tests/qtest/vhost-user-blk-test.c | 983 +++++++++++++++++++++
88
qemu-img.c | 26 ++++---
93
tests/qemu-iotests/iotests.py | 10 +
89
util/cutils.c | 2 +-
94
MAINTAINERS | 5 +
90
tests/qemu-iotests/026.out | 168 ++++++++++++++++++++---------------------
95
block/meson.build | 3 +-
91
tests/qemu-iotests/043.out | 6 +-
96
tests/qemu-iotests/087 | 8 +-
92
tests/qemu-iotests/053.out | 2 +-
97
tests/qemu-iotests/184 | 18 +-
93
tests/qemu-iotests/059.out | 10 +--
98
tests/qemu-iotests/218 | 2 +-
94
tests/qemu-iotests/060.out | 16 ++--
99
tests/qemu-iotests/235 | 2 +-
95
tests/qemu-iotests/061.out | 12 +--
100
tests/qemu-iotests/245 | 4 +-
96
tests/qemu-iotests/069.out | 2 +-
101
tests/qemu-iotests/258 | 6 +-
97
tests/qemu-iotests/070.out | 4 +-
102
tests/qemu-iotests/258.out | 4 +-
98
tests/qemu-iotests/075.out | 14 ++--
103
tests/qemu-iotests/283 | 53 ++
99
tests/qemu-iotests/076.out | 6 +-
104
tests/qemu-iotests/283.out | 15 +
100
tests/qemu-iotests/078.out | 12 +--
105
tests/qemu-iotests/295 | 2 +-
101
tests/qemu-iotests/080.out | 40 +++++-----
106
tests/qemu-iotests/296 | 2 +-
102
tests/qemu-iotests/081.out | 2 +-
107
tests/qemu-iotests/300 | 10 +-
103
tests/qemu-iotests/082 | 5 +-
108
.../sample_images/parallels-with-bitmap.bz2 | Bin 0 -> 203 bytes
104
tests/qemu-iotests/082.out | 51 ++++++++-----
109
.../sample_images/parallels-with-bitmap.sh | 51 ++
105
tests/qemu-iotests/084.out | 8 +-
110
tests/qemu-iotests/tests/parallels-read-bitmap | 55 ++
106
tests/qemu-iotests/088.out | 12 +--
111
tests/qemu-iotests/tests/parallels-read-bitmap.out | 6 +
107
tests/qemu-iotests/089.out | 2 +-
112
tests/qtest/libqos/meson.build | 1 +
108
tests/qemu-iotests/095.out | 4 +-
113
tests/qtest/meson.build | 4 +
109
tests/qemu-iotests/103.out | 14 ++--
114
40 files changed, 2098 insertions(+), 137 deletions(-)
110
tests/qemu-iotests/104.out | 6 +-
115
create mode 100644 tests/qtest/libqos/vhost-user-blk.h
111
tests/qemu-iotests/110.out | 6 +-
116
create mode 100644 block/parallels-ext.c
112
tests/qemu-iotests/114.out | 4 +-
117
create mode 100644 tests/qtest/libqos/vhost-user-blk.c
113
tests/qemu-iotests/116.out | 14 ++--
118
create mode 100644 tests/qtest/vhost-user-blk-test.c
114
tests/qemu-iotests/126.out | 4 +-
119
create mode 100644 tests/qemu-iotests/sample_images/parallels-with-bitmap.bz2
115
tests/qemu-iotests/130.out | 10 +--
120
create mode 100755 tests/qemu-iotests/sample_images/parallels-with-bitmap.sh
116
tests/qemu-iotests/131.out | 2 +-
121
create mode 100755 tests/qemu-iotests/tests/parallels-read-bitmap
117
tests/qemu-iotests/133.out | 30 ++++----
122
create mode 100644 tests/qemu-iotests/tests/parallels-read-bitmap.out
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 +++++++++
143
tests/qemu-iotests/group | 1 +
144
75 files changed, 696 insertions(+), 519 deletions(-)
145
create mode 100755 tests/qemu-iotests/249
146
create mode 100644 tests/qemu-iotests/249.out
147
123
124
diff view generated by jsdifflib
New patch
1
1
From: Alberto Garcia <berto@igalia.com>
2
3
Signed-off-by: Alberto Garcia <berto@igalia.com>
4
Message-Id: <20210222115737.2993-1-berto@igalia.com>
5
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
6
---
7
tests/qemu-iotests/087 | 8 ++------
8
tests/qemu-iotests/184 | 18 ++++++------------
9
tests/qemu-iotests/218 | 2 +-
10
tests/qemu-iotests/235 | 2 +-
11
tests/qemu-iotests/245 | 4 ++--
12
tests/qemu-iotests/258 | 6 +++---
13
tests/qemu-iotests/258.out | 4 ++--
14
tests/qemu-iotests/295 | 2 +-
15
tests/qemu-iotests/296 | 2 +-
16
9 files changed, 19 insertions(+), 29 deletions(-)
17
18
diff --git a/tests/qemu-iotests/087 b/tests/qemu-iotests/087
19
index XXXXXXX..XXXXXXX 100755
20
--- a/tests/qemu-iotests/087
21
+++ b/tests/qemu-iotests/087
22
@@ -XXX,XX +XXX,XX @@ run_qemu <<EOF
23
"arguments": {
24
"qom-type": "secret",
25
"id": "sec0",
26
- "props": {
27
- "data": "123456"
28
- }
29
+ "data": "123456"
30
}
31
}
32
{ "execute": "blockdev-add",
33
@@ -XXX,XX +XXX,XX @@ run_qemu <<EOF
34
"arguments": {
35
"qom-type": "secret",
36
"id": "sec0",
37
- "props": {
38
- "data": "123456"
39
- }
40
+ "data": "123456"
41
}
42
}
43
{ "execute": "blockdev-add",
44
diff --git a/tests/qemu-iotests/184 b/tests/qemu-iotests/184
45
index XXXXXXX..XXXXXXX 100755
46
--- a/tests/qemu-iotests/184
47
+++ b/tests/qemu-iotests/184
48
@@ -XXX,XX +XXX,XX @@ run_qemu <<EOF
49
"arguments": {
50
"qom-type": "throttle-group",
51
"id": "group0",
52
- "props": {
53
- "limits" : {
54
- "iops-total": 1000
55
- }
56
+ "limits" : {
57
+ "iops-total": 1000
58
}
59
}
60
}
61
@@ -XXX,XX +XXX,XX @@ run_qemu <<EOF
62
"arguments": {
63
"qom-type": "throttle-group",
64
"id": "group0",
65
- "props" : {
66
- "limits": {
67
- "iops-total": 1000
68
- }
69
+ "limits": {
70
+ "iops-total": 1000
71
}
72
}
73
}
74
@@ -XXX,XX +XXX,XX @@ run_qemu <<EOF
75
"arguments": {
76
"qom-type": "throttle-group",
77
"id": "group0",
78
- "props" : {
79
- "limits": {
80
- "iops-total": 1000
81
- }
82
+ "limits": {
83
+ "iops-total": 1000
84
}
85
}
86
}
87
diff --git a/tests/qemu-iotests/218 b/tests/qemu-iotests/218
88
index XXXXXXX..XXXXXXX 100755
89
--- a/tests/qemu-iotests/218
90
+++ b/tests/qemu-iotests/218
91
@@ -XXX,XX +XXX,XX @@ with iotests.VM() as vm, \
92
vm.launch()
93
94
ret = vm.qmp('object-add', qom_type='throttle-group', id='tg',
95
- props={'x-bps-read': 4096})
96
+ limits={'bps-read': 4096})
97
assert ret['return'] == {}
98
99
ret = vm.qmp('blockdev-add',
100
diff --git a/tests/qemu-iotests/235 b/tests/qemu-iotests/235
101
index XXXXXXX..XXXXXXX 100755
102
--- a/tests/qemu-iotests/235
103
+++ b/tests/qemu-iotests/235
104
@@ -XXX,XX +XXX,XX @@ vm.add_args('-drive', 'id=src,file=' + disk)
105
vm.launch()
106
107
log(vm.qmp('object-add', qom_type='throttle-group', id='tg0',
108
- props={ 'x-bps-total': size }))
109
+ limits={'bps-total': size}))
110
111
log(vm.qmp('blockdev-add',
112
**{ 'node-name': 'target',
113
diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245
114
index XXXXXXX..XXXXXXX 100755
115
--- a/tests/qemu-iotests/245
116
+++ b/tests/qemu-iotests/245
117
@@ -XXX,XX +XXX,XX @@ class TestBlockdevReopen(iotests.QMPTestCase):
118
###### throttle ######
119
######################
120
opts = { 'qom-type': 'throttle-group', 'id': 'group0',
121
- 'props': { 'limits': { 'iops-total': 1000 } } }
122
+ 'limits': { 'iops-total': 1000 } }
123
result = self.vm.qmp('object-add', conv_keys = False, **opts)
124
self.assert_qmp(result, 'return', {})
125
126
opts = { 'qom-type': 'throttle-group', 'id': 'group1',
127
- 'props': { 'limits': { 'iops-total': 2000 } } }
128
+ 'limits': { 'iops-total': 2000 } }
129
result = self.vm.qmp('object-add', conv_keys = False, **opts)
130
self.assert_qmp(result, 'return', {})
131
132
diff --git a/tests/qemu-iotests/258 b/tests/qemu-iotests/258
133
index XXXXXXX..XXXXXXX 100755
134
--- a/tests/qemu-iotests/258
135
+++ b/tests/qemu-iotests/258
136
@@ -XXX,XX +XXX,XX @@ def test_concurrent_finish(write_to_stream_node):
137
vm.qmp_log('object-add',
138
qom_type='throttle-group',
139
id='tg',
140
- props={
141
- 'x-iops-write': 1,
142
- 'x-iops-write-max': 1
143
+ limits={
144
+ 'iops-write': 1,
145
+ 'iops-write-max': 1
146
})
147
148
vm.qmp_log('blockdev-add',
149
diff --git a/tests/qemu-iotests/258.out b/tests/qemu-iotests/258.out
150
index XXXXXXX..XXXXXXX 100644
151
--- a/tests/qemu-iotests/258.out
152
+++ b/tests/qemu-iotests/258.out
153
@@ -XXX,XX +XXX,XX @@ Running tests:
154
155
=== Commit and stream finish concurrently (letting stream write) ===
156
157
-{"execute": "object-add", "arguments": {"id": "tg", "props": {"x-iops-write": 1, "x-iops-write-max": 1}, "qom-type": "throttle-group"}}
158
+{"execute": "object-add", "arguments": {"id": "tg", "limits": {"iops-write": 1, "iops-write-max": 1}, "qom-type": "throttle-group"}}
159
{"return": {}}
160
{"execute": "blockdev-add", "arguments": {"backing": {"backing": {"backing": {"backing": {"driver": "raw", "file": {"driver": "file", "filename": "TEST_DIR/PID-node0.img"}, "node-name": "node0"}, "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/PID-node1.img"}, "node-name": "node1"}, "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/PID-node2.img"}, "node-name": "node2"}, "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/PID-node3.img"}, "node-name": "node3"}, "driver": "IMGFMT", "file": {"driver": "throttle", "file": {"driver": "file", "filename": "TEST_DIR/PID-node4.img"}, "throttle-group": "tg"}, "node-name": "node4"}}
161
{"return": {}}
162
@@ -XXX,XX +XXX,XX @@ Running tests:
163
164
=== Commit and stream finish concurrently (letting commit write) ===
165
166
-{"execute": "object-add", "arguments": {"id": "tg", "props": {"x-iops-write": 1, "x-iops-write-max": 1}, "qom-type": "throttle-group"}}
167
+{"execute": "object-add", "arguments": {"id": "tg", "limits": {"iops-write": 1, "iops-write-max": 1}, "qom-type": "throttle-group"}}
168
{"return": {}}
169
{"execute": "blockdev-add", "arguments": {"backing": {"backing": {"backing": {"backing": {"driver": "raw", "file": {"driver": "throttle", "file": {"driver": "file", "filename": "TEST_DIR/PID-node0.img"}, "throttle-group": "tg"}, "node-name": "node0"}, "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/PID-node1.img"}, "node-name": "node1"}, "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/PID-node2.img"}, "node-name": "node2"}, "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/PID-node3.img"}, "node-name": "node3"}, "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/PID-node4.img"}, "node-name": "node4"}}
170
{"return": {}}
171
diff --git a/tests/qemu-iotests/295 b/tests/qemu-iotests/295
172
index XXXXXXX..XXXXXXX 100755
173
--- a/tests/qemu-iotests/295
174
+++ b/tests/qemu-iotests/295
175
@@ -XXX,XX +XXX,XX @@ class Secret:
176
177
def to_qmp_object(self):
178
return { "qom_type" : "secret", "id": self.id(),
179
- "props": { "data": self.secret() } }
180
+ "data": self.secret() }
181
182
################################################################################
183
class EncryptionSetupTestCase(iotests.QMPTestCase):
184
diff --git a/tests/qemu-iotests/296 b/tests/qemu-iotests/296
185
index XXXXXXX..XXXXXXX 100755
186
--- a/tests/qemu-iotests/296
187
+++ b/tests/qemu-iotests/296
188
@@ -XXX,XX +XXX,XX @@ class Secret:
189
190
def to_qmp_object(self):
191
return { "qom_type" : "secret", "id": self.id(),
192
- "props": { "data": self.secret() } }
193
+ "data": self.secret() }
194
195
################################################################################
196
197
--
198
2.29.2
199
200
diff view generated by jsdifflib
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
1
From: Max Reitz <mreitz@redhat.com>
2
2
3
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
3
The block job holds a reference to the backup-top node (because it is
4
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
4
passed as the main job BDS to block_job_create()). Therefore,
5
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
5
bdrv_backup_top_drop() cannot delete the backup-top node (replacing it
6
by its child does not affect the job parent, because that has
7
.stay_at_node set). That is a problem, because all of its I/O functions
8
assume the BlockCopyState (s->bcs) to be valid and that it has a
9
filtered child; but after bdrv_backup_top_drop(), neither of those
10
things are true.
11
12
It does not make sense to add new parents to backup-top after
13
backup_clean(), so we should detach it from the job before
14
bdrv_backup_top_drop(). Because there is no function to do that for a
15
single node, just detach all of the job's nodes -- the job does not do
16
anything past backup_clean() anyway.
17
18
Signed-off-by: Max Reitz <mreitz@redhat.com>
19
Message-Id: <20210219153348.41861-2-mreitz@redhat.com>
6
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
20
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7
---
21
---
8
block/backup.c | 14 ++++++--------
22
block/backup.c | 1 +
9
1 file changed, 6 insertions(+), 8 deletions(-)
23
1 file changed, 1 insertion(+)
10
24
11
diff --git a/block/backup.c b/block/backup.c
25
diff --git a/block/backup.c b/block/backup.c
12
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
13
--- a/block/backup.c
27
--- a/block/backup.c
14
+++ b/block/backup.c
28
+++ b/block/backup.c
15
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job,
29
@@ -XXX,XX +XXX,XX @@ static void backup_abort(Job *job)
16
void **bounce_buffer)
30
static void backup_clean(Job *job)
17
{
31
{
18
int ret;
32
BackupBlockJob *s = container_of(job, BackupBlockJob, common.job);
19
- QEMUIOVector qiov;
33
+ block_job_remove_all_bdrv(&s->common);
20
BlockBackend *blk = job->common.blk;
34
bdrv_backup_top_drop(s->backup_top);
21
int nbytes;
35
}
22
int read_flags = is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0;
36
23
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job,
24
if (!*bounce_buffer) {
25
*bounce_buffer = blk_blockalign(blk, job->cluster_size);
26
}
27
- qemu_iovec_init_buf(&qiov, *bounce_buffer, nbytes);
28
29
- ret = blk_co_preadv(blk, start, qiov.size, &qiov, read_flags);
30
+ ret = blk_co_pread(blk, start, nbytes, *bounce_buffer, read_flags);
31
if (ret < 0) {
32
trace_backup_do_cow_read_fail(job, start, ret);
33
if (error_is_read) {
34
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job,
35
goto fail;
36
}
37
38
- if (qemu_iovec_is_zero(&qiov)) {
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);
53
--
37
--
54
2.20.1
38
2.29.2
55
39
56
40
diff view generated by jsdifflib
1
From: Max Reitz <mreitz@redhat.com>
1
From: Max Reitz <mreitz@redhat.com>
2
2
3
qemu-img create allows giving just a format and "-o help" to get a list
3
When the backup-top node transitions from active to inactive in
4
of the options supported by that format. Users may not realize that the
4
bdrv_backup_top_drop(), the BlockCopyState is freed and the filtered
5
protocol level may offer even more options, which they only get to see
5
child is removed, so the node effectively becomes unusable.
6
by specifying a filename.
7
6
8
This patch adds a note to hint at that fact.
7
However, noone told its I/O functions this, so they will happily
8
continue accessing bs->backing and s->bcs. Prevent that by aborting
9
early when s->active is false.
10
11
(After the preceding patch, the node should be gone after
12
bdrv_backup_top_drop(), so this should largely be a theoretical problem.
13
But still, better to be safe than sorry, and also I think it just makes
14
sense to check s->active in the I/O functions.)
9
15
10
Signed-off-by: Max Reitz <mreitz@redhat.com>
16
Signed-off-by: Max Reitz <mreitz@redhat.com>
11
Reviewed-by: John Snow <jsnow@redhat.com>
17
Message-Id: <20210219153348.41861-3-mreitz@redhat.com>
12
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
18
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13
---
19
---
14
qemu-img.c | 13 ++++++++++++-
20
block/backup-top.c | 10 ++++++++++
15
tests/qemu-iotests/082.out | 20 ++++++++++++++++----
21
1 file changed, 10 insertions(+)
16
2 files changed, 28 insertions(+), 5 deletions(-)
17
22
18
diff --git a/qemu-img.c b/qemu-img.c
23
diff --git a/block/backup-top.c b/block/backup-top.c
19
index XXXXXXX..XXXXXXX 100644
24
index XXXXXXX..XXXXXXX 100644
20
--- a/qemu-img.c
25
--- a/block/backup-top.c
21
+++ b/qemu-img.c
26
+++ b/block/backup-top.c
22
@@ -XXX,XX +XXX,XX @@ static int print_block_option_help(const char *filename, const char *fmt)
27
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int backup_top_co_preadv(
23
create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
28
BlockDriverState *bs, uint64_t offset, uint64_t bytes,
24
}
29
QEMUIOVector *qiov, int flags)
25
30
{
26
- printf("Supported options:\n");
31
+ BDRVBackupTopState *s = bs->opaque;
27
+ if (filename) {
28
+ printf("Supported options:\n");
29
+ } else {
30
+ printf("Supported %s options:\n", fmt);
31
+ }
32
qemu_opts_print_help(create_opts, false);
33
qemu_opts_free(create_opts);
34
+
32
+
35
+ if (!filename) {
33
+ if (!s->active) {
36
+ printf("\n"
34
+ return -EIO;
37
+ "The protocol level may support further options.\n"
38
+ "Specify the target filename to include those options.\n");
39
+ }
35
+ }
40
+
36
+
41
return 0;
37
return bdrv_co_preadv(bs->backing, offset, bytes, qiov, flags);
42
}
38
}
43
39
44
diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out
40
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int backup_top_cbw(BlockDriverState *bs, uint64_t offset,
45
index XXXXXXX..XXXXXXX 100644
41
BDRVBackupTopState *s = bs->opaque;
46
--- a/tests/qemu-iotests/082.out
42
uint64_t off, end;
47
+++ b/tests/qemu-iotests/082.out
43
48
@@ -XXX,XX +XXX,XX @@ Testing: create -f qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,, -o help TEST_DIR
44
+ if (!s->active) {
49
qemu-img: Invalid option list: ,,
45
+ return -EIO;
50
46
+ }
51
Testing: create -f qcow2 -o help
52
-Supported options:
53
+Supported qcow2 options:
54
backing_file=<str> - File name of a base image
55
backing_fmt=<str> - Image format of the base image
56
cluster_size=<size> - qcow2 cluster size
57
@@ -XXX,XX +XXX,XX @@ Supported options:
58
refcount_bits=<num> - Width of a reference count entry in bits
59
size=<size> - Virtual disk size
60
61
+The protocol level may support further options.
62
+Specify the target filename to include those options.
63
+
47
+
64
Testing: create -o help
48
if (flags & BDRV_REQ_WRITE_UNCHANGED) {
65
-Supported options:
49
return 0;
66
+Supported raw options:
50
}
67
size=<size> - Virtual disk size
68
69
+The protocol level may support further options.
70
+Specify the target filename to include those options.
71
+
72
Testing: create -f bochs -o help
73
qemu-img: Format driver 'bochs' does not support image creation
74
75
@@ -XXX,XX +XXX,XX @@ Testing: convert -O qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,, -o help TEST_DI
76
qemu-img: Invalid option list: ,,
77
78
Testing: convert -O qcow2 -o help
79
-Supported options:
80
+Supported qcow2 options:
81
backing_file=<str> - File name of a base image
82
backing_fmt=<str> - Image format of the base image
83
cluster_size=<size> - qcow2 cluster size
84
@@ -XXX,XX +XXX,XX @@ Supported options:
85
refcount_bits=<num> - Width of a reference count entry in bits
86
size=<size> - Virtual disk size
87
88
+The protocol level may support further options.
89
+Specify the target filename to include those options.
90
+
91
Testing: convert -o help
92
-Supported options:
93
+Supported raw options:
94
size=<size> - Virtual disk size
95
96
+The protocol level may support further options.
97
+Specify the target filename to include those options.
98
+
99
Testing: convert -O bochs -o help
100
qemu-img: Format driver 'bochs' does not support image creation
101
102
--
51
--
103
2.20.1
52
2.29.2
104
53
105
54
diff view generated by jsdifflib
1
From: Max Reitz <mreitz@redhat.com>
1
From: Max Reitz <mreitz@redhat.com>
2
2
3
In the "amend" section of 082, we perform a single "convert" test
3
Without any of HEAD^ or HEAD^^ applied, qemu will most likely crash on
4
(namely "convert -o help"). That does not make sense, especially
4
the qemu-io invocation, for a variety of immediate reasons. The
5
because we have done exactly that "convert" test earlier in 082 already.
5
underlying problem is generally a use-after-free access into
6
backup-top's BlockCopyState.
6
7
7
Replacing "convert" by "amend" yields an error, which is correct because
8
With only HEAD^ applied, qemu-io will run into an EIO (which is not
8
there is no point in "amend" having a default format. The user has to
9
capture by the output, but you can see that the qemu-io invocation will
9
either specify the format, or give a file for qemu-img to probe.
10
be accepted (i.e., qemu-io will run) in contrast to the reference
11
output, where the node name cannot be found), and qemu will then crash
12
in query-named-block-nodes: bdrv_get_allocated_file_size() detects
13
backup-top to be a filter and passes the request through to its child.
14
However, after bdrv_backup_top_drop(), that child is NULL, so the
15
recursive call crashes.
16
17
With HEAD^^ applied, this test should pass.
10
18
11
Signed-off-by: Max Reitz <mreitz@redhat.com>
19
Signed-off-by: Max Reitz <mreitz@redhat.com>
12
Reviewed-by: John Snow <jsnow@redhat.com>
20
Message-Id: <20210219153348.41861-4-mreitz@redhat.com>
13
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
21
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14
---
22
---
15
tests/qemu-iotests/082 | 5 ++++-
23
tests/qemu-iotests/283 | 53 ++++++++++++++++++++++++++++++++++++++
16
tests/qemu-iotests/082.out | 5 ++---
24
tests/qemu-iotests/283.out | 15 +++++++++++
17
2 files changed, 6 insertions(+), 4 deletions(-)
25
2 files changed, 68 insertions(+)
18
26
19
diff --git a/tests/qemu-iotests/082 b/tests/qemu-iotests/082
27
diff --git a/tests/qemu-iotests/283 b/tests/qemu-iotests/283
20
index XXXXXXX..XXXXXXX 100755
28
index XXXXXXX..XXXXXXX 100755
21
--- a/tests/qemu-iotests/082
29
--- a/tests/qemu-iotests/283
22
+++ b/tests/qemu-iotests/082
30
+++ b/tests/qemu-iotests/283
23
@@ -XXX,XX +XXX,XX @@ run_qemu_img amend -f $IMGFMT -o backing_file="$TEST_IMG" -o ,, -o help "$TEST_I
31
@@ -XXX,XX +XXX,XX @@ vm.qmp_log('blockdev-add', **{
24
32
vm.qmp_log('blockdev-backup', sync='full', device='source', target='target')
25
# Leave out everything that isn't needed
33
26
run_qemu_img amend -f $IMGFMT -o help
34
vm.shutdown()
27
-run_qemu_img convert -o help
28
+
35
+
29
+# amend requires specifying either a format explicitly, or a file
36
+
30
+# which it can probe
37
+print('\n=== backup-top should be gone after job-finalize ===\n')
31
+run_qemu_img amend -o help
38
+
32
39
+# Check that the backup-top node is gone after job-finalize.
33
# Try help option for a format that does not support amendment
40
+#
34
run_qemu_img amend -f bochs -o help
41
+# During finalization, the node becomes inactive and can no longer
35
diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out
42
+# function. If it is still present, new parents might be attached, and
43
+# there would be no meaningful way to handle their I/O requests.
44
+
45
+vm = iotests.VM()
46
+vm.launch()
47
+
48
+vm.qmp_log('blockdev-add', **{
49
+ 'node-name': 'source',
50
+ 'driver': 'null-co',
51
+})
52
+
53
+vm.qmp_log('blockdev-add', **{
54
+ 'node-name': 'target',
55
+ 'driver': 'null-co',
56
+})
57
+
58
+vm.qmp_log('blockdev-backup',
59
+ job_id='backup',
60
+ device='source',
61
+ target='target',
62
+ sync='full',
63
+ filter_node_name='backup-filter',
64
+ auto_finalize=False,
65
+ auto_dismiss=False)
66
+
67
+vm.event_wait('BLOCK_JOB_PENDING', 5.0)
68
+
69
+# The backup-top filter should still be present prior to finalization
70
+assert vm.node_info('backup-filter') is not None
71
+
72
+vm.qmp_log('job-finalize', id='backup')
73
+vm.event_wait('BLOCK_JOB_COMPLETED', 5.0)
74
+
75
+# The filter should be gone now. Check that by trying to access it
76
+# with qemu-io (which will most likely crash qemu if it is still
77
+# there.).
78
+vm.qmp_log('human-monitor-command',
79
+ command_line='qemu-io backup-filter "write 0 1M"')
80
+
81
+# (Also, do an explicit check.)
82
+assert vm.node_info('backup-filter') is None
83
+
84
+vm.qmp_log('job-dismiss', id='backup')
85
+vm.event_wait('JOB_STATUS_CHANGE', 5.0, {'data': {'status': 'null'}})
86
+
87
+vm.shutdown()
88
diff --git a/tests/qemu-iotests/283.out b/tests/qemu-iotests/283.out
36
index XXXXXXX..XXXXXXX 100644
89
index XXXXXXX..XXXXXXX 100644
37
--- a/tests/qemu-iotests/082.out
90
--- a/tests/qemu-iotests/283.out
38
+++ b/tests/qemu-iotests/082.out
91
+++ b/tests/qemu-iotests/283.out
39
@@ -XXX,XX +XXX,XX @@ Creation options for 'qcow2':
92
@@ -XXX,XX +XXX,XX @@
40
93
{"return": {}}
41
Note that not all of these options may be amendable.
94
{"execute": "blockdev-backup", "arguments": {"device": "source", "sync": "full", "target": "target"}}
42
95
{"error": {"class": "GenericError", "desc": "Cannot set permissions for backup-top filter: Conflicts with use by other as 'image', which uses 'write' on base"}}
43
-Testing: convert -o help
96
+
44
-Supported options:
97
+=== backup-top should be gone after job-finalize ===
45
- size=<size> - Virtual disk size
98
+
46
+Testing: amend -o help
99
+{"execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "source"}}
47
+qemu-img: Expecting one image file name
100
+{"return": {}}
48
101
+{"execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "target"}}
49
Testing: amend -f bochs -o help
102
+{"return": {}}
50
qemu-img: Format driver 'bochs' does not support option amendment
103
+{"execute": "blockdev-backup", "arguments": {"auto-dismiss": false, "auto-finalize": false, "device": "source", "filter-node-name": "backup-filter", "job-id": "backup", "sync": "full", "target": "target"}}
104
+{"return": {}}
105
+{"execute": "job-finalize", "arguments": {"id": "backup"}}
106
+{"return": {}}
107
+{"execute": "human-monitor-command", "arguments": {"command-line": "qemu-io backup-filter \"write 0 1M\""}}
108
+{"return": "Error: Cannot find device= nor node_name=backup-filter\r\n"}
109
+{"execute": "job-dismiss", "arguments": {"id": "backup"}}
110
+{"return": {}}
51
--
111
--
52
2.20.1
112
2.29.2
53
113
54
114
diff view generated by jsdifflib
1
From: Eric Blake <eblake@redhat.com>
1
From: Eric Blake <eblake@redhat.com>
2
2
3
Disk sizes close to INT64_MAX cause overflow, for some pretty
3
Break some long lines, and relax our type hints to be more generic to
4
ridiculous output:
4
any JSON, in order to more easily permit the additional JSON depth now
5
possible in migration parameters. Detected by iotest 297.
5
6
6
$ ./nbdkit -U - memory size=$((2**63 - 512)) --run 'qemu-img info $nbd'
7
Fixes: ca4bfec41d56
7
image: nbd+unix://?socket=/tmp/nbdkitHSAzNz/socket
8
(qemu-iotests: 300: Add test case for modifying persistence of bitmap)
8
file format: raw
9
Reported-by: Kevin Wolf <kwolf@redhat.com>
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>
10
Signed-off-by: Eric Blake <eblake@redhat.com>
25
Tested-by: Richard W.M. Jones <rjones@redhat.com>
11
Message-Id: <20210215220518.1745469-1-eblake@redhat.com>
26
Reviewed-by: Alberto Garcia <berto@igalia.com>
12
Reviewed-by: John Snow <jsnow@redhat.com>
27
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
13
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
28
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
29
Tested-by: Max Reitz <mreitz@redhat.com>
30
---
15
---
31
block/qapi.c | 49 +++++++++-----------------------------
16
tests/qemu-iotests/300 | 10 ++++++----
32
tests/qemu-iotests/043.out | 6 ++---
17
1 file changed, 6 insertions(+), 4 deletions(-)
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(-)
61
18
62
diff --git a/block/qapi.c b/block/qapi.c
19
diff --git a/tests/qemu-iotests/300 b/tests/qemu-iotests/300
63
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100755
64
--- a/block/qapi.c
21
--- a/tests/qemu-iotests/300
65
+++ b/block/qapi.c
22
+++ b/tests/qemu-iotests/300
66
@@ -XXX,XX +XXX,XX @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
67
return head;
68
}
69
70
-#define NB_SUFFIXES 4
71
-
72
-static char *get_human_readable_size(char *buf, int buf_size, int64_t size)
73
-{
74
- static const char suffixes[NB_SUFFIXES] = {'K', 'M', 'G', 'T'};
75
- int64_t base;
76
- int i;
77
-
78
- if (size <= 999) {
79
- snprintf(buf, buf_size, "%" PRId64, size);
80
- } else {
81
- base = 1024;
82
- for (i = 0; i < NB_SUFFIXES; i++) {
83
- if (size < (10 * base)) {
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;
98
-}
99
-
100
void bdrv_snapshot_dump(QEMUSnapshotInfo *sn)
101
{
102
- char buf1[128], date_buf[128], clock_buf[128];
103
+ char date_buf[128], clock_buf[128];
104
struct tm tm;
105
time_t ti;
106
int64_t secs;
107
+ char *sizing = NULL;
108
109
if (!sn) {
110
qemu_printf("%-10s%-20s%7s%20s%15s",
111
@@ -XXX,XX +XXX,XX @@ void bdrv_snapshot_dump(QEMUSnapshotInfo *sn)
112
(int)((secs / 60) % 60),
113
(int)(secs % 60),
114
(int)((sn->vm_clock_nsec / 1000000) % 1000));
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);
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 @@
23
@@ -XXX,XX +XXX,XX @@
756
24
import os
757
image: TEST_IMG
25
import random
758
file format: IMGFMT
26
import re
759
-virtual size: 128M (134217728 bytes)
27
-from typing import Dict, List, Optional, Union
760
+virtual size: 128 MiB (134217728 bytes)
28
+from typing import Dict, List, Optional
761
cluster_size: 65536
29
762
Format specific information:
30
import iotests
763
compat: 1.1
31
764
@@ -XXX,XX +XXX,XX @@ Format specific information:
32
@@ -XXX,XX +XXX,XX @@ import iotests
765
33
# pylint: disable=wrong-import-order
766
image: TEST_IMG
34
import qemu
767
file format: IMGFMT
35
768
-virtual size: 64M (67108864 bytes)
36
-BlockBitmapMapping = List[Dict[str, Union[str, List[Dict[str, str]]]]]
769
+virtual size: 64 MiB (67108864 bytes)
37
+BlockBitmapMapping = List[Dict[str, object]]
770
cluster_size: 65536
38
771
Format specific information:
39
mig_sock = os.path.join(iotests.sock_dir, 'mig_sock')
772
compat: 1.1
40
773
@@ -XXX,XX +XXX,XX @@ Format specific information:
41
@@ -XXX,XX +XXX,XX @@ class TestCrossAliasMigration(TestDirtyBitmapMigration):
774
42
775
image: TEST_IMG
43
class TestAliasTransformMigration(TestDirtyBitmapMigration):
776
file format: IMGFMT
44
"""
777
-virtual size: 32M (33554432 bytes)
45
- Tests the 'transform' option which modifies bitmap persistence on migration.
778
+virtual size: 32 MiB (33554432 bytes)
46
+ Tests the 'transform' option which modifies bitmap persistence on
779
cluster_size: 2097152
47
+ migration.
780
Format specific information:
48
"""
781
compat: 1.1
49
782
@@ -XXX,XX +XXX,XX @@ Format specific information:
50
src_node_name = 'node-a'
783
51
@@ -XXX,XX +XXX,XX @@ class TestAliasTransformMigration(TestDirtyBitmapMigration):
784
image: TEST_IMG
52
bitmaps = self.vm_b.query_bitmaps()
785
file format: IMGFMT
53
786
-virtual size: 32M (33554432 bytes)
54
for node in bitmaps:
787
+virtual size: 32 MiB (33554432 bytes)
55
- bitmaps[node] = sorted(((bmap['name'], bmap['persistent']) for bmap in bitmaps[node]))
788
cluster_size: 512
56
+ bitmaps[node] = sorted(((bmap['name'], bmap['persistent'])
789
backing file: TEST_IMG.base
57
+ for bmap in bitmaps[node]))
790
backing file format: IMGFMT
58
791
@@ -XXX,XX +XXX,XX @@ Format specific information:
59
self.assertEqual(bitmaps,
792
60
{'node-a': [('bmap-a', True), ('bmap-b', False)],
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
1212
--
61
--
1213
2.20.1
62
2.29.2
1214
63
1215
64
diff view generated by jsdifflib
1
From: Stefano Garzarella <sgarzare@redhat.com>
1
From: Stefano Garzarella <sgarzare@redhat.com>
2
2
3
IEC binary prefixes are already defined in "qemu/units.h",
3
When a block job fails, we report strerror(-job->job.ret) error
4
so we can remove redundant definitions in "block/vhdx.h".
4
message, also if the job set an error object.
5
Let's report a better error message using error_get_pretty(job->job.err).
5
6
7
If an error object was not set, strerror(-job->ret) is used as fallback,
8
as explained in include/qemu/job.h:
9
10
typedef struct Job {
11
...
12
/**
13
* Error object for a failed job.
14
* If job->ret is nonzero and an error object was not set, it will be set
15
* to strerror(-job->ret) during job_completed.
16
*/
17
Error *err;
18
}
19
20
In block_job_query() there can be a transient where 'job.err' is not set
21
by a scheduled bottom half. In that case we use strerror(-job->ret) as it
22
was before.
23
24
Suggested-by: Kevin Wolf <kwolf@redhat.com>
6
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
25
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
26
Message-Id: <20210225103633.76746-1-sgarzare@redhat.com>
8
Reviewed-by: John Snow <jsnow@redhat.com>
9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
27
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10
---
28
---
11
block/vhdx.h | 6 +-----
29
blockjob.c | 10 +++++++---
12
block/vhdx.c | 3 ++-
30
1 file changed, 7 insertions(+), 3 deletions(-)
13
2 files changed, 3 insertions(+), 6 deletions(-)
14
31
15
diff --git a/block/vhdx.h b/block/vhdx.h
32
diff --git a/blockjob.c b/blockjob.c
16
index XXXXXXX..XXXXXXX 100644
33
index XXXXXXX..XXXXXXX 100644
17
--- a/block/vhdx.h
34
--- a/blockjob.c
18
+++ b/block/vhdx.h
35
+++ b/blockjob.c
19
@@ -XXX,XX +XXX,XX @@
36
@@ -XXX,XX +XXX,XX @@ BlockJobInfo *block_job_query(BlockJob *job, Error **errp)
20
37
info->status = job->job.status;
21
#ifndef BLOCK_VHDX_H
38
info->auto_finalize = job->job.auto_finalize;
22
#define BLOCK_VHDX_H
39
info->auto_dismiss = job->job.auto_dismiss;
23
-
40
- info->has_error = job->job.ret != 0;
24
-#define KiB (1 * 1024)
41
- info->error = job->job.ret ? g_strdup(strerror(-job->job.ret)) : NULL;
25
-#define MiB (KiB * 1024)
42
+ if (job->job.ret) {
26
-#define GiB (MiB * 1024)
43
+ info->has_error = true;
27
-#define TiB ((uint64_t) GiB * 1024)
44
+ info->error = job->job.err ?
28
+#include "qemu/units.h"
45
+ g_strdup(error_get_pretty(job->job.err)) :
29
46
+ g_strdup(strerror(-job->job.ret));
30
#define DEFAULT_LOG_SIZE 1048576 /* 1MiB */
47
+ }
31
/* Structures and fields present in the VHDX file */
48
return info;
32
diff --git a/block/vhdx.c b/block/vhdx.c
49
}
33
index XXXXXXX..XXXXXXX 100644
50
34
--- a/block/vhdx.c
51
@@ -XXX,XX +XXX,XX @@ static void block_job_event_completed(Notifier *n, void *opaque)
35
+++ b/block/vhdx.c
36
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn vhdx_co_create(BlockdevCreateOptions *opts,
37
return -EINVAL;
38
}
52
}
39
if (block_size > VHDX_BLOCK_SIZE_MAX) {
53
40
- error_setg(errp, "Block size must not exceed %d", VHDX_BLOCK_SIZE_MAX);
54
if (job->job.ret < 0) {
41
+ error_setg(errp, "Block size must not exceed %" PRId64,
55
- msg = strerror(-job->job.ret);
42
+ VHDX_BLOCK_SIZE_MAX);
56
+ msg = error_get_pretty(job->job.err);
43
return -EINVAL;
44
}
57
}
45
58
59
qapi_event_send_block_job_completed(job_type(&job->job),
46
--
60
--
47
2.20.1
61
2.29.2
48
62
49
63
diff view generated by jsdifflib
New patch
1
From: Paolo Bonzini <pbonzini@redhat.com>
1
2
3
If the first character of optstring is '-', then each nonoption argv
4
element is handled as if it were the argument of an option with character
5
code 1. This removes the reordering of the argv array, and enables usage
6
of loc_set_cmdline to provide better error messages.
7
8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9
Message-Id: <20210301152844.291799-2-pbonzini@redhat.com>
10
Reviewed-by: Eric Blake <eblake@redhat.com>
11
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12
---
13
storage-daemon/qemu-storage-daemon.c | 9 ++++-----
14
1 file changed, 4 insertions(+), 5 deletions(-)
15
16
diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-storage-daemon.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/storage-daemon/qemu-storage-daemon.c
19
+++ b/storage-daemon/qemu-storage-daemon.c
20
@@ -XXX,XX +XXX,XX @@ static void process_options(int argc, char *argv[])
21
* they are given on the command lines. This means that things must be
22
* defined first before they can be referenced in another option.
23
*/
24
- while ((c = getopt_long(argc, argv, "hT:V", long_options, NULL)) != -1) {
25
+ while ((c = getopt_long(argc, argv, "-hT:V", long_options, NULL)) != -1) {
26
switch (c) {
27
case '?':
28
exit(EXIT_FAILURE);
29
@@ -XXX,XX +XXX,XX @@ static void process_options(int argc, char *argv[])
30
qobject_unref(args);
31
break;
32
}
33
+ case 1:
34
+ error_report("Unexpected argument: %s", optarg);
35
+ exit(EXIT_FAILURE);
36
default:
37
g_assert_not_reached();
38
}
39
}
40
- if (optind != argc) {
41
- error_report("Unexpected argument: %s", argv[optind]);
42
- exit(EXIT_FAILURE);
43
- }
44
}
45
46
int main(int argc, char *argv[])
47
--
48
2.29.2
49
50
diff view generated by jsdifflib
New patch
1
From: Paolo Bonzini <pbonzini@redhat.com>
1
2
3
Use the location management facilities that the emulator uses, so that
4
the current command line option appears in the error message.
5
6
Before:
7
8
$ storage-daemon/qemu-storage-daemon --nbd key..=
9
qemu-storage-daemon: Invalid parameter 'key..'
10
11
After:
12
13
$ storage-daemon/qemu-storage-daemon --nbd key..=
14
qemu-storage-daemon: --nbd key..=: Invalid parameter 'key..'
15
16
Reviewed-by: Eric Blake <eblake@redhat.com>
17
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
18
Message-Id: <20210301152844.291799-3-pbonzini@redhat.com>
19
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
20
---
21
storage-daemon/qemu-storage-daemon.c | 19 +++++++++++++++++--
22
1 file changed, 17 insertions(+), 2 deletions(-)
23
24
diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-storage-daemon.c
25
index XXXXXXX..XXXXXXX 100644
26
--- a/storage-daemon/qemu-storage-daemon.c
27
+++ b/storage-daemon/qemu-storage-daemon.c
28
@@ -XXX,XX +XXX,XX @@ static void init_qmp_commands(void)
29
qmp_marshal_qmp_capabilities, QCO_ALLOW_PRECONFIG);
30
}
31
32
+static int getopt_set_loc(int argc, char **argv, const char *optstring,
33
+ const struct option *longopts)
34
+{
35
+ int c, save_index;
36
+
37
+ optarg = NULL;
38
+ save_index = optind;
39
+ c = getopt_long(argc, argv, optstring, longopts, NULL);
40
+ if (optarg) {
41
+ loc_set_cmdline(argv, save_index, MAX(1, optind - save_index));
42
+ }
43
+ return c;
44
+}
45
+
46
static void process_options(int argc, char *argv[])
47
{
48
int c;
49
@@ -XXX,XX +XXX,XX @@ static void process_options(int argc, char *argv[])
50
* they are given on the command lines. This means that things must be
51
* defined first before they can be referenced in another option.
52
*/
53
- while ((c = getopt_long(argc, argv, "-hT:V", long_options, NULL)) != -1) {
54
+ while ((c = getopt_set_loc(argc, argv, "-hT:V", long_options)) != -1) {
55
switch (c) {
56
case '?':
57
exit(EXIT_FAILURE);
58
@@ -XXX,XX +XXX,XX @@ static void process_options(int argc, char *argv[])
59
break;
60
}
61
case 1:
62
- error_report("Unexpected argument: %s", optarg);
63
+ error_report("Unexpected argument");
64
exit(EXIT_FAILURE);
65
default:
66
g_assert_not_reached();
67
}
68
}
69
+ loc_set_none();
70
}
71
72
int main(int argc, char *argv[])
73
--
74
2.29.2
75
76
diff view generated by jsdifflib
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
1
From: Stefan Hajnoczi <stefanha@redhat.com>
2
2
3
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
3
Daemons often have a --pidfile option where the pid is written to a file
4
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
4
so that scripts can stop the daemon by sending a signal.
5
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
5
6
The pid file also acts as a lock to prevent multiple instances of the
7
daemon from launching for a given pid file.
8
9
QEMU, qemu-nbd, qemu-ga, virtiofsd, and qemu-pr-helper all support the
10
--pidfile option. Add it to qemu-storage-daemon too.
11
12
Reported-by: Richard W.M. Jones <rjones@redhat.com>
13
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
14
Message-Id: <20210302142746.170535-1-stefanha@redhat.com>
15
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
6
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
16
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7
---
17
---
8
block/qcow.c | 19 ++++++-------------
18
docs/tools/qemu-storage-daemon.rst | 14 +++++++++++
9
1 file changed, 6 insertions(+), 13 deletions(-)
19
storage-daemon/qemu-storage-daemon.c | 36 ++++++++++++++++++++++++++++
20
2 files changed, 50 insertions(+)
10
21
11
diff --git a/block/qcow.c b/block/qcow.c
22
diff --git a/docs/tools/qemu-storage-daemon.rst b/docs/tools/qemu-storage-daemon.rst
12
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
13
--- a/block/qcow.c
24
--- a/docs/tools/qemu-storage-daemon.rst
14
+++ b/block/qcow.c
25
+++ b/docs/tools/qemu-storage-daemon.rst
15
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_preadv(BlockDriverState *bs, uint64_t offset,
26
@@ -XXX,XX +XXX,XX @@ Standard options:
16
int offset_in_cluster;
27
List object properties with ``<type>,help``. See the :manpage:`qemu(1)`
17
int ret = 0, n;
28
manual page for a description of the object properties.
18
uint64_t cluster_offset;
29
19
- QEMUIOVector hd_qiov;
30
+.. option:: --pidfile PATH
20
uint8_t *buf;
31
+
21
void *orig_buf;
32
+ is the path to a file where the daemon writes its pid. This allows scripts to
22
33
+ stop the daemon by sending a signal::
23
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_preadv(BlockDriverState *bs, uint64_t offset,
34
+
24
if (!cluster_offset) {
35
+ $ kill -SIGTERM $(<path/to/qsd.pid)
25
if (bs->backing) {
36
+
26
/* read from the base image */
37
+ A file lock is applied to the file so only one instance of the daemon can run
27
- qemu_iovec_init_buf(&hd_qiov, buf, n);
38
+ with a given pid file path. The daemon unlinks its pid file when terminating.
28
qemu_co_mutex_unlock(&s->lock);
39
+
29
/* qcow2 emits this on bs->file instead of bs->backing */
40
+ The pid file is written after chardevs, exports, and NBD servers have been
30
BLKDBG_EVENT(bs->file, BLKDBG_READ_BACKING_AIO);
41
+ created but before accepting connections. The daemon has started successfully
31
- ret = bdrv_co_preadv(bs->backing, offset, n, &hd_qiov, 0);
42
+ when the pid file is written and clients may begin connecting.
32
+ ret = bdrv_co_pread(bs->backing, offset, n, buf, 0);
43
+
33
qemu_co_mutex_lock(&s->lock);
44
Examples
34
if (ret < 0) {
45
--------
35
break;
46
Launch the daemon with QMP monitor socket ``qmp.sock`` so clients can execute
36
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_preadv(BlockDriverState *bs, uint64_t offset,
47
diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-storage-daemon.c
37
ret = -EIO;
48
index XXXXXXX..XXXXXXX 100644
49
--- a/storage-daemon/qemu-storage-daemon.c
50
+++ b/storage-daemon/qemu-storage-daemon.c
51
@@ -XXX,XX +XXX,XX @@
52
#include "sysemu/runstate.h"
53
#include "trace/control.h"
54
55
+static const char *pid_file;
56
static volatile bool exit_requested = false;
57
58
void qemu_system_killed(int signal, pid_t pid)
59
@@ -XXX,XX +XXX,XX @@ static void help(void)
60
" See the qemu(1) man page for documentation of the\n"
61
" objects that can be added.\n"
62
"\n"
63
+" --pidfile <path> write process ID to a file after startup\n"
64
+"\n"
65
QEMU_HELP_BOTTOM "\n",
66
error_get_progname());
67
}
68
@@ -XXX,XX +XXX,XX @@ enum {
69
OPTION_MONITOR,
70
OPTION_NBD_SERVER,
71
OPTION_OBJECT,
72
+ OPTION_PIDFILE,
73
};
74
75
extern QemuOptsList qemu_chardev_opts;
76
@@ -XXX,XX +XXX,XX @@ static void process_options(int argc, char *argv[])
77
{"monitor", required_argument, NULL, OPTION_MONITOR},
78
{"nbd-server", required_argument, NULL, OPTION_NBD_SERVER},
79
{"object", required_argument, NULL, OPTION_OBJECT},
80
+ {"pidfile", required_argument, NULL, OPTION_PIDFILE},
81
{"trace", required_argument, NULL, 'T'},
82
{"version", no_argument, NULL, 'V'},
83
{0, 0, 0, 0}
84
@@ -XXX,XX +XXX,XX @@ static void process_options(int argc, char *argv[])
85
qobject_unref(args);
38
break;
86
break;
39
}
87
}
40
- qemu_iovec_init_buf(&hd_qiov, buf, n);
88
+ case OPTION_PIDFILE:
41
qemu_co_mutex_unlock(&s->lock);
89
+ pid_file = optarg;
42
BLKDBG_EVENT(bs->file, BLKDBG_READ_AIO);
90
+ break;
43
- ret = bdrv_co_preadv(bs->file, cluster_offset + offset_in_cluster,
91
case 1:
44
- n, &hd_qiov, 0);
92
error_report("Unexpected argument");
45
+ ret = bdrv_co_pread(bs->file, cluster_offset + offset_in_cluster,
93
exit(EXIT_FAILURE);
46
+ n, buf, 0);
94
@@ -XXX,XX +XXX,XX @@ static void process_options(int argc, char *argv[])
47
qemu_co_mutex_lock(&s->lock);
95
loc_set_none();
48
if (ret < 0) {
96
}
49
break;
97
50
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_pwritev(BlockDriverState *bs, uint64_t offset,
98
+static void pid_file_cleanup(void)
51
int offset_in_cluster;
99
+{
52
uint64_t cluster_offset;
100
+ unlink(pid_file);
53
int ret = 0, n;
101
+}
54
- QEMUIOVector hd_qiov;
102
+
55
uint8_t *buf;
103
+static void pid_file_init(void)
56
void *orig_buf;
104
+{
57
105
+ Error *err = NULL;
58
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_pwritev(BlockDriverState *bs, uint64_t offset,
106
+
59
}
107
+ if (!pid_file) {
60
}
108
+ return;
61
109
+ }
62
- qemu_iovec_init_buf(&hd_qiov, buf, n);
110
+
63
qemu_co_mutex_unlock(&s->lock);
111
+ if (!qemu_write_pidfile(pid_file, &err)) {
64
BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO);
112
+ error_reportf_err(err, "cannot create PID file: ");
65
- ret = bdrv_co_pwritev(bs->file, cluster_offset + offset_in_cluster,
113
+ exit(EXIT_FAILURE);
66
- n, &hd_qiov, 0);
114
+ }
67
+ ret = bdrv_co_pwrite(bs->file, cluster_offset + offset_in_cluster,
115
+
68
+ n, buf, 0);
116
+ atexit(pid_file_cleanup);
69
qemu_co_mutex_lock(&s->lock);
117
+}
70
if (ret < 0) {
118
+
71
break;
119
int main(int argc, char *argv[])
72
@@ -XXX,XX +XXX,XX @@ qcow_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset,
73
uint64_t bytes, QEMUIOVector *qiov)
74
{
120
{
75
BDRVQcowState *s = bs->opaque;
121
#ifdef CONFIG_POSIX
76
- QEMUIOVector hd_qiov;
122
@@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[])
77
z_stream strm;
123
qemu_init_main_loop(&error_fatal);
78
int ret, out_len;
124
process_options(argc, argv);
79
uint8_t *buf, *out_buf;
125
80
@@ -XXX,XX +XXX,XX @@ qcow_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset,
126
+ /*
81
}
127
+ * Write the pid file after creating chardevs, exports, and NBD servers but
82
cluster_offset &= s->cluster_offset_mask;
128
+ * before accepting connections. This ordering is documented. Do not change
83
129
+ * it.
84
- qemu_iovec_init_buf(&hd_qiov, out_buf, out_len);
130
+ */
85
BLKDBG_EVENT(bs->file, BLKDBG_WRITE_COMPRESSED);
131
+ pid_file_init();
86
- ret = bdrv_co_pwritev(bs->file, cluster_offset, out_len, &hd_qiov, 0);
132
+
87
+ ret = bdrv_co_pwrite(bs->file, cluster_offset, out_len, out_buf, 0);
133
while (!exit_requested) {
88
if (ret < 0) {
134
main_loop_wait(false);
89
goto fail;
90
}
135
}
91
--
136
--
92
2.20.1
137
2.29.2
93
138
94
139
diff view generated by jsdifflib
New patch
1
From: Stefan Hajnoczi <stefanha@redhat.com>
1
2
3
The QMP monitor, NBD server, and vhost-user-blk export all support file
4
descriptor passing. This is a useful technique because it allows the
5
parent process to spawn and wait for qemu-storage-daemon without busy
6
waiting, which may delay startup due to arbitrary sleep() calls.
7
8
This Python example is inspired by the test case written for libnbd by
9
Richard W.M. Jones <rjones@redhat.com>:
10
https://gitlab.com/nbdkit/libnbd/-/commit/89113f484effb0e6c322314ba75c1cbe07a04543
11
12
Thanks to Daniel P. Berrangé <berrange@redhat.com> for suggestions on
13
how to get this working. Now let's document it!
14
15
Reported-by: Richard W.M. Jones <rjones@redhat.com>
16
Cc: Kevin Wolf <kwolf@redhat.com>
17
Cc: Daniel P. Berrangé <berrange@redhat.com>
18
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
19
Message-Id: <20210301172728.135331-2-stefanha@redhat.com>
20
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
21
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
22
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
23
---
24
docs/tools/qemu-storage-daemon.rst | 42 ++++++++++++++++++++++++++++--
25
1 file changed, 40 insertions(+), 2 deletions(-)
26
27
diff --git a/docs/tools/qemu-storage-daemon.rst b/docs/tools/qemu-storage-daemon.rst
28
index XXXXXXX..XXXXXXX 100644
29
--- a/docs/tools/qemu-storage-daemon.rst
30
+++ b/docs/tools/qemu-storage-daemon.rst
31
@@ -XXX,XX +XXX,XX @@ Standard options:
32
33
.. option:: --nbd-server addr.type=inet,addr.host=<host>,addr.port=<port>[,tls-creds=<id>][,tls-authz=<id>][,max-connections=<n>]
34
--nbd-server addr.type=unix,addr.path=<path>[,tls-creds=<id>][,tls-authz=<id>][,max-connections=<n>]
35
+ --nbd-server addr.type=fd,addr.str=<fd>[,tls-creds=<id>][,tls-authz=<id>][,max-connections=<n>]
36
37
is a server for NBD exports. Both TCP and UNIX domain sockets are supported.
38
- TLS encryption can be configured using ``--object`` tls-creds-* and authz-*
39
- secrets (see below).
40
+ A listen socket can be provided via file descriptor passing (see Examples
41
+ below). TLS encryption can be configured using ``--object`` tls-creds-* and
42
+ authz-* secrets (see below).
43
44
To configure an NBD server on UNIX domain socket path ``/tmp/nbd.sock``::
45
46
@@ -XXX,XX +XXX,XX @@ QMP commands::
47
--chardev socket,path=qmp.sock,server=on,wait=off,id=char1 \
48
--monitor chardev=char1
49
50
+Launch the daemon from Python with a QMP monitor socket using file descriptor
51
+passing so there is no need to busy wait for the QMP monitor to become
52
+available::
53
+
54
+ #!/usr/bin/env python3
55
+ import subprocess
56
+ import socket
57
+
58
+ sock_path = '/var/run/qmp.sock'
59
+
60
+ with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as listen_sock:
61
+ listen_sock.bind(sock_path)
62
+ listen_sock.listen()
63
+
64
+ fd = listen_sock.fileno()
65
+
66
+ subprocess.Popen(
67
+ ['qemu-storage-daemon',
68
+ '--chardev', f'socket,fd={fd},server=on,id=char1',
69
+ '--monitor', 'chardev=char1'],
70
+ pass_fds=[fd],
71
+ )
72
+
73
+ # listen_sock was automatically closed when leaving the 'with' statement
74
+ # body. If the daemon process terminated early then the following connect()
75
+ # will fail with "Connection refused" because no process has the listen
76
+ # socket open anymore. Launch errors can be detected this way.
77
+
78
+ qmp_sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
79
+ qmp_sock.connect(sock_path)
80
+ ...QMP interaction...
81
+
82
+The same socket spawning approach also works with the ``--nbd-server
83
+addr.type=fd,addr.str=<fd>`` and ``--export
84
+type=vhost-user-blk,addr.type=fd,addr.str=<fd>`` options.
85
+
86
Export raw image file ``disk.img`` over NBD UNIX domain socket ``nbd.sock``::
87
88
$ qemu-storage-daemon \
89
--
90
2.29.2
91
92
diff view generated by jsdifflib
1
From: Stefano Garzarella <sgarzare@redhat.com>
1
From: Stefan Hajnoczi <stefanha@redhat.com>
2
2
3
Using IEC binary prefixes in order to make the code more readable,
3
World-writeable directories have security issues. Avoid showing them in
4
with the exception of DEFAULT_LOG_SIZE because it's passed to
4
the documentation since someone might accidentally use them in
5
stringify().
5
situations where they are insecure.
6
6
7
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
7
There tend to be 3 security problems:
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
1. Denial of service. An adversary may be able to create the file
9
Reviewed-by: John Snow <jsnow@redhat.com>
9
beforehand, consume all space/inodes, etc to sabotage us.
10
2. Impersonation. An adversary may be able to create a listen socket and
11
accept incoming connections that were meant for us.
12
3. Unauthenticated client access. An adversary may be able to connect to
13
us if we did not set the uid/gid and permissions correctly.
14
15
These can be prevented or mitigated with private /tmp, carefully setting
16
the umask, etc but that requires special action and does not apply to
17
all situations. Just avoid using /tmp in examples.
18
19
Reported-by: Richard W.M. Jones <rjones@redhat.com>
20
Reported-by: Daniel P. Berrangé <berrange@redhat.com>
21
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
22
Message-Id: <20210301172728.135331-3-stefanha@redhat.com>
23
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
24
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
10
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
25
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11
---
26
---
12
block/vhdx.h | 10 ++++++----
27
docs/tools/qemu-storage-daemon.rst | 7 ++++---
13
block/vhdx-log.c | 2 +-
28
1 file changed, 4 insertions(+), 3 deletions(-)
14
block/vhdx.c | 4 ++--
15
3 files changed, 9 insertions(+), 7 deletions(-)
16
29
17
diff --git a/block/vhdx.h b/block/vhdx.h
30
diff --git a/docs/tools/qemu-storage-daemon.rst b/docs/tools/qemu-storage-daemon.rst
18
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
19
--- a/block/vhdx.h
32
--- a/docs/tools/qemu-storage-daemon.rst
20
+++ b/block/vhdx.h
33
+++ b/docs/tools/qemu-storage-daemon.rst
21
@@ -XXX,XX +XXX,XX @@
34
@@ -XXX,XX +XXX,XX @@ Standard options:
22
#include "qemu/units.h"
35
a description of character device properties. A common character device
23
36
definition configures a UNIX domain socket::
24
#define DEFAULT_LOG_SIZE 1048576 /* 1MiB */
37
25
+/* Note: can't use 1 * MiB, because it's passed to stringify() */
38
- --chardev socket,id=char1,path=/tmp/qmp.sock,server=on,wait=off
26
+
39
+ --chardev socket,id=char1,path=/var/run/qsd-qmp.sock,server=on,wait=off
27
/* Structures and fields present in the VHDX file */
40
28
41
.. option:: --export [type=]nbd,id=<id>,node-name=<node-name>[,name=<export-name>][,writable=on|off][,bitmap=<name>]
29
/* The header section has the following blocks,
42
--export [type=]vhost-user-blk,id=<id>,node-name=<node-name>,addr.type=unix,addr.path=<socket-path>[,writable=on|off][,logical-block-size=<block-size>][,num-queues=<num-queues>]
30
@@ -XXX,XX +XXX,XX @@
43
@@ -XXX,XX +XXX,XX @@ Standard options:
31
* 0.........64KB...........128KB........192KB..........256KB................1MB
44
below). TLS encryption can be configured using ``--object`` tls-creds-* and
32
*/
45
authz-* secrets (see below).
33
46
34
-#define VHDX_HEADER_BLOCK_SIZE (64 * 1024)
47
- To configure an NBD server on UNIX domain socket path ``/tmp/nbd.sock``::
35
+#define VHDX_HEADER_BLOCK_SIZE (64 * KiB)
48
+ To configure an NBD server on UNIX domain socket path
36
49
+ ``/var/run/qsd-nbd.sock``::
37
#define VHDX_FILE_ID_OFFSET 0
50
38
#define VHDX_HEADER1_OFFSET (VHDX_HEADER_BLOCK_SIZE * 1)
51
- --nbd-server addr.type=unix,addr.path=/tmp/nbd.sock
39
@@ -XXX,XX +XXX,XX @@ typedef struct QEMU_PACKED MSGUID {
52
+ --nbd-server addr.type=unix,addr.path=/var/run/qsd-nbd.sock
40
#define guid_eq(a, b) \
53
41
(memcmp(&(a), &(b), sizeof(MSGUID)) == 0)
54
.. option:: --object help
42
55
--object <type>,help
43
-#define VHDX_HEADER_SIZE (4 * 1024) /* although the vhdx_header struct in disk
44
+#define VHDX_HEADER_SIZE (4 * KiB) /* although the vhdx_header struct in disk
45
is only 582 bytes, for purposes of crc
46
the header is the first 4KB of the 64KB
47
block */
48
@@ -XXX,XX +XXX,XX @@ typedef struct QEMU_PACKED VHDXRegionTableEntry {
49
50
51
/* ---- LOG ENTRY STRUCTURES ---- */
52
-#define VHDX_LOG_MIN_SIZE (1024 * 1024)
53
-#define VHDX_LOG_SECTOR_SIZE 4096
54
+#define VHDX_LOG_MIN_SIZE (1 * MiB)
55
+#define VHDX_LOG_SECTOR_SIZE (4 * KiB)
56
#define VHDX_LOG_HDR_SIZE 64
57
#define VHDX_LOG_SIGNATURE 0x65676f6c
58
typedef struct QEMU_PACKED VHDXLogEntryHeader {
59
diff --git a/block/vhdx-log.c b/block/vhdx-log.c
60
index XXXXXXX..XXXXXXX 100644
61
--- a/block/vhdx-log.c
62
+++ b/block/vhdx-log.c
63
@@ -XXX,XX +XXX,XX @@ static int vhdx_log_flush(BlockDriverState *bs, BDRVVHDXState *s,
64
}
65
if (file_length < desc_entries->hdr.last_file_offset) {
66
new_file_size = desc_entries->hdr.last_file_offset;
67
- if (new_file_size % (1024*1024)) {
68
+ if (new_file_size % (1 * MiB)) {
69
/* round up to nearest 1MB boundary */
70
new_file_size = QEMU_ALIGN_UP(new_file_size, MiB);
71
if (new_file_size > INT64_MAX) {
72
diff --git a/block/vhdx.c b/block/vhdx.c
73
index XXXXXXX..XXXXXXX 100644
74
--- a/block/vhdx.c
75
+++ b/block/vhdx.c
76
@@ -XXX,XX +XXX,XX @@ static int vhdx_allocate_block(BlockDriverState *bs, BDRVVHDXState *s,
77
*new_offset = current_len;
78
79
/* per the spec, the address for a block is in units of 1MB */
80
- *new_offset = ROUND_UP(*new_offset, 1024 * 1024);
81
+ *new_offset = ROUND_UP(*new_offset, 1 * MiB);
82
if (*new_offset > INT64_MAX) {
83
return -EINVAL;
84
}
85
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num,
86
case PAYLOAD_BLOCK_FULLY_PRESENT:
87
/* if the file offset address is in the header zone,
88
* there is a problem */
89
- if (sinfo.file_offset < (1024 * 1024)) {
90
+ if (sinfo.file_offset < (1 * MiB)) {
91
ret = -EFAULT;
92
goto error_bat_restore;
93
}
94
--
56
--
95
2.20.1
57
2.29.2
96
58
97
59
diff view generated by jsdifflib
1
make_completely_empty() is an optimisated path for bdrv_make_empty()
1
From: Stefan Hajnoczi <stefanha@redhat.com>
2
where completely new metadata is created inside the image file instead
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.
6
2
7
The necessary slow path with an explicit discard operation already
3
Treat the num_queues field as virtio-endian. On big-endian hosts the
8
exists for other cases. Use it for external data files, too.
4
vhost-user-blk num_queues field was in the wrong endianness.
5
6
Move the blkcfg.num_queues store operation from realize to
7
vhost_user_blk_update_config() so feature negotiation has finished and
8
we know the endianness of the device. VIRTIO 1.0 devices are
9
little-endian, but in case someone wants to use legacy VIRTIO we support
10
all endianness cases.
9
11
10
Cc: qemu-stable@nongnu.org
12
Cc: qemu-stable@nongnu.org
13
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
14
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
15
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
16
Message-Id: <20210223144653.811468-2-stefanha@redhat.com>
11
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
17
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12
Reviewed-by: Eric Blake <eblake@redhat.com>
13
---
18
---
14
block/qcow2.c | 7 +++++--
19
hw/block/vhost-user-blk.c | 7 +++----
15
1 file changed, 5 insertions(+), 2 deletions(-)
20
1 file changed, 3 insertions(+), 4 deletions(-)
16
21
17
diff --git a/block/qcow2.c b/block/qcow2.c
22
diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
18
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
19
--- a/block/qcow2.c
24
--- a/hw/block/vhost-user-blk.c
20
+++ b/block/qcow2.c
25
+++ b/hw/block/vhost-user-blk.c
21
@@ -XXX,XX +XXX,XX @@ static int qcow2_make_empty(BlockDriverState *bs)
26
@@ -XXX,XX +XXX,XX @@ static void vhost_user_blk_update_config(VirtIODevice *vdev, uint8_t *config)
22
27
{
23
if (s->qcow_version >= 3 && !s->snapshots && !s->nb_bitmaps &&
28
VHostUserBlk *s = VHOST_USER_BLK(vdev);
24
3 + l1_clusters <= s->refcount_block_size &&
29
25
- s->crypt_method_header != QCOW_CRYPT_LUKS) {
30
+ /* Our num_queues overrides the device backend */
26
+ s->crypt_method_header != QCOW_CRYPT_LUKS &&
31
+ virtio_stw_p(vdev, &s->blkcfg.num_queues, s->num_queues);
27
+ !has_data_file(bs)) {
32
+
28
/* The following function only works for qcow2 v3 images (it
33
memcpy(config, &s->blkcfg, sizeof(struct virtio_blk_config));
29
* requires the dirty flag) and only as long as there are no
34
}
30
* features that reserve extra clusters (such as snapshots,
35
31
* LUKS header, or persistent bitmaps), because it completely
36
@@ -XXX,XX +XXX,XX @@ reconnect:
32
* empties the image. Furthermore, the L1 table and three
37
goto reconnect;
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);
39
}
38
}
40
39
40
- if (s->blkcfg.num_queues != s->num_queues) {
41
- s->blkcfg.num_queues = s->num_queues;
42
- }
43
-
44
return;
45
46
virtio_err:
41
--
47
--
42
2.20.1
48
2.29.2
43
49
44
50
diff view generated by jsdifflib
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
1
From: Stefan Hajnoczi <stefanha@redhat.com>
2
2
3
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
3
Add an API that returns a new UNIX domain socket in the listen state.
4
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
4
The code for this was already there but only used internally in
5
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
5
init_socket().
6
7
This new API will be used by vhost-user-blk-test.
8
9
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10
Reviewed-by: Thomas Huth <thuth@redhat.com>
11
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
12
Message-Id: <20210223144653.811468-3-stefanha@redhat.com>
6
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7
---
14
---
8
block/stream.c | 4 +---
15
tests/qtest/libqos/libqtest.h | 8 +++++++
9
1 file changed, 1 insertion(+), 3 deletions(-)
16
tests/qtest/libqtest.c | 40 ++++++++++++++++++++---------------
17
2 files changed, 31 insertions(+), 17 deletions(-)
10
18
11
diff --git a/block/stream.c b/block/stream.c
19
diff --git a/tests/qtest/libqos/libqtest.h b/tests/qtest/libqos/libqtest.h
12
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
13
--- a/block/stream.c
21
--- a/tests/qtest/libqos/libqtest.h
14
+++ b/block/stream.c
22
+++ b/tests/qtest/libqos/libqtest.h
15
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn stream_populate(BlockBackend *blk,
23
@@ -XXX,XX +XXX,XX @@ void qtest_qmp_send(QTestState *s, const char *fmt, ...)
16
int64_t offset, uint64_t bytes,
24
void qtest_qmp_send_raw(QTestState *s, const char *fmt, ...)
17
void *buf)
25
GCC_FMT_ATTR(2, 3);
26
27
+/**
28
+ * qtest_socket_server:
29
+ * @socket_path: the UNIX domain socket path
30
+ *
31
+ * Create and return a listen socket file descriptor, or abort on failure.
32
+ */
33
+int qtest_socket_server(const char *socket_path);
34
+
35
/**
36
* qtest_vqmp_fds:
37
* @s: #QTestState instance to operate on.
38
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/tests/qtest/libqtest.c
41
+++ b/tests/qtest/libqtest.c
42
@@ -XXX,XX +XXX,XX @@ static void qtest_client_set_rx_handler(QTestState *s, QTestRecvFn recv);
43
44
static int init_socket(const char *socket_path)
18
{
45
{
19
- QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes);
46
- struct sockaddr_un addr;
47
- int sock;
48
- int ret;
20
-
49
-
21
assert(bytes < SIZE_MAX);
50
- sock = socket(PF_UNIX, SOCK_STREAM, 0);
22
51
- g_assert_cmpint(sock, !=, -1);
23
/* Copy-on-read the unallocated clusters */
52
-
24
- return blk_co_preadv(blk, offset, qiov.size, &qiov, BDRV_REQ_COPY_ON_READ);
53
- addr.sun_family = AF_UNIX;
25
+ return blk_co_pread(blk, offset, bytes, buf, BDRV_REQ_COPY_ON_READ);
54
- snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socket_path);
55
+ int sock = qtest_socket_server(socket_path);
56
qemu_set_cloexec(sock);
57
-
58
- do {
59
- ret = bind(sock, (struct sockaddr *)&addr, sizeof(addr));
60
- } while (ret == -1 && errno == EINTR);
61
- g_assert_cmpint(ret, !=, -1);
62
- ret = listen(sock, 1);
63
- g_assert_cmpint(ret, !=, -1);
64
-
65
return sock;
26
}
66
}
27
67
28
static void stream_abort(Job *job)
68
@@ -XXX,XX +XXX,XX @@ QDict *qtest_qmp_receive_dict(QTestState *s)
69
return qmp_fd_receive(s->qmp_fd);
70
}
71
72
+int qtest_socket_server(const char *socket_path)
73
+{
74
+ struct sockaddr_un addr;
75
+ int sock;
76
+ int ret;
77
+
78
+ sock = socket(PF_UNIX, SOCK_STREAM, 0);
79
+ g_assert_cmpint(sock, !=, -1);
80
+
81
+ addr.sun_family = AF_UNIX;
82
+ snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socket_path);
83
+
84
+ do {
85
+ ret = bind(sock, (struct sockaddr *)&addr, sizeof(addr));
86
+ } while (ret == -1 && errno == EINTR);
87
+ g_assert_cmpint(ret, !=, -1);
88
+ ret = listen(sock, 1);
89
+ g_assert_cmpint(ret, !=, -1);
90
+
91
+ return sock;
92
+}
93
+
94
/**
95
* Allow users to send a message without waiting for the reply,
96
* in the case that they choose to discard all replies up until
29
--
97
--
30
2.20.1
98
2.29.2
31
99
32
100
diff view generated by jsdifflib
1
From: Sam Eiderman <shmuel.eiderman@oracle.com>
1
From: Stefan Hajnoczi <stefanha@redhat.com>
2
2
3
Commit b69864e5a ("vmdk: Support version=3 in VMDK descriptor files")
3
Tests that manage multiple processes may wish to kill QEMU before
4
fixed the probe function to correctly guess vmdk descriptors with
4
destroying the QTestState. Expose a function to do that.
5
version=3.
6
5
7
This solves the issue where vmdk snapshot with parent vmdk descriptor
6
The vhost-user-blk-test testcase will need this.
8
containing "version=3" would be treated as raw instead vmdk.
9
7
10
In the future case where a new vmdk version is introduced, we will again
8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11
experience this issue, even if the user will provide "-f vmdk" it will
9
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
12
only apply to the tip image and not to the underlying "misprobed" parent
10
Message-Id: <20210223144653.811468-4-stefanha@redhat.com>
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>
27
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
28
---
12
---
29
block/vmdk.c | 2 ++
13
tests/qtest/libqos/libqtest.h | 11 +++++++++++
30
1 file changed, 2 insertions(+)
14
tests/qtest/libqtest.c | 7 ++++---
15
2 files changed, 15 insertions(+), 3 deletions(-)
31
16
32
diff --git a/block/vmdk.c b/block/vmdk.c
17
diff --git a/tests/qtest/libqos/libqtest.h b/tests/qtest/libqos/libqtest.h
33
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
34
--- a/block/vmdk.c
19
--- a/tests/qtest/libqos/libqtest.h
35
+++ b/block/vmdk.c
20
+++ b/tests/qtest/libqos/libqtest.h
36
@@ -XXX,XX +XXX,XX @@ static int vmdk_parent_open(BlockDriverState *bs)
21
@@ -XXX,XX +XXX,XX @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args);
37
pstrcpy(bs->auto_backing_file, end_name - p_name + 1, p_name);
22
*/
38
pstrcpy(bs->backing_file, sizeof(bs->backing_file),
23
QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd);
39
bs->auto_backing_file);
24
40
+ pstrcpy(bs->backing_format, sizeof(bs->backing_format),
25
+/**
41
+ "vmdk");
26
+ * qtest_kill_qemu:
27
+ * @s: #QTestState instance to operate on.
28
+ *
29
+ * Kill the QEMU process and wait for it to terminate. It is safe to call this
30
+ * function multiple times. Normally qtest_quit() is used instead because it
31
+ * also frees QTestState. Use qtest_kill_qemu() when you just want to kill QEMU
32
+ * and qtest_quit() will be called later.
33
+ */
34
+void qtest_kill_qemu(QTestState *s);
35
+
36
/**
37
* qtest_quit:
38
* @s: #QTestState instance to operate on.
39
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
40
index XXXXXXX..XXXXXXX 100644
41
--- a/tests/qtest/libqtest.c
42
+++ b/tests/qtest/libqtest.c
43
@@ -XXX,XX +XXX,XX @@ void qtest_set_expected_status(QTestState *s, int status)
44
s->expected_status = status;
45
}
46
47
-static void kill_qemu(QTestState *s)
48
+void qtest_kill_qemu(QTestState *s)
49
{
50
pid_t pid = s->qemu_pid;
51
int wstatus;
52
@@ -XXX,XX +XXX,XX @@ static void kill_qemu(QTestState *s)
53
kill(pid, SIGTERM);
54
TFR(pid = waitpid(s->qemu_pid, &s->wstatus, 0));
55
assert(pid == s->qemu_pid);
56
+ s->qemu_pid = -1;
42
}
57
}
43
58
44
out:
59
/*
60
@@ -XXX,XX +XXX,XX @@ static void kill_qemu(QTestState *s)
61
62
static void kill_qemu_hook_func(void *s)
63
{
64
- kill_qemu(s);
65
+ qtest_kill_qemu(s);
66
}
67
68
static void sigabrt_handler(int signo)
69
@@ -XXX,XX +XXX,XX @@ void qtest_quit(QTestState *s)
70
/* Uninstall SIGABRT handler on last instance */
71
cleanup_sigabrt_handler();
72
73
- kill_qemu(s);
74
+ qtest_kill_qemu(s);
75
close(s->fd);
76
close(s->qmp_fd);
77
g_string_free(s->rx, true);
45
--
78
--
46
2.20.1
79
2.29.2
47
80
48
81
diff view generated by jsdifflib
1
From: Zhengui li <lizhengui@huawei.com>
1
From: Stefan Hajnoczi <stefanha@redhat.com>
2
2
3
Concurrent IO becomes serial IO because of the qemu Coroutine lock,
3
Add a function to remove previously-added abrt handler functions.
4
which reduce IO performance severely.
5
4
6
So unlock Coroutine lock before bdrv_co_pwritev and
5
Now that a symmetric pair of add/remove functions exists we can also
7
bdrv_co_preadv to fix it.
6
balance the SIGABRT handler installation. The signal handler was
7
installed each time qtest_add_abrt_handler() was called. Now it is
8
installed when the abrt handler list becomes non-empty and removed again
9
when the list becomes empty.
8
10
9
Signed-off-by: Zhengui li <lizhengui@huawei.com>
11
The qtest_remove_abrt_handler() function will be used by
10
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12
vhost-user-blk-test.
13
14
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
15
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
16
Message-Id: <20210223144653.811468-5-stefanha@redhat.com>
11
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
17
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12
---
18
---
13
block/vpc.c | 4 ++++
19
tests/qtest/libqos/libqtest.h | 18 ++++++++++++++++++
14
1 file changed, 4 insertions(+)
20
tests/qtest/libqtest.c | 35 +++++++++++++++++++++++++++++------
21
2 files changed, 47 insertions(+), 6 deletions(-)
15
22
16
diff --git a/block/vpc.c b/block/vpc.c
23
diff --git a/tests/qtest/libqos/libqtest.h b/tests/qtest/libqos/libqtest.h
17
index XXXXXXX..XXXXXXX 100644
24
index XXXXXXX..XXXXXXX 100644
18
--- a/block/vpc.c
25
--- a/tests/qtest/libqos/libqtest.h
19
+++ b/block/vpc.c
26
+++ b/tests/qtest/libqos/libqtest.h
20
@@ -XXX,XX +XXX,XX @@ vpc_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
27
@@ -XXX,XX +XXX,XX @@ void qtest_add_data_func_full(const char *str, void *data,
21
qemu_iovec_reset(&local_qiov);
28
g_free(path); \
22
qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes);
29
} while (0)
23
30
24
+ qemu_co_mutex_unlock(&s->lock);
31
+/**
25
ret = bdrv_co_preadv(bs->file, image_offset, n_bytes,
32
+ * qtest_add_abrt_handler:
26
&local_qiov, 0);
33
+ * @fn: Handler function
27
+ qemu_co_mutex_lock(&s->lock);
34
+ * @data: Argument that is passed to the handler
28
if (ret < 0) {
35
+ *
29
goto fail;
36
+ * Add a handler function that is invoked on SIGABRT. This can be used to
30
}
37
+ * terminate processes and perform other cleanup. The handler can be removed
31
@@ -XXX,XX +XXX,XX @@ vpc_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
38
+ * with qtest_remove_abrt_handler().
32
qemu_iovec_reset(&local_qiov);
39
+ */
33
qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes);
40
void qtest_add_abrt_handler(GHookFunc fn, const void *data);
34
41
35
+ qemu_co_mutex_unlock(&s->lock);
42
+/**
36
ret = bdrv_co_pwritev(bs->file, image_offset, n_bytes,
43
+ * qtest_remove_abrt_handler:
37
&local_qiov, 0);
44
+ * @data: Argument previously passed to qtest_add_abrt_handler()
38
+ qemu_co_mutex_lock(&s->lock);
45
+ *
39
if (ret < 0) {
46
+ * Remove an abrt handler that was previously added with
40
goto fail;
47
+ * qtest_add_abrt_handler().
41
}
48
+ */
49
+void qtest_remove_abrt_handler(void *data);
50
+
51
/**
52
* qtest_qmp_assert_success:
53
* @qts: QTestState instance to operate on
54
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
55
index XXXXXXX..XXXXXXX 100644
56
--- a/tests/qtest/libqtest.c
57
+++ b/tests/qtest/libqtest.c
58
@@ -XXX,XX +XXX,XX @@ static void cleanup_sigabrt_handler(void)
59
sigaction(SIGABRT, &sigact_old, NULL);
60
}
61
62
+static bool hook_list_is_empty(GHookList *hook_list)
63
+{
64
+ GHook *hook = g_hook_first_valid(hook_list, TRUE);
65
+
66
+ if (!hook) {
67
+ return false;
68
+ }
69
+
70
+ g_hook_unref(hook_list, hook);
71
+ return true;
72
+}
73
+
74
void qtest_add_abrt_handler(GHookFunc fn, const void *data)
75
{
76
GHook *hook;
77
78
- /* Only install SIGABRT handler once */
79
if (!abrt_hooks.is_setup) {
80
g_hook_list_init(&abrt_hooks, sizeof(GHook));
81
}
82
- setup_sigabrt_handler();
83
+
84
+ /* Only install SIGABRT handler once */
85
+ if (hook_list_is_empty(&abrt_hooks)) {
86
+ setup_sigabrt_handler();
87
+ }
88
89
hook = g_hook_alloc(&abrt_hooks);
90
hook->func = fn;
91
@@ -XXX,XX +XXX,XX @@ void qtest_add_abrt_handler(GHookFunc fn, const void *data)
92
g_hook_prepend(&abrt_hooks, hook);
93
}
94
95
+void qtest_remove_abrt_handler(void *data)
96
+{
97
+ GHook *hook = g_hook_find_data(&abrt_hooks, TRUE, data);
98
+ g_hook_destroy_link(&abrt_hooks, hook);
99
+
100
+ /* Uninstall SIGABRT handler on last instance */
101
+ if (hook_list_is_empty(&abrt_hooks)) {
102
+ cleanup_sigabrt_handler();
103
+ }
104
+}
105
+
106
static const char *qtest_qemu_binary(void)
107
{
108
const char *qemu_bin;
109
@@ -XXX,XX +XXX,XX @@ QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd)
110
111
void qtest_quit(QTestState *s)
112
{
113
- g_hook_destroy_link(&abrt_hooks, g_hook_find_data(&abrt_hooks, TRUE, s));
114
-
115
- /* Uninstall SIGABRT handler on last instance */
116
- cleanup_sigabrt_handler();
117
+ qtest_remove_abrt_handler(s);
118
119
qtest_kill_qemu(s);
120
close(s->fd);
42
--
121
--
43
2.20.1
122
2.29.2
44
123
45
124
diff view generated by jsdifflib
1
From: Thomas Huth <thuth@redhat.com>
1
From: Coiby Xu <coiby.xu@gmail.com>
2
2
3
One of the recent commits changed the way qemu-io prints out its
3
This test case has the same tests as tests/virtio-blk-test.c except for
4
errors and warnings - they are now prefixed with the program name.
4
tests have block_resize. Since the vhost-user-blk export only serves one
5
We've got to adapt the iotests accordingly to prevent that they
5
client one time, two exports are started by qemu-storage-daemon for the
6
are failing.
6
hotplug test.
7
7
8
Fixes: 99e98d7c9fc1a1639fad ("qemu-io: Use error_[gs]et_progname()")
8
Suggested-by: Thomas Huth <thuth@redhat.com>
9
Signed-off-by: Thomas Huth <thuth@redhat.com>
9
Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
10
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11
Message-Id: <20210223144653.811468-6-stefanha@redhat.com>
10
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11
---
13
---
12
tests/qemu-iotests/026.out | 168 ++++++++++++++++++-------------------
14
tests/qtest/libqos/vhost-user-blk.h | 48 ++
13
tests/qemu-iotests/060.out | 6 +-
15
tests/qtest/libqos/vhost-user-blk.c | 130 +++++
14
tests/qemu-iotests/069.out | 2 +-
16
tests/qtest/vhost-user-blk-test.c | 788 ++++++++++++++++++++++++++++
15
tests/qemu-iotests/070.out | 2 +-
17
MAINTAINERS | 2 +
16
tests/qemu-iotests/075.out | 14 ++--
18
tests/qtest/libqos/meson.build | 1 +
17
tests/qemu-iotests/076.out | 6 +-
19
tests/qtest/meson.build | 4 +
18
tests/qemu-iotests/078.out | 12 +--
20
6 files changed, 973 insertions(+)
19
tests/qemu-iotests/080.out | 40 ++++-----
21
create mode 100644 tests/qtest/libqos/vhost-user-blk.h
20
tests/qemu-iotests/081.out | 2 +-
22
create mode 100644 tests/qtest/libqos/vhost-user-blk.c
21
tests/qemu-iotests/088.out | 12 +--
23
create mode 100644 tests/qtest/vhost-user-blk-test.c
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(-)
39
24
40
diff --git a/tests/qemu-iotests/026.out b/tests/qemu-iotests/026.out
25
diff --git a/tests/qtest/libqos/vhost-user-blk.h b/tests/qtest/libqos/vhost-user-blk.h
26
new file mode 100644
27
index XXXXXXX..XXXXXXX
28
--- /dev/null
29
+++ b/tests/qtest/libqos/vhost-user-blk.h
30
@@ -XXX,XX +XXX,XX @@
31
+/*
32
+ * libqos driver framework
33
+ *
34
+ * Based on tests/qtest/libqos/virtio-blk.c
35
+ *
36
+ * Copyright (c) 2020 Coiby Xu <coiby.xu@gmail.com>
37
+ *
38
+ * Copyright (c) 2018 Emanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com>
39
+ *
40
+ * This library is free software; you can redistribute it and/or
41
+ * modify it under the terms of the GNU Lesser General Public
42
+ * License version 2 as published by the Free Software Foundation.
43
+ *
44
+ * This library is distributed in the hope that it will be useful,
45
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
46
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
47
+ * Lesser General Public License for more details.
48
+ *
49
+ * You should have received a copy of the GNU Lesser General Public
50
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>
51
+ */
52
+
53
+#ifndef TESTS_LIBQOS_VHOST_USER_BLK_H
54
+#define TESTS_LIBQOS_VHOST_USER_BLK_H
55
+
56
+#include "qgraph.h"
57
+#include "virtio.h"
58
+#include "virtio-pci.h"
59
+
60
+typedef struct QVhostUserBlk QVhostUserBlk;
61
+typedef struct QVhostUserBlkPCI QVhostUserBlkPCI;
62
+typedef struct QVhostUserBlkDevice QVhostUserBlkDevice;
63
+
64
+struct QVhostUserBlk {
65
+ QVirtioDevice *vdev;
66
+};
67
+
68
+struct QVhostUserBlkPCI {
69
+ QVirtioPCIDevice pci_vdev;
70
+ QVhostUserBlk blk;
71
+};
72
+
73
+struct QVhostUserBlkDevice {
74
+ QOSGraphObject obj;
75
+ QVhostUserBlk blk;
76
+};
77
+
78
+#endif
79
diff --git a/tests/qtest/libqos/vhost-user-blk.c b/tests/qtest/libqos/vhost-user-blk.c
80
new file mode 100644
81
index XXXXXXX..XXXXXXX
82
--- /dev/null
83
+++ b/tests/qtest/libqos/vhost-user-blk.c
84
@@ -XXX,XX +XXX,XX @@
85
+/*
86
+ * libqos driver framework
87
+ *
88
+ * Based on tests/qtest/libqos/virtio-blk.c
89
+ *
90
+ * Copyright (c) 2020 Coiby Xu <coiby.xu@gmail.com>
91
+ *
92
+ * Copyright (c) 2018 Emanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com>
93
+ *
94
+ * This library is free software; you can redistribute it and/or
95
+ * modify it under the terms of the GNU Lesser General Public
96
+ * License version 2.1 as published by the Free Software Foundation.
97
+ *
98
+ * This library is distributed in the hope that it will be useful,
99
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
100
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
101
+ * Lesser General Public License for more details.
102
+ *
103
+ * You should have received a copy of the GNU Lesser General Public
104
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>
105
+ */
106
+
107
+#include "qemu/osdep.h"
108
+#include "libqtest.h"
109
+#include "qemu/module.h"
110
+#include "standard-headers/linux/virtio_blk.h"
111
+#include "vhost-user-blk.h"
112
+
113
+#define PCI_SLOT 0x04
114
+#define PCI_FN 0x00
115
+
116
+/* virtio-blk-device */
117
+static void *qvhost_user_blk_get_driver(QVhostUserBlk *v_blk,
118
+ const char *interface)
119
+{
120
+ if (!g_strcmp0(interface, "vhost-user-blk")) {
121
+ return v_blk;
122
+ }
123
+ if (!g_strcmp0(interface, "virtio")) {
124
+ return v_blk->vdev;
125
+ }
126
+
127
+ fprintf(stderr, "%s not present in vhost-user-blk-device\n", interface);
128
+ g_assert_not_reached();
129
+}
130
+
131
+static void *qvhost_user_blk_device_get_driver(void *object,
132
+ const char *interface)
133
+{
134
+ QVhostUserBlkDevice *v_blk = object;
135
+ return qvhost_user_blk_get_driver(&v_blk->blk, interface);
136
+}
137
+
138
+static void *vhost_user_blk_device_create(void *virtio_dev,
139
+ QGuestAllocator *t_alloc,
140
+ void *addr)
141
+{
142
+ QVhostUserBlkDevice *vhost_user_blk = g_new0(QVhostUserBlkDevice, 1);
143
+ QVhostUserBlk *interface = &vhost_user_blk->blk;
144
+
145
+ interface->vdev = virtio_dev;
146
+
147
+ vhost_user_blk->obj.get_driver = qvhost_user_blk_device_get_driver;
148
+
149
+ return &vhost_user_blk->obj;
150
+}
151
+
152
+/* virtio-blk-pci */
153
+static void *qvhost_user_blk_pci_get_driver(void *object, const char *interface)
154
+{
155
+ QVhostUserBlkPCI *v_blk = object;
156
+ if (!g_strcmp0(interface, "pci-device")) {
157
+ return v_blk->pci_vdev.pdev;
158
+ }
159
+ return qvhost_user_blk_get_driver(&v_blk->blk, interface);
160
+}
161
+
162
+static void *vhost_user_blk_pci_create(void *pci_bus, QGuestAllocator *t_alloc,
163
+ void *addr)
164
+{
165
+ QVhostUserBlkPCI *vhost_user_blk = g_new0(QVhostUserBlkPCI, 1);
166
+ QVhostUserBlk *interface = &vhost_user_blk->blk;
167
+ QOSGraphObject *obj = &vhost_user_blk->pci_vdev.obj;
168
+
169
+ virtio_pci_init(&vhost_user_blk->pci_vdev, pci_bus, addr);
170
+ interface->vdev = &vhost_user_blk->pci_vdev.vdev;
171
+
172
+ g_assert_cmphex(interface->vdev->device_type, ==, VIRTIO_ID_BLOCK);
173
+
174
+ obj->get_driver = qvhost_user_blk_pci_get_driver;
175
+
176
+ return obj;
177
+}
178
+
179
+static void vhost_user_blk_register_nodes(void)
180
+{
181
+ /*
182
+ * FIXME: every test using these two nodes needs to setup a
183
+ * -drive,id=drive0 otherwise QEMU is not going to start.
184
+ * Therefore, we do not include "produces" edge for virtio
185
+ * and pci-device yet.
186
+ */
187
+
188
+ char *arg = g_strdup_printf("id=drv0,chardev=char1,addr=%x.%x",
189
+ PCI_SLOT, PCI_FN);
190
+
191
+ QPCIAddress addr = {
192
+ .devfn = QPCI_DEVFN(PCI_SLOT, PCI_FN),
193
+ };
194
+
195
+ QOSGraphEdgeOptions opts = { };
196
+
197
+ /* virtio-blk-device */
198
+ /** opts.extra_device_opts = "drive=drive0"; */
199
+ qos_node_create_driver("vhost-user-blk-device",
200
+ vhost_user_blk_device_create);
201
+ qos_node_consumes("vhost-user-blk-device", "virtio-bus", &opts);
202
+ qos_node_produces("vhost-user-blk-device", "vhost-user-blk");
203
+
204
+ /* virtio-blk-pci */
205
+ opts.extra_device_opts = arg;
206
+ add_qpci_address(&opts, &addr);
207
+ qos_node_create_driver("vhost-user-blk-pci", vhost_user_blk_pci_create);
208
+ qos_node_consumes("vhost-user-blk-pci", "pci-bus", &opts);
209
+ qos_node_produces("vhost-user-blk-pci", "vhost-user-blk");
210
+
211
+ g_free(arg);
212
+}
213
+
214
+libqos_init(vhost_user_blk_register_nodes);
215
diff --git a/tests/qtest/vhost-user-blk-test.c b/tests/qtest/vhost-user-blk-test.c
216
new file mode 100644
217
index XXXXXXX..XXXXXXX
218
--- /dev/null
219
+++ b/tests/qtest/vhost-user-blk-test.c
220
@@ -XXX,XX +XXX,XX @@
221
+/*
222
+ * QTest testcase for Vhost-user Block Device
223
+ *
224
+ * Based on tests/qtest//virtio-blk-test.c
225
+
226
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
227
+ * Copyright (c) 2014 Marc Marí
228
+ * Copyright (c) 2020 Coiby Xu
229
+ *
230
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
231
+ * See the COPYING file in the top-level directory.
232
+ */
233
+
234
+#include "qemu/osdep.h"
235
+#include "libqtest-single.h"
236
+#include "qemu/bswap.h"
237
+#include "qemu/module.h"
238
+#include "standard-headers/linux/virtio_blk.h"
239
+#include "standard-headers/linux/virtio_pci.h"
240
+#include "libqos/qgraph.h"
241
+#include "libqos/vhost-user-blk.h"
242
+#include "libqos/libqos-pc.h"
243
+
244
+#define TEST_IMAGE_SIZE (64 * 1024 * 1024)
245
+#define QVIRTIO_BLK_TIMEOUT_US (30 * 1000 * 1000)
246
+#define PCI_SLOT_HP 0x06
247
+
248
+typedef struct {
249
+ pid_t pid;
250
+} QemuStorageDaemonState;
251
+
252
+typedef struct QVirtioBlkReq {
253
+ uint32_t type;
254
+ uint32_t ioprio;
255
+ uint64_t sector;
256
+ char *data;
257
+ uint8_t status;
258
+} QVirtioBlkReq;
259
+
260
+#ifdef HOST_WORDS_BIGENDIAN
261
+static const bool host_is_big_endian = true;
262
+#else
263
+static const bool host_is_big_endian; /* false */
264
+#endif
265
+
266
+static inline void virtio_blk_fix_request(QVirtioDevice *d, QVirtioBlkReq *req)
267
+{
268
+ if (qvirtio_is_big_endian(d) != host_is_big_endian) {
269
+ req->type = bswap32(req->type);
270
+ req->ioprio = bswap32(req->ioprio);
271
+ req->sector = bswap64(req->sector);
272
+ }
273
+}
274
+
275
+static inline void virtio_blk_fix_dwz_hdr(QVirtioDevice *d,
276
+ struct virtio_blk_discard_write_zeroes *dwz_hdr)
277
+{
278
+ if (qvirtio_is_big_endian(d) != host_is_big_endian) {
279
+ dwz_hdr->sector = bswap64(dwz_hdr->sector);
280
+ dwz_hdr->num_sectors = bswap32(dwz_hdr->num_sectors);
281
+ dwz_hdr->flags = bswap32(dwz_hdr->flags);
282
+ }
283
+}
284
+
285
+static uint64_t virtio_blk_request(QGuestAllocator *alloc, QVirtioDevice *d,
286
+ QVirtioBlkReq *req, uint64_t data_size)
287
+{
288
+ uint64_t addr;
289
+ uint8_t status = 0xFF;
290
+ QTestState *qts = global_qtest;
291
+
292
+ switch (req->type) {
293
+ case VIRTIO_BLK_T_IN:
294
+ case VIRTIO_BLK_T_OUT:
295
+ g_assert_cmpuint(data_size % 512, ==, 0);
296
+ break;
297
+ case VIRTIO_BLK_T_DISCARD:
298
+ case VIRTIO_BLK_T_WRITE_ZEROES:
299
+ g_assert_cmpuint(data_size %
300
+ sizeof(struct virtio_blk_discard_write_zeroes), ==, 0);
301
+ break;
302
+ default:
303
+ g_assert_cmpuint(data_size, ==, 0);
304
+ }
305
+
306
+ addr = guest_alloc(alloc, sizeof(*req) + data_size);
307
+
308
+ virtio_blk_fix_request(d, req);
309
+
310
+ qtest_memwrite(qts, addr, req, 16);
311
+ qtest_memwrite(qts, addr + 16, req->data, data_size);
312
+ qtest_memwrite(qts, addr + 16 + data_size, &status, sizeof(status));
313
+
314
+ return addr;
315
+}
316
+
317
+/* Returns the request virtqueue so the caller can perform further tests */
318
+static QVirtQueue *test_basic(QVirtioDevice *dev, QGuestAllocator *alloc)
319
+{
320
+ QVirtioBlkReq req;
321
+ uint64_t req_addr;
322
+ uint64_t capacity;
323
+ uint64_t features;
324
+ uint32_t free_head;
325
+ uint8_t status;
326
+ char *data;
327
+ QTestState *qts = global_qtest;
328
+ QVirtQueue *vq;
329
+
330
+ features = qvirtio_get_features(dev);
331
+ features = features & ~(QVIRTIO_F_BAD_FEATURE |
332
+ (1u << VIRTIO_RING_F_INDIRECT_DESC) |
333
+ (1u << VIRTIO_RING_F_EVENT_IDX) |
334
+ (1u << VIRTIO_BLK_F_SCSI));
335
+ qvirtio_set_features(dev, features);
336
+
337
+ capacity = qvirtio_config_readq(dev, 0);
338
+ g_assert_cmpint(capacity, ==, TEST_IMAGE_SIZE / 512);
339
+
340
+ vq = qvirtqueue_setup(dev, alloc, 0);
341
+
342
+ qvirtio_set_driver_ok(dev);
343
+
344
+ /* Write and read with 3 descriptor layout */
345
+ /* Write request */
346
+ req.type = VIRTIO_BLK_T_OUT;
347
+ req.ioprio = 1;
348
+ req.sector = 0;
349
+ req.data = g_malloc0(512);
350
+ strcpy(req.data, "TEST");
351
+
352
+ req_addr = virtio_blk_request(alloc, dev, &req, 512);
353
+
354
+ g_free(req.data);
355
+
356
+ free_head = qvirtqueue_add(qts, vq, req_addr, 16, false, true);
357
+ qvirtqueue_add(qts, vq, req_addr + 16, 512, false, true);
358
+ qvirtqueue_add(qts, vq, req_addr + 528, 1, true, false);
359
+
360
+ qvirtqueue_kick(qts, dev, vq, free_head);
361
+
362
+ qvirtio_wait_used_elem(qts, dev, vq, free_head, NULL,
363
+ QVIRTIO_BLK_TIMEOUT_US);
364
+ status = readb(req_addr + 528);
365
+ g_assert_cmpint(status, ==, 0);
366
+
367
+ guest_free(alloc, req_addr);
368
+
369
+ /* Read request */
370
+ req.type = VIRTIO_BLK_T_IN;
371
+ req.ioprio = 1;
372
+ req.sector = 0;
373
+ req.data = g_malloc0(512);
374
+
375
+ req_addr = virtio_blk_request(alloc, dev, &req, 512);
376
+
377
+ g_free(req.data);
378
+
379
+ free_head = qvirtqueue_add(qts, vq, req_addr, 16, false, true);
380
+ qvirtqueue_add(qts, vq, req_addr + 16, 512, true, true);
381
+ qvirtqueue_add(qts, vq, req_addr + 528, 1, true, false);
382
+
383
+ qvirtqueue_kick(qts, dev, vq, free_head);
384
+
385
+ qvirtio_wait_used_elem(qts, dev, vq, free_head, NULL,
386
+ QVIRTIO_BLK_TIMEOUT_US);
387
+ status = readb(req_addr + 528);
388
+ g_assert_cmpint(status, ==, 0);
389
+
390
+ data = g_malloc0(512);
391
+ qtest_memread(qts, req_addr + 16, data, 512);
392
+ g_assert_cmpstr(data, ==, "TEST");
393
+ g_free(data);
394
+
395
+ guest_free(alloc, req_addr);
396
+
397
+ if (features & (1u << VIRTIO_BLK_F_WRITE_ZEROES)) {
398
+ struct virtio_blk_discard_write_zeroes dwz_hdr;
399
+ void *expected;
400
+
401
+ /*
402
+ * WRITE_ZEROES request on the same sector of previous test where
403
+ * we wrote "TEST".
404
+ */
405
+ req.type = VIRTIO_BLK_T_WRITE_ZEROES;
406
+ req.data = (char *) &dwz_hdr;
407
+ dwz_hdr.sector = 0;
408
+ dwz_hdr.num_sectors = 1;
409
+ dwz_hdr.flags = 0;
410
+
411
+ virtio_blk_fix_dwz_hdr(dev, &dwz_hdr);
412
+
413
+ req_addr = virtio_blk_request(alloc, dev, &req, sizeof(dwz_hdr));
414
+
415
+ free_head = qvirtqueue_add(qts, vq, req_addr, 16, false, true);
416
+ qvirtqueue_add(qts, vq, req_addr + 16, sizeof(dwz_hdr), false, true);
417
+ qvirtqueue_add(qts, vq, req_addr + 16 + sizeof(dwz_hdr), 1, true,
418
+ false);
419
+
420
+ qvirtqueue_kick(qts, dev, vq, free_head);
421
+
422
+ qvirtio_wait_used_elem(qts, dev, vq, free_head, NULL,
423
+ QVIRTIO_BLK_TIMEOUT_US);
424
+ status = readb(req_addr + 16 + sizeof(dwz_hdr));
425
+ g_assert_cmpint(status, ==, 0);
426
+
427
+ guest_free(alloc, req_addr);
428
+
429
+ /* Read request to check if the sector contains all zeroes */
430
+ req.type = VIRTIO_BLK_T_IN;
431
+ req.ioprio = 1;
432
+ req.sector = 0;
433
+ req.data = g_malloc0(512);
434
+
435
+ req_addr = virtio_blk_request(alloc, dev, &req, 512);
436
+
437
+ g_free(req.data);
438
+
439
+ free_head = qvirtqueue_add(qts, vq, req_addr, 16, false, true);
440
+ qvirtqueue_add(qts, vq, req_addr + 16, 512, true, true);
441
+ qvirtqueue_add(qts, vq, req_addr + 528, 1, true, false);
442
+
443
+ qvirtqueue_kick(qts, dev, vq, free_head);
444
+
445
+ qvirtio_wait_used_elem(qts, dev, vq, free_head, NULL,
446
+ QVIRTIO_BLK_TIMEOUT_US);
447
+ status = readb(req_addr + 528);
448
+ g_assert_cmpint(status, ==, 0);
449
+
450
+ data = g_malloc(512);
451
+ expected = g_malloc0(512);
452
+ qtest_memread(qts, req_addr + 16, data, 512);
453
+ g_assert_cmpmem(data, 512, expected, 512);
454
+ g_free(expected);
455
+ g_free(data);
456
+
457
+ guest_free(alloc, req_addr);
458
+ }
459
+
460
+ if (features & (1u << VIRTIO_BLK_F_DISCARD)) {
461
+ struct virtio_blk_discard_write_zeroes dwz_hdr;
462
+
463
+ req.type = VIRTIO_BLK_T_DISCARD;
464
+ req.data = (char *) &dwz_hdr;
465
+ dwz_hdr.sector = 0;
466
+ dwz_hdr.num_sectors = 1;
467
+ dwz_hdr.flags = 0;
468
+
469
+ virtio_blk_fix_dwz_hdr(dev, &dwz_hdr);
470
+
471
+ req_addr = virtio_blk_request(alloc, dev, &req, sizeof(dwz_hdr));
472
+
473
+ free_head = qvirtqueue_add(qts, vq, req_addr, 16, false, true);
474
+ qvirtqueue_add(qts, vq, req_addr + 16, sizeof(dwz_hdr), false, true);
475
+ qvirtqueue_add(qts, vq, req_addr + 16 + sizeof(dwz_hdr),
476
+ 1, true, false);
477
+
478
+ qvirtqueue_kick(qts, dev, vq, free_head);
479
+
480
+ qvirtio_wait_used_elem(qts, dev, vq, free_head, NULL,
481
+ QVIRTIO_BLK_TIMEOUT_US);
482
+ status = readb(req_addr + 16 + sizeof(dwz_hdr));
483
+ g_assert_cmpint(status, ==, 0);
484
+
485
+ guest_free(alloc, req_addr);
486
+ }
487
+
488
+ if (features & (1u << VIRTIO_F_ANY_LAYOUT)) {
489
+ /* Write and read with 2 descriptor layout */
490
+ /* Write request */
491
+ req.type = VIRTIO_BLK_T_OUT;
492
+ req.ioprio = 1;
493
+ req.sector = 1;
494
+ req.data = g_malloc0(512);
495
+ strcpy(req.data, "TEST");
496
+
497
+ req_addr = virtio_blk_request(alloc, dev, &req, 512);
498
+
499
+ g_free(req.data);
500
+
501
+ free_head = qvirtqueue_add(qts, vq, req_addr, 528, false, true);
502
+ qvirtqueue_add(qts, vq, req_addr + 528, 1, true, false);
503
+ qvirtqueue_kick(qts, dev, vq, free_head);
504
+
505
+ qvirtio_wait_used_elem(qts, dev, vq, free_head, NULL,
506
+ QVIRTIO_BLK_TIMEOUT_US);
507
+ status = readb(req_addr + 528);
508
+ g_assert_cmpint(status, ==, 0);
509
+
510
+ guest_free(alloc, req_addr);
511
+
512
+ /* Read request */
513
+ req.type = VIRTIO_BLK_T_IN;
514
+ req.ioprio = 1;
515
+ req.sector = 1;
516
+ req.data = g_malloc0(512);
517
+
518
+ req_addr = virtio_blk_request(alloc, dev, &req, 512);
519
+
520
+ g_free(req.data);
521
+
522
+ free_head = qvirtqueue_add(qts, vq, req_addr, 16, false, true);
523
+ qvirtqueue_add(qts, vq, req_addr + 16, 513, true, false);
524
+
525
+ qvirtqueue_kick(qts, dev, vq, free_head);
526
+
527
+ qvirtio_wait_used_elem(qts, dev, vq, free_head, NULL,
528
+ QVIRTIO_BLK_TIMEOUT_US);
529
+ status = readb(req_addr + 528);
530
+ g_assert_cmpint(status, ==, 0);
531
+
532
+ data = g_malloc0(512);
533
+ qtest_memread(qts, req_addr + 16, data, 512);
534
+ g_assert_cmpstr(data, ==, "TEST");
535
+ g_free(data);
536
+
537
+ guest_free(alloc, req_addr);
538
+ }
539
+
540
+ return vq;
541
+}
542
+
543
+static void basic(void *obj, void *data, QGuestAllocator *t_alloc)
544
+{
545
+ QVhostUserBlk *blk_if = obj;
546
+ QVirtQueue *vq;
547
+
548
+ vq = test_basic(blk_if->vdev, t_alloc);
549
+ qvirtqueue_cleanup(blk_if->vdev->bus, vq, t_alloc);
550
+
551
+}
552
+
553
+static void indirect(void *obj, void *u_data, QGuestAllocator *t_alloc)
554
+{
555
+ QVirtQueue *vq;
556
+ QVhostUserBlk *blk_if = obj;
557
+ QVirtioDevice *dev = blk_if->vdev;
558
+ QVirtioBlkReq req;
559
+ QVRingIndirectDesc *indirect;
560
+ uint64_t req_addr;
561
+ uint64_t capacity;
562
+ uint64_t features;
563
+ uint32_t free_head;
564
+ uint8_t status;
565
+ char *data;
566
+ QTestState *qts = global_qtest;
567
+
568
+ features = qvirtio_get_features(dev);
569
+ g_assert_cmphex(features & (1u << VIRTIO_RING_F_INDIRECT_DESC), !=, 0);
570
+ features = features & ~(QVIRTIO_F_BAD_FEATURE |
571
+ (1u << VIRTIO_RING_F_EVENT_IDX) |
572
+ (1u << VIRTIO_BLK_F_SCSI));
573
+ qvirtio_set_features(dev, features);
574
+
575
+ capacity = qvirtio_config_readq(dev, 0);
576
+ g_assert_cmpint(capacity, ==, TEST_IMAGE_SIZE / 512);
577
+
578
+ vq = qvirtqueue_setup(dev, t_alloc, 0);
579
+ qvirtio_set_driver_ok(dev);
580
+
581
+ /* Write request */
582
+ req.type = VIRTIO_BLK_T_OUT;
583
+ req.ioprio = 1;
584
+ req.sector = 0;
585
+ req.data = g_malloc0(512);
586
+ strcpy(req.data, "TEST");
587
+
588
+ req_addr = virtio_blk_request(t_alloc, dev, &req, 512);
589
+
590
+ g_free(req.data);
591
+
592
+ indirect = qvring_indirect_desc_setup(qts, dev, t_alloc, 2);
593
+ qvring_indirect_desc_add(dev, qts, indirect, req_addr, 528, false);
594
+ qvring_indirect_desc_add(dev, qts, indirect, req_addr + 528, 1, true);
595
+ free_head = qvirtqueue_add_indirect(qts, vq, indirect);
596
+ qvirtqueue_kick(qts, dev, vq, free_head);
597
+
598
+ qvirtio_wait_used_elem(qts, dev, vq, free_head, NULL,
599
+ QVIRTIO_BLK_TIMEOUT_US);
600
+ status = readb(req_addr + 528);
601
+ g_assert_cmpint(status, ==, 0);
602
+
603
+ g_free(indirect);
604
+ guest_free(t_alloc, req_addr);
605
+
606
+ /* Read request */
607
+ req.type = VIRTIO_BLK_T_IN;
608
+ req.ioprio = 1;
609
+ req.sector = 0;
610
+ req.data = g_malloc0(512);
611
+ strcpy(req.data, "TEST");
612
+
613
+ req_addr = virtio_blk_request(t_alloc, dev, &req, 512);
614
+
615
+ g_free(req.data);
616
+
617
+ indirect = qvring_indirect_desc_setup(qts, dev, t_alloc, 2);
618
+ qvring_indirect_desc_add(dev, qts, indirect, req_addr, 16, false);
619
+ qvring_indirect_desc_add(dev, qts, indirect, req_addr + 16, 513, true);
620
+ free_head = qvirtqueue_add_indirect(qts, vq, indirect);
621
+ qvirtqueue_kick(qts, dev, vq, free_head);
622
+
623
+ qvirtio_wait_used_elem(qts, dev, vq, free_head, NULL,
624
+ QVIRTIO_BLK_TIMEOUT_US);
625
+ status = readb(req_addr + 528);
626
+ g_assert_cmpint(status, ==, 0);
627
+
628
+ data = g_malloc0(512);
629
+ qtest_memread(qts, req_addr + 16, data, 512);
630
+ g_assert_cmpstr(data, ==, "TEST");
631
+ g_free(data);
632
+
633
+ g_free(indirect);
634
+ guest_free(t_alloc, req_addr);
635
+ qvirtqueue_cleanup(dev->bus, vq, t_alloc);
636
+}
637
+
638
+static void idx(void *obj, void *u_data, QGuestAllocator *t_alloc)
639
+{
640
+ QVirtQueue *vq;
641
+ QVhostUserBlkPCI *blk = obj;
642
+ QVirtioPCIDevice *pdev = &blk->pci_vdev;
643
+ QVirtioDevice *dev = &pdev->vdev;
644
+ QVirtioBlkReq req;
645
+ uint64_t req_addr;
646
+ uint64_t capacity;
647
+ uint64_t features;
648
+ uint32_t free_head;
649
+ uint32_t write_head;
650
+ uint32_t desc_idx;
651
+ uint8_t status;
652
+ char *data;
653
+ QOSGraphObject *blk_object = obj;
654
+ QPCIDevice *pci_dev = blk_object->get_driver(blk_object, "pci-device");
655
+ QTestState *qts = global_qtest;
656
+
657
+ if (qpci_check_buggy_msi(pci_dev)) {
658
+ return;
659
+ }
660
+
661
+ qpci_msix_enable(pdev->pdev);
662
+ qvirtio_pci_set_msix_configuration_vector(pdev, t_alloc, 0);
663
+
664
+ features = qvirtio_get_features(dev);
665
+ features = features & ~(QVIRTIO_F_BAD_FEATURE |
666
+ (1u << VIRTIO_RING_F_INDIRECT_DESC) |
667
+ (1u << VIRTIO_F_NOTIFY_ON_EMPTY) |
668
+ (1u << VIRTIO_BLK_F_SCSI));
669
+ qvirtio_set_features(dev, features);
670
+
671
+ capacity = qvirtio_config_readq(dev, 0);
672
+ g_assert_cmpint(capacity, ==, TEST_IMAGE_SIZE / 512);
673
+
674
+ vq = qvirtqueue_setup(dev, t_alloc, 0);
675
+ qvirtqueue_pci_msix_setup(pdev, (QVirtQueuePCI *)vq, t_alloc, 1);
676
+
677
+ qvirtio_set_driver_ok(dev);
678
+
679
+ /* Write request */
680
+ req.type = VIRTIO_BLK_T_OUT;
681
+ req.ioprio = 1;
682
+ req.sector = 0;
683
+ req.data = g_malloc0(512);
684
+ strcpy(req.data, "TEST");
685
+
686
+ req_addr = virtio_blk_request(t_alloc, dev, &req, 512);
687
+
688
+ g_free(req.data);
689
+
690
+ free_head = qvirtqueue_add(qts, vq, req_addr, 16, false, true);
691
+ qvirtqueue_add(qts, vq, req_addr + 16, 512, false, true);
692
+ qvirtqueue_add(qts, vq, req_addr + 528, 1, true, false);
693
+ qvirtqueue_kick(qts, dev, vq, free_head);
694
+
695
+ qvirtio_wait_used_elem(qts, dev, vq, free_head, NULL,
696
+ QVIRTIO_BLK_TIMEOUT_US);
697
+
698
+ /* Write request */
699
+ req.type = VIRTIO_BLK_T_OUT;
700
+ req.ioprio = 1;
701
+ req.sector = 1;
702
+ req.data = g_malloc0(512);
703
+ strcpy(req.data, "TEST");
704
+
705
+ req_addr = virtio_blk_request(t_alloc, dev, &req, 512);
706
+
707
+ g_free(req.data);
708
+
709
+ /* Notify after processing the third request */
710
+ qvirtqueue_set_used_event(qts, vq, 2);
711
+ free_head = qvirtqueue_add(qts, vq, req_addr, 16, false, true);
712
+ qvirtqueue_add(qts, vq, req_addr + 16, 512, false, true);
713
+ qvirtqueue_add(qts, vq, req_addr + 528, 1, true, false);
714
+ qvirtqueue_kick(qts, dev, vq, free_head);
715
+ write_head = free_head;
716
+
717
+ /* No notification expected */
718
+ status = qvirtio_wait_status_byte_no_isr(qts, dev,
719
+ vq, req_addr + 528,
720
+ QVIRTIO_BLK_TIMEOUT_US);
721
+ g_assert_cmpint(status, ==, 0);
722
+
723
+ guest_free(t_alloc, req_addr);
724
+
725
+ /* Read request */
726
+ req.type = VIRTIO_BLK_T_IN;
727
+ req.ioprio = 1;
728
+ req.sector = 1;
729
+ req.data = g_malloc0(512);
730
+
731
+ req_addr = virtio_blk_request(t_alloc, dev, &req, 512);
732
+
733
+ g_free(req.data);
734
+
735
+ free_head = qvirtqueue_add(qts, vq, req_addr, 16, false, true);
736
+ qvirtqueue_add(qts, vq, req_addr + 16, 512, true, true);
737
+ qvirtqueue_add(qts, vq, req_addr + 528, 1, true, false);
738
+
739
+ qvirtqueue_kick(qts, dev, vq, free_head);
740
+
741
+ /* We get just one notification for both requests */
742
+ qvirtio_wait_used_elem(qts, dev, vq, write_head, NULL,
743
+ QVIRTIO_BLK_TIMEOUT_US);
744
+ g_assert(qvirtqueue_get_buf(qts, vq, &desc_idx, NULL));
745
+ g_assert_cmpint(desc_idx, ==, free_head);
746
+
747
+ status = readb(req_addr + 528);
748
+ g_assert_cmpint(status, ==, 0);
749
+
750
+ data = g_malloc0(512);
751
+ qtest_memread(qts, req_addr + 16, data, 512);
752
+ g_assert_cmpstr(data, ==, "TEST");
753
+ g_free(data);
754
+
755
+ guest_free(t_alloc, req_addr);
756
+
757
+ /* End test */
758
+ qpci_msix_disable(pdev->pdev);
759
+
760
+ qvirtqueue_cleanup(dev->bus, vq, t_alloc);
761
+}
762
+
763
+static void pci_hotplug(void *obj, void *data, QGuestAllocator *t_alloc)
764
+{
765
+ QVirtioPCIDevice *dev1 = obj;
766
+ QVirtioPCIDevice *dev;
767
+ QTestState *qts = dev1->pdev->bus->qts;
768
+
769
+ /* plug secondary disk */
770
+ qtest_qmp_device_add(qts, "vhost-user-blk-pci", "drv1",
771
+ "{'addr': %s, 'chardev': 'char2'}",
772
+ stringify(PCI_SLOT_HP) ".0");
773
+
774
+ dev = virtio_pci_new(dev1->pdev->bus,
775
+ &(QPCIAddress) { .devfn = QPCI_DEVFN(PCI_SLOT_HP, 0)
776
+ });
777
+ g_assert_nonnull(dev);
778
+ g_assert_cmpint(dev->vdev.device_type, ==, VIRTIO_ID_BLOCK);
779
+ qvirtio_pci_device_disable(dev);
780
+ qos_object_destroy((QOSGraphObject *)dev);
781
+
782
+ /* unplug secondary disk */
783
+ qpci_unplug_acpi_device_test(qts, "drv1", PCI_SLOT_HP);
784
+}
785
+
786
+/*
787
+ * Check that setting the vring addr on a non-existent virtqueue does
788
+ * not crash.
789
+ */
790
+static void test_nonexistent_virtqueue(void *obj, void *data,
791
+ QGuestAllocator *t_alloc)
792
+{
793
+ QVhostUserBlkPCI *blk = obj;
794
+ QVirtioPCIDevice *pdev = &blk->pci_vdev;
795
+ QPCIBar bar0;
796
+ QPCIDevice *dev;
797
+
798
+ dev = qpci_device_find(pdev->pdev->bus, QPCI_DEVFN(4, 0));
799
+ g_assert(dev != NULL);
800
+ qpci_device_enable(dev);
801
+
802
+ bar0 = qpci_iomap(dev, 0, NULL);
803
+
804
+ qpci_io_writeb(dev, bar0, VIRTIO_PCI_QUEUE_SEL, 2);
805
+ qpci_io_writel(dev, bar0, VIRTIO_PCI_QUEUE_PFN, 1);
806
+
807
+ g_free(dev);
808
+}
809
+
810
+static const char *qtest_qemu_storage_daemon_binary(void)
811
+{
812
+ const char *qemu_storage_daemon_bin;
813
+
814
+ qemu_storage_daemon_bin = getenv("QTEST_QEMU_STORAGE_DAEMON_BINARY");
815
+ if (!qemu_storage_daemon_bin) {
816
+ fprintf(stderr, "Environment variable "
817
+ "QTEST_QEMU_STORAGE_DAEMON_BINARY required\n");
818
+ exit(0);
819
+ }
820
+
821
+ return qemu_storage_daemon_bin;
822
+}
823
+
824
+/* g_test_queue_destroy() cleanup function for files */
825
+static void destroy_file(void *path)
826
+{
827
+ unlink(path);
828
+ g_free(path);
829
+ qos_invalidate_command_line();
830
+}
831
+
832
+static char *drive_create(void)
833
+{
834
+ int fd, ret;
835
+ /** vhost-user-blk won't recognize drive located in /tmp */
836
+ char *t_path = g_strdup("qtest.XXXXXX");
837
+
838
+ /** Create a temporary raw image */
839
+ fd = mkstemp(t_path);
840
+ g_assert_cmpint(fd, >=, 0);
841
+ ret = ftruncate(fd, TEST_IMAGE_SIZE);
842
+ g_assert_cmpint(ret, ==, 0);
843
+ close(fd);
844
+
845
+ g_test_queue_destroy(destroy_file, t_path);
846
+ return t_path;
847
+}
848
+
849
+static char *create_listen_socket(int *fd)
850
+{
851
+ int tmp_fd;
852
+ char *path;
853
+
854
+ /* No race because our pid makes the path unique */
855
+ path = g_strdup_printf("/tmp/qtest-%d-sock.XXXXXX", getpid());
856
+ tmp_fd = mkstemp(path);
857
+ g_assert_cmpint(tmp_fd, >=, 0);
858
+ close(tmp_fd);
859
+ unlink(path);
860
+
861
+ *fd = qtest_socket_server(path);
862
+ g_test_queue_destroy(destroy_file, path);
863
+ return path;
864
+}
865
+
866
+/*
867
+ * g_test_queue_destroy() and qtest_add_abrt_handler() cleanup function for
868
+ * qemu-storage-daemon.
869
+ */
870
+static void quit_storage_daemon(void *data)
871
+{
872
+ QemuStorageDaemonState *qsd = data;
873
+ int wstatus;
874
+ pid_t pid;
875
+
876
+ /*
877
+ * If we were invoked as a g_test_queue_destroy() cleanup function we need
878
+ * to remove the abrt handler to avoid being called again if the code below
879
+ * aborts. Also, we must not leave the abrt handler installed after
880
+ * cleanup.
881
+ */
882
+ qtest_remove_abrt_handler(data);
883
+
884
+ /* Before quitting storage-daemon, quit qemu to avoid dubious messages */
885
+ qtest_kill_qemu(global_qtest);
886
+
887
+ kill(qsd->pid, SIGTERM);
888
+ pid = waitpid(qsd->pid, &wstatus, 0);
889
+ g_assert_cmpint(pid, ==, qsd->pid);
890
+ if (!WIFEXITED(wstatus)) {
891
+ fprintf(stderr, "%s: expected qemu-storage-daemon to exit\n",
892
+ __func__);
893
+ abort();
894
+ }
895
+ if (WEXITSTATUS(wstatus) != 0) {
896
+ fprintf(stderr, "%s: expected qemu-storage-daemon to exit "
897
+ "successfully, got %d\n",
898
+ __func__, WEXITSTATUS(wstatus));
899
+ abort();
900
+ }
901
+
902
+ g_free(data);
903
+}
904
+
905
+static void start_vhost_user_blk(GString *cmd_line, int vus_instances)
906
+{
907
+ const char *vhost_user_blk_bin = qtest_qemu_storage_daemon_binary();
908
+ int i;
909
+ gchar *img_path;
910
+ GString *storage_daemon_command = g_string_new(NULL);
911
+ QemuStorageDaemonState *qsd;
912
+
913
+ g_string_append_printf(storage_daemon_command,
914
+ "exec %s ",
915
+ vhost_user_blk_bin);
916
+
917
+ g_string_append_printf(cmd_line,
918
+ " -object memory-backend-memfd,id=mem,size=256M,share=on "
919
+ " -M memory-backend=mem -m 256M ");
920
+
921
+ for (i = 0; i < vus_instances; i++) {
922
+ int fd;
923
+ char *sock_path = create_listen_socket(&fd);
924
+
925
+ /* create image file */
926
+ img_path = drive_create();
927
+ g_string_append_printf(storage_daemon_command,
928
+ "--blockdev driver=file,node-name=disk%d,filename=%s "
929
+ "--export type=vhost-user-blk,id=disk%d,addr.type=unix,addr.path=%s,"
930
+ "node-name=disk%i,writable=on ",
931
+ i, img_path, i, sock_path, i);
932
+
933
+ g_string_append_printf(cmd_line, "-chardev socket,id=char%d,path=%s ",
934
+ i + 1, sock_path);
935
+ }
936
+
937
+ g_test_message("starting vhost-user backend: %s",
938
+ storage_daemon_command->str);
939
+ pid_t pid = fork();
940
+ if (pid == 0) {
941
+ /*
942
+ * Close standard file descriptors so tap-driver.pl pipe detects when
943
+ * our parent terminates.
944
+ */
945
+ close(0);
946
+ close(1);
947
+ open("/dev/null", O_RDONLY);
948
+ open("/dev/null", O_WRONLY);
949
+
950
+ execlp("/bin/sh", "sh", "-c", storage_daemon_command->str, NULL);
951
+ exit(1);
952
+ }
953
+ g_string_free(storage_daemon_command, true);
954
+
955
+ qsd = g_new(QemuStorageDaemonState, 1);
956
+ qsd->pid = pid;
957
+
958
+ /* Make sure qemu-storage-daemon is stopped */
959
+ qtest_add_abrt_handler(quit_storage_daemon, qsd);
960
+ g_test_queue_destroy(quit_storage_daemon, qsd);
961
+}
962
+
963
+static void *vhost_user_blk_test_setup(GString *cmd_line, void *arg)
964
+{
965
+ start_vhost_user_blk(cmd_line, 1);
966
+ return arg;
967
+}
968
+
969
+/*
970
+ * Setup for hotplug.
971
+ *
972
+ * Since vhost-user server only serves one vhost-user client one time,
973
+ * another exprot
974
+ *
975
+ */
976
+static void *vhost_user_blk_hotplug_test_setup(GString *cmd_line, void *arg)
977
+{
978
+ /* "-chardev socket,id=char2" is used for pci_hotplug*/
979
+ start_vhost_user_blk(cmd_line, 2);
980
+ return arg;
981
+}
982
+
983
+static void register_vhost_user_blk_test(void)
984
+{
985
+ QOSGraphTestOptions opts = {
986
+ .before = vhost_user_blk_test_setup,
987
+ };
988
+
989
+ /*
990
+ * tests for vhost-user-blk and vhost-user-blk-pci
991
+ * The tests are borrowed from tests/virtio-blk-test.c. But some tests
992
+ * regarding block_resize don't work for vhost-user-blk.
993
+ * vhost-user-blk device doesn't have -drive, so tests containing
994
+ * block_resize are also abandoned,
995
+ * - config
996
+ * - resize
997
+ */
998
+ qos_add_test("basic", "vhost-user-blk", basic, &opts);
999
+ qos_add_test("indirect", "vhost-user-blk", indirect, &opts);
1000
+ qos_add_test("idx", "vhost-user-blk-pci", idx, &opts);
1001
+ qos_add_test("nxvirtq", "vhost-user-blk-pci",
1002
+ test_nonexistent_virtqueue, &opts);
1003
+
1004
+ opts.before = vhost_user_blk_hotplug_test_setup;
1005
+ qos_add_test("hotplug", "vhost-user-blk-pci", pci_hotplug, &opts);
1006
+}
1007
+
1008
+libqos_init(register_vhost_user_blk_test);
1009
diff --git a/MAINTAINERS b/MAINTAINERS
41
index XXXXXXX..XXXXXXX 100644
1010
index XXXXXXX..XXXXXXX 100644
42
--- a/tests/qemu-iotests/026.out
1011
--- a/MAINTAINERS
43
+++ b/tests/qemu-iotests/026.out
1012
+++ b/MAINTAINERS
44
@@ -XXX,XX +XXX,XX @@ No errors were found on the image.
1013
@@ -XXX,XX +XXX,XX @@ F: block/export/vhost-user-blk-server.c
45
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
1014
F: block/export/vhost-user-blk-server.h
46
1015
F: include/qemu/vhost-user-server.h
47
Event: l1_update; errno: 5; imm: off; once: off; write
1016
F: tests/qtest/libqos/vhost-user-blk.c
48
-Failed to flush the L2 table cache: Input/output error
1017
+F: tests/qtest/libqos/vhost-user-blk.h
49
-Failed to flush the refcount block cache: Input/output error
1018
+F: tests/qtest/vhost-user-blk-test.c
50
+qemu-io: Failed to flush the L2 table cache: Input/output error
1019
F: util/vhost-user-server.c
51
+qemu-io: Failed to flush the refcount block cache: Input/output error
1020
52
write failed: Input/output error
1021
FUSE block device exports
53
1022
diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build
54
1 leaked clusters were found on the image.
55
@@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data.
56
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
57
58
Event: l1_update; errno: 5; imm: off; once: off; write -b
59
-Failed to flush the L2 table cache: Input/output error
60
-Failed to flush the refcount block cache: Input/output error
61
+qemu-io: Failed to flush the L2 table cache: Input/output error
62
+qemu-io: Failed to flush the refcount block cache: Input/output error
63
write failed: Input/output error
64
65
1 leaked clusters were found on the image.
66
@@ -XXX,XX +XXX,XX @@ No errors were found on the image.
67
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
68
69
Event: l1_update; errno: 28; imm: off; once: off; write
70
-Failed to flush the L2 table cache: No space left on device
71
-Failed to flush the refcount block cache: No space left on device
72
+qemu-io: Failed to flush the L2 table cache: No space left on device
73
+qemu-io: Failed to flush the refcount block cache: No space left on device
74
write failed: No space left on device
75
76
1 leaked clusters were found on the image.
77
@@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data.
78
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
79
80
Event: l1_update; errno: 28; imm: off; once: off; write -b
81
-Failed to flush the L2 table cache: No space left on device
82
-Failed to flush the refcount block cache: No space left on device
83
+qemu-io: Failed to flush the L2 table cache: No space left on device
84
+qemu-io: Failed to flush the refcount block cache: No space left on device
85
write failed: No space left on device
86
87
1 leaked clusters were found on the image.
88
@@ -XXX,XX +XXX,XX @@ No errors were found on the image.
89
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
90
91
Event: l2_update; errno: 5; imm: off; once: off; write
92
-Failed to flush the L2 table cache: Input/output error
93
-Failed to flush the refcount block cache: Input/output error
94
+qemu-io: Failed to flush the L2 table cache: Input/output error
95
+qemu-io: Failed to flush the refcount block cache: Input/output error
96
write failed: Input/output error
97
98
127 leaked clusters were found on the image.
99
@@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data.
100
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
101
102
Event: l2_update; errno: 5; imm: off; once: off; write -b
103
-Failed to flush the L2 table cache: Input/output error
104
-Failed to flush the refcount block cache: Input/output error
105
+qemu-io: Failed to flush the L2 table cache: Input/output error
106
+qemu-io: Failed to flush the refcount block cache: Input/output error
107
write failed: Input/output error
108
109
127 leaked clusters were found on the image.
110
@@ -XXX,XX +XXX,XX @@ No errors were found on the image.
111
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
112
113
Event: l2_update; errno: 28; imm: off; once: off; write
114
-Failed to flush the L2 table cache: No space left on device
115
-Failed to flush the refcount block cache: No space left on device
116
+qemu-io: Failed to flush the L2 table cache: No space left on device
117
+qemu-io: Failed to flush the refcount block cache: No space left on device
118
write failed: No space left on device
119
120
127 leaked clusters were found on the image.
121
@@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data.
122
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
123
124
Event: l2_update; errno: 28; imm: off; once: off; write -b
125
-Failed to flush the L2 table cache: No space left on device
126
-Failed to flush the refcount block cache: No space left on device
127
+qemu-io: Failed to flush the L2 table cache: No space left on device
128
+qemu-io: Failed to flush the refcount block cache: No space left on device
129
write failed: No space left on device
130
131
127 leaked clusters were found on the image.
132
@@ -XXX,XX +XXX,XX @@ No errors were found on the image.
133
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
134
135
Event: l2_alloc_write; errno: 5; imm: off; once: off; write
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
1023
index XXXXXXX..XXXXXXX 100644
486
--- a/tests/qemu-iotests/060.out
1024
--- a/tests/qtest/libqos/meson.build
487
+++ b/tests/qemu-iotests/060.out
1025
+++ b/tests/qtest/libqos/meson.build
488
@@ -XXX,XX +XXX,XX @@ Format specific information:
1026
@@ -XXX,XX +XXX,XX @@ libqos_srcs = files('../libqtest.c',
489
lazy refcounts: false
1027
'virtio-9p.c',
490
refcount bits: 16
1028
'virtio-balloon.c',
491
corrupt: true
1029
'virtio-blk.c',
492
-can't open device TEST_DIR/t.IMGFMT: IMGFMT: Image is corrupt; cannot be opened read/write
1030
+ 'vhost-user-blk.c',
493
+qemu-io: can't open device TEST_DIR/t.IMGFMT: IMGFMT: Image is corrupt; cannot be opened read/write
1031
'virtio-mmio.c',
494
no file open, try 'help open'
1032
'virtio-net.c',
495
read 512/512 bytes at offset 0
1033
'virtio-pci.c',
496
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
1034
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
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
1035
index XXXXXXX..XXXXXXX 100644
517
--- a/tests/qemu-iotests/069.out
1036
--- a/tests/qtest/meson.build
518
+++ b/tests/qemu-iotests/069.out
1037
+++ b/tests/qtest/meson.build
519
@@ -XXX,XX +XXX,XX @@ QA output created by 069
1038
@@ -XXX,XX +XXX,XX @@ if have_virtfs
520
1039
qos_test_ss.add(files('virtio-9p-test.c'))
521
Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=131072
1040
endif
522
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=131072 backing_file=TEST_DIR/t.IMGFMT.base
1041
qos_test_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user-test.c'))
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
1042
+if have_vhost_user_blk_server
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
1043
+ qos_test_ss.add(files('vhost-user-blk-test.c'))
525
*** done
1044
+endif
526
diff --git a/tests/qemu-iotests/070.out b/tests/qemu-iotests/070.out
1045
527
index XXXXXXX..XXXXXXX 100644
1046
tpmemu_files = ['tpm-emu.c', 'tpm-util.c', 'tpm-tests.c']
528
--- a/tests/qemu-iotests/070.out
1047
529
+++ b/tests/qemu-iotests/070.out
1048
@@ -XXX,XX +XXX,XX @@ foreach dir : target_dirs
530
@@ -XXX,XX +XXX,XX @@
1049
endif
531
QA output created by 070
1050
qtest_env.set('G_TEST_DBUS_DAEMON', meson.source_root() / 'tests/dbus-vmstate-daemon.sh')
532
1051
qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base)
533
=== Verify open image read-only fails, due to dirty log ===
1052
+ qtest_env.set('QTEST_QEMU_STORAGE_DAEMON_BINARY', './storage-daemon/qemu-storage-daemon')
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
1053
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
1054
foreach test : target_qtests
536
To replay the log, run:
1055
# Executables are shared across targets, declare them only the first time we
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
718
diff --git a/tests/qemu-iotests/081.out b/tests/qemu-iotests/081.out
719
index XXXXXXX..XXXXXXX 100644
720
--- a/tests/qemu-iotests/081.out
721
+++ b/tests/qemu-iotests/081.out
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)
724
725
== checking the blkverify mode with invalid settings ==
726
-can't open: blkverify=on can only be set if there are exactly two files and vote-threshold is 2
727
+qemu-io: can't open: blkverify=on can only be set if there are exactly two files and vote-threshold is 2
728
729
== dynamically adding a child to a quorum ==
730
Testing:
731
diff --git a/tests/qemu-iotests/088.out b/tests/qemu-iotests/088.out
732
index XXXXXXX..XXXXXXX 100644
733
--- a/tests/qemu-iotests/088.out
734
+++ b/tests/qemu-iotests/088.out
735
@@ -XXX,XX +XXX,XX @@ QA output created by 088
736
737
== Invalid block size ==
738
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
739
-can't open device TEST_DIR/t.vpc: Invalid block size 0
740
-can't open device TEST_DIR/t.vpc: Invalid block size 0
741
-can't open device TEST_DIR/t.vpc: Invalid block size 128
742
-can't open device TEST_DIR/t.vpc: Invalid block size 128
743
-can't open device TEST_DIR/t.vpc: Invalid block size 305419896
744
-can't open device TEST_DIR/t.vpc: Invalid block size 305419896
745
+qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 0
746
+qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 0
747
+qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 128
748
+qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 128
749
+qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 305419896
750
+qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 305419896
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 ===
1234
--
1056
--
1235
2.20.1
1057
2.29.2
1236
1058
1237
1059
diff view generated by jsdifflib
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
1
From: Stefan Hajnoczi <stefanha@redhat.com>
2
2
3
qed_read_table and qed_write_table use coroutine-only interfaces but
3
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
4
are not marked coroutine_fn. Happily, they are called only from
4
Message-Id: <20210223144653.811468-7-stefanha@redhat.com>
5
coroutine context, so we only need to add missed markers.
6
7
Reported-by: Kevin Wolf <kwolf@redhat.com>
8
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10
---
6
---
11
block/qed.h | 28 ++++++++++++++++------------
7
tests/qtest/vhost-user-blk-test.c | 81 +++++++++++++++++++++++++++++--
12
block/qed-check.c | 4 ++--
8
1 file changed, 76 insertions(+), 5 deletions(-)
13
block/qed-table.c | 33 ++++++++++++++++++++-------------
14
block/qed.c | 5 +++--
15
4 files changed, 41 insertions(+), 29 deletions(-)
16
9
17
diff --git a/block/qed.h b/block/qed.h
10
diff --git a/tests/qtest/vhost-user-blk-test.c b/tests/qtest/vhost-user-blk-test.c
18
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
19
--- a/block/qed.h
12
--- a/tests/qtest/vhost-user-blk-test.c
20
+++ b/block/qed.h
13
+++ b/tests/qtest/vhost-user-blk-test.c
21
@@ -XXX,XX +XXX,XX @@ void qed_commit_l2_cache_entry(L2TableCache *l2_cache, CachedL2Table *l2_table);
14
@@ -XXX,XX +XXX,XX @@ static void pci_hotplug(void *obj, void *data, QGuestAllocator *t_alloc)
22
/**
15
qpci_unplug_acpi_device_test(qts, "drv1", PCI_SLOT_HP);
23
* Table I/O functions
16
}
24
*/
17
25
-int qed_read_l1_table_sync(BDRVQEDState *s);
18
+static void multiqueue(void *obj, void *data, QGuestAllocator *t_alloc)
26
-int qed_write_l1_table(BDRVQEDState *s, unsigned int index, unsigned int n);
19
+{
27
-int qed_write_l1_table_sync(BDRVQEDState *s, unsigned int index,
20
+ QVirtioPCIDevice *pdev1 = obj;
28
- unsigned int n);
21
+ QVirtioDevice *dev1 = &pdev1->vdev;
29
-int qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request,
22
+ QVirtioPCIDevice *pdev8;
30
- uint64_t offset);
23
+ QVirtioDevice *dev8;
31
-int qed_read_l2_table(BDRVQEDState *s, QEDRequest *request, uint64_t offset);
24
+ QTestState *qts = pdev1->pdev->bus->qts;
32
-int qed_write_l2_table(BDRVQEDState *s, QEDRequest *request,
25
+ uint64_t features;
33
- unsigned int index, unsigned int n, bool flush);
26
+ uint16_t num_queues;
34
-int qed_write_l2_table_sync(BDRVQEDState *s, QEDRequest *request,
27
+
35
- unsigned int index, unsigned int n, bool flush);
28
+ /*
36
+int coroutine_fn qed_read_l1_table_sync(BDRVQEDState *s);
29
+ * The primary device has 1 queue and VIRTIO_BLK_F_MQ is not enabled. The
37
+int coroutine_fn qed_write_l1_table(BDRVQEDState *s, unsigned int index,
30
+ * VIRTIO specification allows VIRTIO_BLK_F_MQ to be enabled when there is
38
+ unsigned int n);
31
+ * only 1 virtqueue, but --device vhost-user-blk-pci doesn't do this (which
39
+int coroutine_fn qed_write_l1_table_sync(BDRVQEDState *s, unsigned int index,
32
+ * is also spec-compliant).
40
+ unsigned int n);
33
+ */
41
+int coroutine_fn qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request,
34
+ features = qvirtio_get_features(dev1);
42
+ uint64_t offset);
35
+ g_assert_cmpint(features & (1u << VIRTIO_BLK_F_MQ), ==, 0);
43
+int coroutine_fn qed_read_l2_table(BDRVQEDState *s, QEDRequest *request,
36
+ features = features & ~(QVIRTIO_F_BAD_FEATURE |
44
+ uint64_t offset);
37
+ (1u << VIRTIO_RING_F_INDIRECT_DESC) |
45
+int coroutine_fn qed_write_l2_table(BDRVQEDState *s, QEDRequest *request,
38
+ (1u << VIRTIO_F_NOTIFY_ON_EMPTY) |
46
+ unsigned int index, unsigned int n,
39
+ (1u << VIRTIO_BLK_F_SCSI));
47
+ bool flush);
40
+ qvirtio_set_features(dev1, features);
48
+int coroutine_fn qed_write_l2_table_sync(BDRVQEDState *s, QEDRequest *request,
41
+
49
+ unsigned int index, unsigned int n,
42
+ /* Hotplug a secondary device with 8 queues */
50
+ bool flush);
43
+ qtest_qmp_device_add(qts, "vhost-user-blk-pci", "drv1",
51
44
+ "{'addr': %s, 'chardev': 'char2', 'num-queues': 8}",
52
/**
45
+ stringify(PCI_SLOT_HP) ".0");
53
* Cluster functions
46
+
54
@@ -XXX,XX +XXX,XX @@ int coroutine_fn qed_find_cluster(BDRVQEDState *s, QEDRequest *request,
47
+ pdev8 = virtio_pci_new(pdev1->pdev->bus,
55
/**
48
+ &(QPCIAddress) {
56
* Consistency check
49
+ .devfn = QPCI_DEVFN(PCI_SLOT_HP, 0)
57
*/
50
+ });
58
-int qed_check(BDRVQEDState *s, BdrvCheckResult *result, bool fix);
51
+ g_assert_nonnull(pdev8);
59
+int coroutine_fn qed_check(BDRVQEDState *s, BdrvCheckResult *result, bool fix);
52
+ g_assert_cmpint(pdev8->vdev.device_type, ==, VIRTIO_ID_BLOCK);
60
53
+
61
QEDTable *qed_alloc_table(BDRVQEDState *s);
54
+ qos_object_start_hw(&pdev8->obj);
62
55
+
63
diff --git a/block/qed-check.c b/block/qed-check.c
56
+ dev8 = &pdev8->vdev;
64
index XXXXXXX..XXXXXXX 100644
57
+ features = qvirtio_get_features(dev8);
65
--- a/block/qed-check.c
58
+ g_assert_cmpint(features & (1u << VIRTIO_BLK_F_MQ),
66
+++ b/block/qed-check.c
59
+ ==,
67
@@ -XXX,XX +XXX,XX @@ static unsigned int qed_check_l2_table(QEDCheck *check, QEDTable *table)
60
+ (1u << VIRTIO_BLK_F_MQ));
68
/**
61
+ features = features & ~(QVIRTIO_F_BAD_FEATURE |
69
* Descend tables and check each cluster is referenced once only
62
+ (1u << VIRTIO_RING_F_INDIRECT_DESC) |
70
*/
63
+ (1u << VIRTIO_F_NOTIFY_ON_EMPTY) |
71
-static int qed_check_l1_table(QEDCheck *check, QEDTable *table)
64
+ (1u << VIRTIO_BLK_F_SCSI) |
72
+static int coroutine_fn qed_check_l1_table(QEDCheck *check, QEDTable *table)
65
+ (1u << VIRTIO_BLK_F_MQ));
66
+ qvirtio_set_features(dev8, features);
67
+
68
+ num_queues = qvirtio_config_readw(dev8,
69
+ offsetof(struct virtio_blk_config, num_queues));
70
+ g_assert_cmpint(num_queues, ==, 8);
71
+
72
+ qvirtio_pci_device_disable(pdev8);
73
+ qos_object_destroy(&pdev8->obj);
74
+
75
+ /* unplug secondary disk */
76
+ qpci_unplug_acpi_device_test(qts, "drv1", PCI_SLOT_HP);
77
+}
78
+
79
/*
80
* Check that setting the vring addr on a non-existent virtqueue does
81
* not crash.
82
@@ -XXX,XX +XXX,XX @@ static void quit_storage_daemon(void *data)
83
g_free(data);
84
}
85
86
-static void start_vhost_user_blk(GString *cmd_line, int vus_instances)
87
+static void start_vhost_user_blk(GString *cmd_line, int vus_instances,
88
+ int num_queues)
73
{
89
{
74
BDRVQEDState *s = check->s;
90
const char *vhost_user_blk_bin = qtest_qemu_storage_daemon_binary();
75
unsigned int i, num_invalid_l1 = 0;
91
int i;
76
@@ -XXX,XX +XXX,XX @@ static void qed_check_mark_clean(BDRVQEDState *s, BdrvCheckResult *result)
92
@@ -XXX,XX +XXX,XX @@ static void start_vhost_user_blk(GString *cmd_line, int vus_instances)
93
g_string_append_printf(storage_daemon_command,
94
"--blockdev driver=file,node-name=disk%d,filename=%s "
95
"--export type=vhost-user-blk,id=disk%d,addr.type=unix,addr.path=%s,"
96
- "node-name=disk%i,writable=on ",
97
- i, img_path, i, sock_path, i);
98
+ "node-name=disk%i,writable=on,num-queues=%d ",
99
+ i, img_path, i, sock_path, i, num_queues);
100
101
g_string_append_printf(cmd_line, "-chardev socket,id=char%d,path=%s ",
102
i + 1, sock_path);
103
@@ -XXX,XX +XXX,XX @@ static void start_vhost_user_blk(GString *cmd_line, int vus_instances)
104
105
static void *vhost_user_blk_test_setup(GString *cmd_line, void *arg)
106
{
107
- start_vhost_user_blk(cmd_line, 1);
108
+ start_vhost_user_blk(cmd_line, 1, 1);
109
return arg;
77
}
110
}
78
111
79
/* Called with table_lock held. */
112
@@ -XXX,XX +XXX,XX @@ static void *vhost_user_blk_test_setup(GString *cmd_line, void *arg)
80
-int qed_check(BDRVQEDState *s, BdrvCheckResult *result, bool fix)
113
static void *vhost_user_blk_hotplug_test_setup(GString *cmd_line, void *arg)
81
+int coroutine_fn qed_check(BDRVQEDState *s, BdrvCheckResult *result, bool fix)
82
{
114
{
83
QEDCheck check = {
115
/* "-chardev socket,id=char2" is used for pci_hotplug*/
84
.s = s,
116
- start_vhost_user_blk(cmd_line, 2);
85
diff --git a/block/qed-table.c b/block/qed-table.c
117
+ start_vhost_user_blk(cmd_line, 2, 1);
86
index XXXXXXX..XXXXXXX 100644
118
+ return arg;
87
--- a/block/qed-table.c
119
+}
88
+++ b/block/qed-table.c
120
+
89
@@ -XXX,XX +XXX,XX @@
121
+static void *vhost_user_blk_multiqueue_test_setup(GString *cmd_line, void *arg)
90
#include "qemu/bswap.h"
122
+{
91
123
+ start_vhost_user_blk(cmd_line, 2, 8);
92
/* Called with table_lock held. */
124
return arg;
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
}
125
}
114
126
115
-int qed_read_l1_table_sync(BDRVQEDState *s)
127
@@ -XXX,XX +XXX,XX @@ static void register_vhost_user_blk_test(void)
116
+int coroutine_fn qed_read_l1_table_sync(BDRVQEDState *s)
128
117
{
129
opts.before = vhost_user_blk_hotplug_test_setup;
118
return qed_read_table(s, s->header.l1_table_offset, s->l1_table);
130
qos_add_test("hotplug", "vhost-user-blk-pci", pci_hotplug, &opts);
131
+
132
+ opts.before = vhost_user_blk_multiqueue_test_setup;
133
+ qos_add_test("multiqueue", "vhost-user-blk-pci", multiqueue, &opts);
119
}
134
}
120
135
121
/* Called with table_lock held. */
136
libqos_init(register_vhost_user_blk_test);
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,
182
}
183
}
184
185
-static int bdrv_qed_co_check(BlockDriverState *bs, BdrvCheckResult *result,
186
- BdrvCheckMode fix)
187
+static int coroutine_fn bdrv_qed_co_check(BlockDriverState *bs,
188
+ BdrvCheckResult *result,
189
+ BdrvCheckMode fix)
190
{
191
BDRVQEDState *s = bs->opaque;
192
int ret;
193
--
137
--
194
2.20.1
138
2.29.2
195
139
196
140
diff view generated by jsdifflib
1
Limiting the allocation to INT_MAX bytes isn't particularly clever
1
From: Stefan Hajnoczi <stefanha@redhat.com>
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.
6
2
7
Align the maximum allocation size down to the cluster size to avoid this
3
The config->blk_size field is little-endian. Use the native-endian
8
situation.
4
blk_size variable to avoid double byteswapping.
9
5
10
Cc: qemu-stable@nongnu.org
6
Fixes: 11f60f7eaee2630dd6fa0c3a8c49f792e46c4cf1 ("block/export: make vhost-user-blk config space little-endian")
7
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8
Message-Id: <20210223144653.811468-8-stefanha@redhat.com>
11
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12
Reviewed-by: Eric Blake <eblake@redhat.com>
13
---
10
---
14
block/qcow2.c | 2 +-
11
block/export/vhost-user-blk-server.c | 2 +-
15
1 file changed, 1 insertion(+), 1 deletion(-)
12
1 file changed, 1 insertion(+), 1 deletion(-)
16
13
17
diff --git a/block/qcow2.c b/block/qcow2.c
14
diff --git a/block/export/vhost-user-blk-server.c b/block/export/vhost-user-blk-server.c
18
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
19
--- a/block/qcow2.c
16
--- a/block/export/vhost-user-blk-server.c
20
+++ b/block/qcow2.c
17
+++ b/block/export/vhost-user-blk-server.c
21
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset,
18
@@ -XXX,XX +XXX,XX @@ vu_blk_initialize_config(BlockDriverState *bs,
22
bytes = new_length - offset;
19
config->num_queues = cpu_to_le16(num_queues);
23
20
config->max_discard_sectors = cpu_to_le32(32768);
24
while (bytes) {
21
config->max_discard_seg = cpu_to_le32(1);
25
- cur_bytes = MIN(bytes, INT_MAX);
22
- config->discard_sector_alignment = cpu_to_le32(config->blk_size >> 9);
26
+ cur_bytes = MIN(bytes, QEMU_ALIGN_DOWN(INT_MAX, s->cluster_size));
23
+ config->discard_sector_alignment = cpu_to_le32(blk_size >> 9);
27
ret = qcow2_alloc_cluster_offset(bs, offset, &cur_bytes,
24
config->max_write_zeroes_sectors = cpu_to_le32(32768);
28
&host_offset, &meta);
25
config->max_write_zeroes_seg = cpu_to_le32(1);
29
if (ret < 0) {
26
}
30
--
27
--
31
2.20.1
28
2.29.2
32
29
33
30
diff view generated by jsdifflib
1
Even for block nodes with bs->drv == NULL, we can't just ignore a
1
From: Stefan Hajnoczi <stefanha@redhat.com>
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.
6
2
7
This is an example stack trace of a related crash:
3
Use VIRTIO_BLK_SECTOR_BITS and VIRTIO_BLK_SECTOR_SIZE when dealing with
4
virtio-blk sector numbers. Although the values happen to be the same as
5
BDRV_SECTOR_BITS and BDRV_SECTOR_SIZE, they are conceptually different.
6
This makes it clearer when we are dealing with virtio-blk sector units.
8
7
9
#0 0x00007ffff59da57f in raise () at /lib64/libc.so.6
8
Use VIRTIO_BLK_SECTOR_BITS in vu_blk_initialize_config(). Later patches
10
#1 0x00007ffff59c4895 in abort () at /lib64/libc.so.6
9
will use it the new constants the virtqueue request processing code
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
10
path.
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
11
35
The reproducer I used is a qcow2 image on gluster volume, where the
12
Suggested-by: Max Reitz <mreitz@redhat.com>
36
virtual disk size (4 GB) is larger than the gluster volume size (64M),
13
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
37
so we can easily trigger an ENOSPC. This backend is assigned to a
14
Message-Id: <20210223144653.811468-9-stefanha@redhat.com>
38
virtio-blk device using an iothread, and then from the guest a
15
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
39
'dd if=/dev/zero of=/dev/vda bs=1G count=1' causes the VM to stop
16
---
40
because of an I/O error. qemu_gluster_co_flush_to_disk() sets
17
block/export/vhost-user-blk-server.c | 15 ++++++++++++---
41
bs->drv = NULL on error, so when virtio-blk stops the dataplane, the
18
1 file changed, 12 insertions(+), 3 deletions(-)
42
block nodes stay in the iothread AioContext. A 'quit' monitor command
43
issued from this paused state crashes the process.
44
19
45
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1631227
20
diff --git a/block/export/vhost-user-blk-server.c b/block/export/vhost-user-blk-server.c
46
Cc: qemu-stable@nongnu.org
47
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
48
Reviewed-by: Eric Blake <eblake@redhat.com>
49
Reviewed-by: Max Reitz <mreitz@redhat.com>
50
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
51
---
52
block.c | 12 ++----------
53
1 file changed, 2 insertions(+), 10 deletions(-)
54
55
diff --git a/block.c b/block.c
56
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
57
--- a/block.c
22
--- a/block/export/vhost-user-blk-server.c
58
+++ b/block.c
23
+++ b/block/export/vhost-user-blk-server.c
59
@@ -XXX,XX +XXX,XX @@ void bdrv_detach_aio_context(BlockDriverState *bs)
24
@@ -XXX,XX +XXX,XX @@
60
BdrvAioNotifier *baf, *baf_tmp;
25
#include "sysemu/block-backend.h"
61
BdrvChild *child;
26
#include "util/block-helpers.h"
62
27
63
- if (!bs->drv) {
28
+/*
64
- return;
29
+ * Sector units are 512 bytes regardless of the
65
- }
30
+ * virtio_blk_config->blk_size value.
66
-
31
+ */
67
assert(!bs->walking_aio_notifiers);
32
+#define VIRTIO_BLK_SECTOR_BITS 9
68
bs->walking_aio_notifiers = true;
33
+#define VIRTIO_BLK_SECTOR_SIZE (1ull << VIRTIO_BLK_SECTOR_BITS)
69
QLIST_FOREACH_SAFE(baf, &bs->aio_notifiers, list, baf_tmp) {
34
+
70
@@ -XXX,XX +XXX,XX @@ void bdrv_detach_aio_context(BlockDriverState *bs)
35
enum {
71
*/
36
VHOST_USER_BLK_NUM_QUEUES_DEFAULT = 1,
72
bs->walking_aio_notifiers = false;
37
};
73
38
@@ -XXX,XX +XXX,XX @@ vu_blk_initialize_config(BlockDriverState *bs,
74
- if (bs->drv->bdrv_detach_aio_context) {
39
uint32_t blk_size,
75
+ if (bs->drv && bs->drv->bdrv_detach_aio_context) {
40
uint16_t num_queues)
76
bs->drv->bdrv_detach_aio_context(bs);
41
{
42
- config->capacity = cpu_to_le64(bdrv_getlength(bs) >> BDRV_SECTOR_BITS);
43
+ config->capacity =
44
+ cpu_to_le64(bdrv_getlength(bs) >> VIRTIO_BLK_SECTOR_BITS);
45
config->blk_size = cpu_to_le32(blk_size);
46
config->size_max = cpu_to_le32(0);
47
config->seg_max = cpu_to_le32(128 - 2);
48
@@ -XXX,XX +XXX,XX @@ vu_blk_initialize_config(BlockDriverState *bs,
49
config->num_queues = cpu_to_le16(num_queues);
50
config->max_discard_sectors = cpu_to_le32(32768);
51
config->max_discard_seg = cpu_to_le32(1);
52
- config->discard_sector_alignment = cpu_to_le32(blk_size >> 9);
53
+ config->discard_sector_alignment =
54
+ cpu_to_le32(blk_size >> VIRTIO_BLK_SECTOR_BITS);
55
config->max_write_zeroes_sectors = cpu_to_le32(32768);
56
config->max_write_zeroes_seg = cpu_to_le32(1);
57
}
58
@@ -XXX,XX +XXX,XX @@ static int vu_blk_exp_create(BlockExport *exp, BlockExportOptions *opts,
59
if (vu_opts->has_logical_block_size) {
60
logical_block_size = vu_opts->logical_block_size;
61
} else {
62
- logical_block_size = BDRV_SECTOR_SIZE;
63
+ logical_block_size = VIRTIO_BLK_SECTOR_SIZE;
77
}
64
}
78
QLIST_FOREACH(child, &bs->children, next) {
65
check_block_size(exp->id, "logical-block-size", logical_block_size,
79
@@ -XXX,XX +XXX,XX @@ void bdrv_attach_aio_context(BlockDriverState *bs,
66
&local_err);
80
BdrvAioNotifier *ban, *ban_tmp;
81
BdrvChild *child;
82
83
- if (!bs->drv) {
84
- return;
85
- }
86
-
87
if (bs->quiesce_counter) {
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
}
98
99
--
67
--
100
2.20.1
68
2.29.2
101
69
102
70
diff view generated by jsdifflib
1
From: Eric Blake <eblake@redhat.com>
1
From: Stefan Hajnoczi <stefanha@redhat.com>
2
2
3
When extracting a human-readable size formatter, we changed 'uint64_t
3
The driver is supposed to honor the blk_size field but the protocol
4
div' pre-patch to 'unsigned long div' post-patch. Which breaks on
4
still uses 512-byte sector numbers. It is incorrect to multiply
5
32-bit platforms, resulting in 'inf' instead of intended values larger
5
req->sector_num by blk_size.
6
than 999GB.
7
6
8
Fixes: 22951aaa
7
VIRTIO 1.1 5.2.5 Device Initialization says:
9
CC: qemu-stable@nongnu.org
8
10
Reported-by: Max Reitz <mreitz@redhat.com>
9
blk_size can be read to determine the optimal sector size for the
11
Signed-off-by: Eric Blake <eblake@redhat.com>
10
driver to use. This does not affect the units used in the protocol
12
Reviewed-by: Max Reitz <mreitz@redhat.com>
11
(always 512 bytes), but awareness of the correct value can affect
12
performance.
13
14
Fixes: 3578389bcf76c824a5d82e6586a6f0c71e56f2aa ("block/export: vhost-user block device backend server")
15
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
16
Message-Id: <20210223144653.811468-10-stefanha@redhat.com>
13
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
17
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14
---
18
---
15
util/cutils.c | 2 +-
19
block/export/vhost-user-blk-server.c | 2 +-
16
1 file changed, 1 insertion(+), 1 deletion(-)
20
1 file changed, 1 insertion(+), 1 deletion(-)
17
21
18
diff --git a/util/cutils.c b/util/cutils.c
22
diff --git a/block/export/vhost-user-blk-server.c b/block/export/vhost-user-blk-server.c
19
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
20
--- a/util/cutils.c
24
--- a/block/export/vhost-user-blk-server.c
21
+++ b/util/cutils.c
25
+++ b/block/export/vhost-user-blk-server.c
22
@@ -XXX,XX +XXX,XX @@ const char *qemu_ether_ntoa(const MACAddr *mac)
26
@@ -XXX,XX +XXX,XX @@ static void coroutine_fn vu_blk_virtio_process_req(void *opaque)
23
char *size_to_str(uint64_t val)
27
break;
24
{
28
}
25
static const char *suffixes[] = { "", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei" };
29
26
- unsigned long div;
30
- int64_t offset = req->sector_num * vexp->blk_size;
27
+ uint64_t div;
31
+ int64_t offset = req->sector_num << VIRTIO_BLK_SECTOR_BITS;
28
int i;
32
QEMUIOVector qiov;
29
33
if (is_write) {
30
/*
34
qemu_iovec_init_external(&qiov, out_iov, out_num);
31
--
35
--
32
2.20.1
36
2.29.2
33
37
34
38
diff view generated by jsdifflib
1
preallocate_co() already gave the data file the full size without
1
From: Stefan Hajnoczi <stefanha@redhat.com>
2
forwarding the requested preallocation mode to the protocol. When
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.
6
2
7
Pass the right preallocation mode to preallocate_co() and remove the
3
Validate discard/write zeroes the same way we do for virtio-blk. Some of
8
second bdrv_co_truncate() to fix this. As a side effect, the ugly
4
these checks are mandated by the VIRTIO specification, others are
9
one-byte write in preallocate_co() is replaced with a truncate call,
5
internal to QEMU.
10
now leaving the last block unallocated on the protocol level as it
11
should be.
12
6
13
Cc: qemu-stable@nongnu.org
7
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8
Message-Id: <20210223144653.811468-11-stefanha@redhat.com>
14
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
15
Reviewed-by: Eric Blake <eblake@redhat.com>
16
---
10
---
17
block/qcow2.c | 41 +++++++++++++++++++++++------------------
11
block/export/vhost-user-blk-server.c | 116 +++++++++++++++++++++------
18
1 file changed, 23 insertions(+), 18 deletions(-)
12
1 file changed, 93 insertions(+), 23 deletions(-)
19
13
20
diff --git a/block/qcow2.c b/block/qcow2.c
14
diff --git a/block/export/vhost-user-blk-server.c b/block/export/vhost-user-blk-server.c
21
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
22
--- a/block/qcow2.c
16
--- a/block/export/vhost-user-blk-server.c
23
+++ b/block/qcow2.c
17
+++ b/block/export/vhost-user-blk-server.c
24
@@ -XXX,XX +XXX,XX @@ static int qcow2_set_up_encryption(BlockDriverState *bs,
18
@@ -XXX,XX +XXX,XX @@
25
* Returns: 0 on success, -errno on failure.
19
26
*/
20
enum {
27
static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset,
21
VHOST_USER_BLK_NUM_QUEUES_DEFAULT = 1,
28
- uint64_t new_length, Error **errp)
22
+ VHOST_USER_BLK_MAX_DISCARD_SECTORS = 32768,
29
+ uint64_t new_length, PreallocMode mode,
23
+ VHOST_USER_BLK_MAX_WRITE_ZEROES_SECTORS = 32768,
30
+ Error **errp)
24
};
25
struct virtio_blk_inhdr {
26
unsigned char status;
27
@@ -XXX,XX +XXX,XX @@ static void vu_blk_req_complete(VuBlkReq *req)
28
free(req);
29
}
30
31
+static bool vu_blk_sect_range_ok(VuBlkExport *vexp, uint64_t sector,
32
+ size_t size)
33
+{
34
+ uint64_t nb_sectors = size >> BDRV_SECTOR_BITS;
35
+ uint64_t total_sectors;
36
+
37
+ if (nb_sectors > BDRV_REQUEST_MAX_SECTORS) {
38
+ return false;
39
+ }
40
+ if ((sector << VIRTIO_BLK_SECTOR_BITS) % vexp->blk_size) {
41
+ return false;
42
+ }
43
+ blk_get_geometry(vexp->export.blk, &total_sectors);
44
+ if (sector > total_sectors || nb_sectors > total_sectors - sector) {
45
+ return false;
46
+ }
47
+ return true;
48
+}
49
+
50
static int coroutine_fn
51
-vu_blk_discard_write_zeroes(BlockBackend *blk, struct iovec *iov,
52
+vu_blk_discard_write_zeroes(VuBlkExport *vexp, struct iovec *iov,
53
uint32_t iovcnt, uint32_t type)
31
{
54
{
32
BDRVQcow2State *s = bs->opaque;
55
+ BlockBackend *blk = vexp->export.blk;
33
uint64_t bytes;
56
struct virtio_blk_discard_write_zeroes desc;
34
uint64_t host_offset = 0;
57
- ssize_t size = iov_to_buf(iov, iovcnt, 0, &desc, sizeof(desc));
35
+ int64_t file_length;
58
+ ssize_t size;
36
unsigned int cur_bytes;
59
+ uint64_t sector;
37
int ret;
60
+ uint32_t num_sectors;
38
QCowL2Meta *meta;
61
+ uint32_t max_sectors;
39
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset,
62
+ uint32_t flags;
40
* all of the allocated clusters (otherwise we get failing reads after
63
+ int bytes;
41
* EOF). Extend the image to the last allocated sector.
64
+
42
*/
65
+ /* Only one desc is currently supported */
43
- if (host_offset != 0) {
66
+ if (unlikely(iov_size(iov, iovcnt) > sizeof(desc))) {
44
- uint8_t data = 0;
67
+ return VIRTIO_BLK_S_UNSUPP;
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;
51
+ }
68
+ }
52
+
69
+
53
+ if (host_offset + cur_bytes > file_length) {
70
+ size = iov_to_buf(iov, iovcnt, 0, &desc, sizeof(desc));
54
+ if (mode == PREALLOC_MODE_METADATA) {
71
if (unlikely(size != sizeof(desc))) {
55
+ mode = PREALLOC_MODE_OFF;
72
- error_report("Invalid size %zd, expect %zu", size, sizeof(desc));
73
- return -EINVAL;
74
+ error_report("Invalid size %zd, expected %zu", size, sizeof(desc));
75
+ return VIRTIO_BLK_S_IOERR;
76
}
77
78
- uint64_t range[2] = { le64_to_cpu(desc.sector) << 9,
79
- le32_to_cpu(desc.num_sectors) << 9 };
80
- if (type == VIRTIO_BLK_T_DISCARD) {
81
- if (blk_co_pdiscard(blk, range[0], range[1]) == 0) {
82
- return 0;
83
+ sector = le64_to_cpu(desc.sector);
84
+ num_sectors = le32_to_cpu(desc.num_sectors);
85
+ flags = le32_to_cpu(desc.flags);
86
+ max_sectors = (type == VIRTIO_BLK_T_WRITE_ZEROES) ?
87
+ VHOST_USER_BLK_MAX_WRITE_ZEROES_SECTORS :
88
+ VHOST_USER_BLK_MAX_DISCARD_SECTORS;
89
+
90
+ /* This check ensures that 'bytes' fits in an int */
91
+ if (unlikely(num_sectors > max_sectors)) {
92
+ return VIRTIO_BLK_S_IOERR;
93
+ }
94
+
95
+ bytes = num_sectors << VIRTIO_BLK_SECTOR_BITS;
96
+
97
+ if (unlikely(!vu_blk_sect_range_ok(vexp, sector, bytes))) {
98
+ return VIRTIO_BLK_S_IOERR;
99
+ }
100
+
101
+ /*
102
+ * The device MUST set the status byte to VIRTIO_BLK_S_UNSUPP for discard
103
+ * and write zeroes commands if any unknown flag is set.
104
+ */
105
+ if (unlikely(flags & ~VIRTIO_BLK_WRITE_ZEROES_FLAG_UNMAP)) {
106
+ return VIRTIO_BLK_S_UNSUPP;
107
+ }
108
+
109
+ if (type == VIRTIO_BLK_T_WRITE_ZEROES) {
110
+ int blk_flags = 0;
111
+
112
+ if (flags & VIRTIO_BLK_WRITE_ZEROES_FLAG_UNMAP) {
113
+ blk_flags |= BDRV_REQ_MAY_UNMAP;
56
+ }
114
+ }
57
+ ret = bdrv_co_truncate(s->data_file, host_offset + cur_bytes, mode,
115
+
58
+ errp);
116
+ if (blk_co_pwrite_zeroes(blk, sector << VIRTIO_BLK_SECTOR_BITS,
59
if (ret < 0) {
117
+ bytes, blk_flags) == 0) {
60
- error_setg_errno(errp, -ret, "Writing to EOF failed");
118
+ return VIRTIO_BLK_S_OK;
61
return ret;
119
}
120
- } else if (type == VIRTIO_BLK_T_WRITE_ZEROES) {
121
- if (blk_co_pwrite_zeroes(blk, range[0], range[1], 0) == 0) {
122
- return 0;
123
+ } else if (type == VIRTIO_BLK_T_DISCARD) {
124
+ /*
125
+ * The device MUST set the status byte to VIRTIO_BLK_S_UNSUPP for
126
+ * discard commands if the unmap flag is set.
127
+ */
128
+ if (unlikely(flags & VIRTIO_BLK_WRITE_ZEROES_FLAG_UNMAP)) {
129
+ return VIRTIO_BLK_S_UNSUPP;
130
+ }
131
+
132
+ if (blk_co_pdiscard(blk, sector << VIRTIO_BLK_SECTOR_BITS,
133
+ bytes) == 0) {
134
+ return VIRTIO_BLK_S_OK;
62
}
135
}
63
}
136
}
64
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
137
65
138
- return -EINVAL;
66
switch (prealloc) {
139
+ return VIRTIO_BLK_S_IOERR;
67
case PREALLOC_MODE_OFF:
140
}
68
+ if (has_data_file(bs)) {
141
69
+ ret = bdrv_co_truncate(s->data_file, offset, prealloc, errp);
142
static void coroutine_fn vu_blk_virtio_process_req(void *opaque)
70
+ if (ret < 0) {
143
@@ -XXX,XX +XXX,XX @@ static void coroutine_fn vu_blk_virtio_process_req(void *opaque)
71
+ goto fail;
144
}
72
+ }
145
case VIRTIO_BLK_T_DISCARD:
73
+ }
146
case VIRTIO_BLK_T_WRITE_ZEROES: {
147
- int rc;
148
-
149
if (!vexp->writable) {
150
req->in->status = VIRTIO_BLK_S_IOERR;
151
break;
152
}
153
154
- rc = vu_blk_discard_write_zeroes(blk, &elem->out_sg[1], out_num, type);
155
- if (rc == 0) {
156
- req->in->status = VIRTIO_BLK_S_OK;
157
- } else {
158
- req->in->status = VIRTIO_BLK_S_IOERR;
159
- }
160
+ req->in->status = vu_blk_discard_write_zeroes(vexp, out_iov, out_num,
161
+ type);
74
break;
162
break;
75
163
}
76
case PREALLOC_MODE_METADATA:
164
default:
77
- ret = preallocate_co(bs, old_length, offset, errp);
165
@@ -XXX,XX +XXX,XX @@ vu_blk_initialize_config(BlockDriverState *bs,
78
+ ret = preallocate_co(bs, old_length, offset, prealloc, errp);
166
config->min_io_size = cpu_to_le16(1);
79
if (ret < 0) {
167
config->opt_io_size = cpu_to_le32(1);
80
goto fail;
168
config->num_queues = cpu_to_le16(num_queues);
81
}
169
- config->max_discard_sectors = cpu_to_le32(32768);
82
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
170
+ config->max_discard_sectors =
83
/* With a data file, preallocation means just allocating the metadata
171
+ cpu_to_le32(VHOST_USER_BLK_MAX_DISCARD_SECTORS);
84
* and forwarding the truncate request to the data file */
172
config->max_discard_seg = cpu_to_le32(1);
85
if (has_data_file(bs)) {
173
config->discard_sector_alignment =
86
- ret = preallocate_co(bs, old_length, offset, errp);
174
cpu_to_le32(blk_size >> VIRTIO_BLK_SECTOR_BITS);
87
+ ret = preallocate_co(bs, old_length, offset, prealloc, errp);
175
- config->max_write_zeroes_sectors = cpu_to_le32(32768);
88
if (ret < 0) {
176
+ config->max_write_zeroes_sectors
89
goto fail;
177
+ = cpu_to_le32(VHOST_USER_BLK_MAX_WRITE_ZEROES_SECTORS);
90
}
178
config->max_write_zeroes_seg = cpu_to_le32(1);
91
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
179
}
92
180
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),
108
--
181
--
109
2.20.1
182
2.29.2
110
183
111
184
diff view generated by jsdifflib
1
From: Alberto Garcia <berto@igalia.com>
1
From: Stefan Hajnoczi <stefanha@redhat.com>
2
2
3
This patch fixes a few things in the way error codes are handled in
3
Exercise input validation code paths in
4
the qcow2 compression code:
4
block/export/vhost-user-blk-server.c.
5
5
6
a) qcow2_co_pwritev_compressed() expects qcow2_co_compress() to only
6
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7
return -1 or -2 on failure, but this is not correct. Since the
7
Message-Id: <20210223144653.811468-12-stefanha@redhat.com>
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.
19
20
Signed-off-by: Alberto Garcia <berto@igalia.com>
21
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
22
---
9
---
23
block/qcow2.c | 18 +++++++++---------
10
tests/qtest/vhost-user-blk-test.c | 124 ++++++++++++++++++++++++++++++
24
1 file changed, 9 insertions(+), 9 deletions(-)
11
1 file changed, 124 insertions(+)
25
12
26
diff --git a/block/qcow2.c b/block/qcow2.c
13
diff --git a/tests/qtest/vhost-user-blk-test.c b/tests/qtest/vhost-user-blk-test.c
27
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
28
--- a/block/qcow2.c
15
--- a/tests/qtest/vhost-user-blk-test.c
29
+++ b/block/qcow2.c
16
+++ b/tests/qtest/vhost-user-blk-test.c
30
@@ -XXX,XX +XXX,XX @@ fail:
17
@@ -XXX,XX +XXX,XX @@ static uint64_t virtio_blk_request(QGuestAllocator *alloc, QVirtioDevice *d,
31
* @src - source buffer, @src_size bytes
18
return addr;
32
*
19
}
33
* Returns: compressed size on success
20
34
- * -1 destination buffer is not enough to store compressed data
21
+static void test_invalid_discard_write_zeroes(QVirtioDevice *dev,
35
- * -2 on any other error
22
+ QGuestAllocator *alloc,
36
+ * -ENOMEM destination buffer is not enough to store compressed data
23
+ QTestState *qts,
37
+ * -EIO on any other error
24
+ QVirtQueue *vq,
38
*/
25
+ uint32_t type)
39
static ssize_t qcow2_compress(void *dest, size_t dest_size,
26
+{
40
const void *src, size_t src_size)
27
+ QVirtioBlkReq req;
41
@@ -XXX,XX +XXX,XX @@ static ssize_t qcow2_compress(void *dest, size_t dest_size,
28
+ struct virtio_blk_discard_write_zeroes dwz_hdr;
42
ret = deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
29
+ struct virtio_blk_discard_write_zeroes dwz_hdr2[2];
43
-12, 9, Z_DEFAULT_STRATEGY);
30
+ uint64_t req_addr;
44
if (ret != Z_OK) {
31
+ uint32_t free_head;
45
- return -2;
32
+ uint8_t status;
46
+ return -EIO;
33
+
34
+ /* More than one dwz is not supported */
35
+ req.type = type;
36
+ req.data = (char *) dwz_hdr2;
37
+ dwz_hdr2[0].sector = 0;
38
+ dwz_hdr2[0].num_sectors = 1;
39
+ dwz_hdr2[0].flags = 0;
40
+ dwz_hdr2[1].sector = 1;
41
+ dwz_hdr2[1].num_sectors = 1;
42
+ dwz_hdr2[1].flags = 0;
43
+
44
+ virtio_blk_fix_dwz_hdr(dev, &dwz_hdr2[0]);
45
+ virtio_blk_fix_dwz_hdr(dev, &dwz_hdr2[1]);
46
+
47
+ req_addr = virtio_blk_request(alloc, dev, &req, sizeof(dwz_hdr2));
48
+
49
+ free_head = qvirtqueue_add(qts, vq, req_addr, 16, false, true);
50
+ qvirtqueue_add(qts, vq, req_addr + 16, sizeof(dwz_hdr2), false, true);
51
+ qvirtqueue_add(qts, vq, req_addr + 16 + sizeof(dwz_hdr2), 1, true,
52
+ false);
53
+
54
+ qvirtqueue_kick(qts, dev, vq, free_head);
55
+
56
+ qvirtio_wait_used_elem(qts, dev, vq, free_head, NULL,
57
+ QVIRTIO_BLK_TIMEOUT_US);
58
+ status = readb(req_addr + 16 + sizeof(dwz_hdr2));
59
+ g_assert_cmpint(status, ==, VIRTIO_BLK_S_UNSUPP);
60
+
61
+ guest_free(alloc, req_addr);
62
+
63
+ /* num_sectors must be less than config->max_write_zeroes_sectors */
64
+ req.type = type;
65
+ req.data = (char *) &dwz_hdr;
66
+ dwz_hdr.sector = 0;
67
+ dwz_hdr.num_sectors = 0xffffffff;
68
+ dwz_hdr.flags = 0;
69
+
70
+ virtio_blk_fix_dwz_hdr(dev, &dwz_hdr);
71
+
72
+ req_addr = virtio_blk_request(alloc, dev, &req, sizeof(dwz_hdr));
73
+
74
+ free_head = qvirtqueue_add(qts, vq, req_addr, 16, false, true);
75
+ qvirtqueue_add(qts, vq, req_addr + 16, sizeof(dwz_hdr), false, true);
76
+ qvirtqueue_add(qts, vq, req_addr + 16 + sizeof(dwz_hdr), 1, true,
77
+ false);
78
+
79
+ qvirtqueue_kick(qts, dev, vq, free_head);
80
+
81
+ qvirtio_wait_used_elem(qts, dev, vq, free_head, NULL,
82
+ QVIRTIO_BLK_TIMEOUT_US);
83
+ status = readb(req_addr + 16 + sizeof(dwz_hdr));
84
+ g_assert_cmpint(status, ==, VIRTIO_BLK_S_IOERR);
85
+
86
+ guest_free(alloc, req_addr);
87
+
88
+ /* sector must be less than the device capacity */
89
+ req.type = type;
90
+ req.data = (char *) &dwz_hdr;
91
+ dwz_hdr.sector = TEST_IMAGE_SIZE / 512 + 1;
92
+ dwz_hdr.num_sectors = 1;
93
+ dwz_hdr.flags = 0;
94
+
95
+ virtio_blk_fix_dwz_hdr(dev, &dwz_hdr);
96
+
97
+ req_addr = virtio_blk_request(alloc, dev, &req, sizeof(dwz_hdr));
98
+
99
+ free_head = qvirtqueue_add(qts, vq, req_addr, 16, false, true);
100
+ qvirtqueue_add(qts, vq, req_addr + 16, sizeof(dwz_hdr), false, true);
101
+ qvirtqueue_add(qts, vq, req_addr + 16 + sizeof(dwz_hdr), 1, true,
102
+ false);
103
+
104
+ qvirtqueue_kick(qts, dev, vq, free_head);
105
+
106
+ qvirtio_wait_used_elem(qts, dev, vq, free_head, NULL,
107
+ QVIRTIO_BLK_TIMEOUT_US);
108
+ status = readb(req_addr + 16 + sizeof(dwz_hdr));
109
+ g_assert_cmpint(status, ==, VIRTIO_BLK_S_IOERR);
110
+
111
+ guest_free(alloc, req_addr);
112
+
113
+ /* reserved flag bits must be zero */
114
+ req.type = type;
115
+ req.data = (char *) &dwz_hdr;
116
+ dwz_hdr.sector = 0;
117
+ dwz_hdr.num_sectors = 1;
118
+ dwz_hdr.flags = ~VIRTIO_BLK_WRITE_ZEROES_FLAG_UNMAP;
119
+
120
+ virtio_blk_fix_dwz_hdr(dev, &dwz_hdr);
121
+
122
+ req_addr = virtio_blk_request(alloc, dev, &req, sizeof(dwz_hdr));
123
+
124
+ free_head = qvirtqueue_add(qts, vq, req_addr, 16, false, true);
125
+ qvirtqueue_add(qts, vq, req_addr + 16, sizeof(dwz_hdr), false, true);
126
+ qvirtqueue_add(qts, vq, req_addr + 16 + sizeof(dwz_hdr), 1, true,
127
+ false);
128
+
129
+ qvirtqueue_kick(qts, dev, vq, free_head);
130
+
131
+ qvirtio_wait_used_elem(qts, dev, vq, free_head, NULL,
132
+ QVIRTIO_BLK_TIMEOUT_US);
133
+ status = readb(req_addr + 16 + sizeof(dwz_hdr));
134
+ g_assert_cmpint(status, ==, VIRTIO_BLK_S_UNSUPP);
135
+
136
+ guest_free(alloc, req_addr);
137
+}
138
+
139
/* Returns the request virtqueue so the caller can perform further tests */
140
static QVirtQueue *test_basic(QVirtioDevice *dev, QGuestAllocator *alloc)
141
{
142
@@ -XXX,XX +XXX,XX @@ static QVirtQueue *test_basic(QVirtioDevice *dev, QGuestAllocator *alloc)
143
g_free(data);
144
145
guest_free(alloc, req_addr);
146
+
147
+ test_invalid_discard_write_zeroes(dev, alloc, qts, vq,
148
+ VIRTIO_BLK_T_WRITE_ZEROES);
47
}
149
}
48
150
49
/* strm.next_in is not const in old zlib versions, such as those used on
151
if (features & (1u << VIRTIO_BLK_F_DISCARD)) {
50
@@ -XXX,XX +XXX,XX @@ static ssize_t qcow2_compress(void *dest, size_t dest_size,
152
@@ -XXX,XX +XXX,XX @@ static QVirtQueue *test_basic(QVirtioDevice *dev, QGuestAllocator *alloc)
51
if (ret == Z_STREAM_END) {
153
g_assert_cmpint(status, ==, 0);
52
ret = dest_size - strm.avail_out;
154
53
} else {
155
guest_free(alloc, req_addr);
54
- ret = (ret == Z_OK ? -1 : -2);
156
+
55
+ ret = (ret == Z_OK ? -ENOMEM : -EIO);
157
+ test_invalid_discard_write_zeroes(dev, alloc, qts, vq,
158
+ VIRTIO_BLK_T_DISCARD);
56
}
159
}
57
160
58
deflateEnd(&strm);
161
if (features & (1u << VIRTIO_F_ANY_LAYOUT)) {
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;
81
}
82
goto success;
83
+ } else if (out_len < 0) {
84
+ ret = -EINVAL;
85
+ goto fail;
86
}
87
88
qemu_co_mutex_lock(&s->lock);
89
--
162
--
90
2.20.1
163
2.29.2
91
164
92
165
diff view generated by jsdifflib
1
We'll add a bdrv_co_truncate() call in the next patch which can return
1
From: Stefan Hajnoczi <stefanha@redhat.com>
2
an Error that we don't want to discard. So add an errp parameter to
3
preallocate_co().
4
2
5
Cc: qemu-stable@nongnu.org
3
Check that the sector number and byte count are valid.
4
5
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6
Message-Id: <20210223144653.811468-13-stefanha@redhat.com>
6
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7
Reviewed-by: Eric Blake <eblake@redhat.com>
8
---
8
---
9
block/qcow2.c | 11 ++++++-----
9
block/export/vhost-user-blk-server.c | 19 ++++++++++++++++---
10
1 file changed, 6 insertions(+), 5 deletions(-)
10
1 file changed, 16 insertions(+), 3 deletions(-)
11
11
12
diff --git a/block/qcow2.c b/block/qcow2.c
12
diff --git a/block/export/vhost-user-blk-server.c b/block/export/vhost-user-blk-server.c
13
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
14
--- a/block/qcow2.c
14
--- a/block/export/vhost-user-blk-server.c
15
+++ b/block/qcow2.c
15
+++ b/block/export/vhost-user-blk-server.c
16
@@ -XXX,XX +XXX,XX @@ static int qcow2_set_up_encryption(BlockDriverState *bs,
16
@@ -XXX,XX +XXX,XX @@ static void coroutine_fn vu_blk_virtio_process_req(void *opaque)
17
* Returns: 0 on success, -errno on failure.
17
switch (type & ~VIRTIO_BLK_T_BARRIER) {
18
*/
18
case VIRTIO_BLK_T_IN:
19
static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset,
19
case VIRTIO_BLK_T_OUT: {
20
- uint64_t new_length)
20
+ QEMUIOVector qiov;
21
+ uint64_t new_length, Error **errp)
21
+ int64_t offset;
22
{
22
ssize_t ret = 0;
23
BDRVQcow2State *s = bs->opaque;
23
bool is_write = type & VIRTIO_BLK_T_OUT;
24
uint64_t bytes;
24
req->sector_num = le64_to_cpu(req->out.sector);
25
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset,
25
@@ -XXX,XX +XXX,XX @@ static void coroutine_fn vu_blk_virtio_process_req(void *opaque)
26
ret = qcow2_alloc_cluster_offset(bs, offset, &cur_bytes,
26
break;
27
&host_offset, &meta);
28
if (ret < 0) {
29
+ error_setg_errno(errp, -ret, "Allocating clusters failed");
30
return ret;
31
}
27
}
32
28
33
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset,
29
- int64_t offset = req->sector_num << VIRTIO_BLK_SECTOR_BITS;
34
30
- QEMUIOVector qiov;
35
ret = qcow2_alloc_cluster_link_l2(bs, meta);
31
if (is_write) {
36
if (ret < 0) {
32
qemu_iovec_init_external(&qiov, out_iov, out_num);
37
+ error_setg_errno(errp, -ret, "Mapping clusters failed");
33
- ret = blk_co_pwritev(blk, offset, qiov.size, &qiov, 0);
38
qcow2_free_any_clusters(bs, meta->alloc_offset,
34
} else {
39
meta->nb_clusters, QCOW2_DISCARD_NEVER);
35
qemu_iovec_init_external(&qiov, in_iov, in_num);
40
return ret;
36
+ }
41
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset,
37
+
42
ret = bdrv_pwrite(s->data_file, (host_offset + cur_bytes) - 1,
38
+ if (unlikely(!vu_blk_sect_range_ok(vexp,
43
&data, 1);
39
+ req->sector_num,
44
if (ret < 0) {
40
+ qiov.size))) {
45
+ error_setg_errno(errp, -ret, "Writing to EOF failed");
41
+ req->in->status = VIRTIO_BLK_S_IOERR;
46
return ret;
42
+ break;
43
+ }
44
+
45
+ offset = req->sector_num << VIRTIO_BLK_SECTOR_BITS;
46
+
47
+ if (is_write) {
48
+ ret = blk_co_pwritev(blk, offset, qiov.size, &qiov, 0);
49
+ } else {
50
ret = blk_co_preadv(blk, offset, qiov.size, &qiov, 0);
47
}
51
}
48
}
52
if (ret >= 0) {
49
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
50
break;
51
52
case PREALLOC_MODE_METADATA:
53
- ret = preallocate_co(bs, old_length, offset);
54
+ ret = preallocate_co(bs, old_length, offset, errp);
55
if (ret < 0) {
56
- error_setg_errno(errp, -ret, "Preallocation failed");
57
goto fail;
58
}
59
break;
60
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
61
/* With a data file, preallocation means just allocating the metadata
62
* and forwarding the truncate request to the data file */
63
if (has_data_file(bs)) {
64
- ret = preallocate_co(bs, old_length, offset);
65
+ ret = preallocate_co(bs, old_length, offset, errp);
66
if (ret < 0) {
67
- error_setg_errno(errp, -ret, "Preallocation failed");
68
goto fail;
69
}
70
break;
71
--
53
--
72
2.20.1
54
2.29.2
73
55
74
56
diff view generated by jsdifflib
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
2
2
3
Rename bytes_covered_by_bitmap_cluster() to
4
bdrv_dirty_bitmap_serialization_coverage() and make it public.
5
It is needed as we are going to share it with bitmap loading in
6
parallels format.
7
3
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
8
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
4
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
9
Reviewed-by: Eric Blake <eblake@redhat.com>
5
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
10
Reviewed-by: Denis V. Lunev <den@openvz.org>
11
Message-Id: <20210224104707.88430-2-vsementsov@virtuozzo.com>
6
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7
---
13
---
8
block/commit.c | 5 ++---
14
include/block/dirty-bitmap.h | 2 ++
9
1 file changed, 2 insertions(+), 3 deletions(-)
15
block/dirty-bitmap.c | 13 +++++++++++++
16
block/qcow2-bitmap.c | 16 ++--------------
17
3 files changed, 17 insertions(+), 14 deletions(-)
10
18
11
diff --git a/block/commit.c b/block/commit.c
19
diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h
12
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
13
--- a/block/commit.c
21
--- a/include/block/dirty-bitmap.h
14
+++ b/block/commit.c
22
+++ b/include/block/dirty-bitmap.h
15
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn commit_populate(BlockBackend *bs, BlockBackend *base,
23
@@ -XXX,XX +XXX,XX @@ void bdrv_dirty_iter_free(BdrvDirtyBitmapIter *iter);
16
void *buf)
24
uint64_t bdrv_dirty_bitmap_serialization_size(const BdrvDirtyBitmap *bitmap,
17
{
25
uint64_t offset, uint64_t bytes);
18
int ret = 0;
26
uint64_t bdrv_dirty_bitmap_serialization_align(const BdrvDirtyBitmap *bitmap);
19
- QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes);
27
+uint64_t bdrv_dirty_bitmap_serialization_coverage(int serialized_chunk_size,
20
28
+ const BdrvDirtyBitmap *bitmap);
21
assert(bytes < SIZE_MAX);
29
void bdrv_dirty_bitmap_serialize_part(const BdrvDirtyBitmap *bitmap,
22
30
uint8_t *buf, uint64_t offset,
23
- ret = blk_co_preadv(bs, offset, qiov.size, &qiov, 0);
31
uint64_t bytes);
24
+ ret = blk_co_pread(bs, offset, bytes, buf, 0);
32
diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
25
if (ret < 0) {
33
index XXXXXXX..XXXXXXX 100644
26
return ret;
34
--- a/block/dirty-bitmap.c
35
+++ b/block/dirty-bitmap.c
36
@@ -XXX,XX +XXX,XX @@ uint64_t bdrv_dirty_bitmap_serialization_align(const BdrvDirtyBitmap *bitmap)
37
return hbitmap_serialization_align(bitmap->bitmap);
38
}
39
40
+/* Return the disk size covered by a chunk of serialized bitmap data. */
41
+uint64_t bdrv_dirty_bitmap_serialization_coverage(int serialized_chunk_size,
42
+ const BdrvDirtyBitmap *bitmap)
43
+{
44
+ uint64_t granularity = bdrv_dirty_bitmap_granularity(bitmap);
45
+ uint64_t limit = granularity * (serialized_chunk_size << 3);
46
+
47
+ assert(QEMU_IS_ALIGNED(limit,
48
+ bdrv_dirty_bitmap_serialization_align(bitmap)));
49
+ return limit;
50
+}
51
+
52
+
53
void bdrv_dirty_bitmap_serialize_part(const BdrvDirtyBitmap *bitmap,
54
uint8_t *buf, uint64_t offset,
55
uint64_t bytes)
56
diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
57
index XXXXXXX..XXXXXXX 100644
58
--- a/block/qcow2-bitmap.c
59
+++ b/block/qcow2-bitmap.c
60
@@ -XXX,XX +XXX,XX @@ static int free_bitmap_clusters(BlockDriverState *bs, Qcow2BitmapTable *tb)
61
return 0;
62
}
63
64
-/* Return the disk size covered by a single qcow2 cluster of bitmap data. */
65
-static uint64_t bytes_covered_by_bitmap_cluster(const BDRVQcow2State *s,
66
- const BdrvDirtyBitmap *bitmap)
67
-{
68
- uint64_t granularity = bdrv_dirty_bitmap_granularity(bitmap);
69
- uint64_t limit = granularity * (s->cluster_size << 3);
70
-
71
- assert(QEMU_IS_ALIGNED(limit,
72
- bdrv_dirty_bitmap_serialization_align(bitmap)));
73
- return limit;
74
-}
75
-
76
/* load_bitmap_data
77
* @bitmap_table entries must satisfy specification constraints.
78
* @bitmap must be cleared */
79
@@ -XXX,XX +XXX,XX @@ static int load_bitmap_data(BlockDriverState *bs,
27
}
80
}
28
81
29
- ret = blk_co_pwritev(base, offset, qiov.size, &qiov, 0);
82
buf = g_malloc(s->cluster_size);
30
+ ret = blk_co_pwrite(base, offset, bytes, buf, 0);
83
- limit = bytes_covered_by_bitmap_cluster(s, bitmap);
31
if (ret < 0) {
84
+ limit = bdrv_dirty_bitmap_serialization_coverage(s->cluster_size, bitmap);
32
return ret;
85
for (i = 0, offset = 0; i < tab_size; ++i, offset += limit) {
86
uint64_t count = MIN(bm_size - offset, limit);
87
uint64_t entry = bitmap_table[i];
88
@@ -XXX,XX +XXX,XX @@ static uint64_t *store_bitmap_data(BlockDriverState *bs,
33
}
89
}
90
91
buf = g_malloc(s->cluster_size);
92
- limit = bytes_covered_by_bitmap_cluster(s, bitmap);
93
+ limit = bdrv_dirty_bitmap_serialization_coverage(s->cluster_size, bitmap);
94
assert(DIV_ROUND_UP(bm_size, limit) == tb_size);
95
96
offset = 0;
34
--
97
--
35
2.20.1
98
2.29.2
36
99
37
100
diff view generated by jsdifflib
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
2
2
3
Actually L1 table entry offset is in 512 bytes sectors. Fix the spec.
4
3
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
4
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
6
Message-Id: <20210224104707.88430-3-vsementsov@virtuozzo.com>
5
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
7
Reviewed-by: Denis V. Lunev <den@openvz.org>
6
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7
---
9
---
8
qemu-img.c | 13 ++++---------
10
docs/interop/parallels.txt | 28 ++++++++++++++++------------
9
1 file changed, 4 insertions(+), 9 deletions(-)
11
1 file changed, 16 insertions(+), 12 deletions(-)
10
12
11
diff --git a/qemu-img.c b/qemu-img.c
13
diff --git a/docs/interop/parallels.txt b/docs/interop/parallels.txt
12
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
13
--- a/qemu-img.c
15
--- a/docs/interop/parallels.txt
14
+++ b/qemu-img.c
16
+++ b/docs/interop/parallels.txt
15
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn convert_co_read(ImgConvertState *s, int64_t sector_num,
17
@@ -XXX,XX +XXX,XX @@ of its data area are:
16
int nb_sectors, uint8_t *buf)
18
28 - 31: l1_size
17
{
19
The number of entries in the L1 table of the bitmap.
18
int n, ret;
20
19
- QEMUIOVector qiov;
21
- variable: l1_table (8 * l1_size bytes)
20
22
- L1 offset table (in bytes)
21
assert(nb_sectors <= s->buf_sectors);
23
+ variable: L1 offset table (l1_table), size: 8 * l1_size bytes
22
while (nb_sectors > 0) {
24
23
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn convert_co_read(ImgConvertState *s, int64_t sector_num,
25
-A dirty bitmap is stored using a one-level structure for the mapping to host
24
bs_sectors = s->src_sectors[src_cur];
26
-clusters - an L1 table.
25
27
+The dirty bitmap described by this feature extension is stored in a set of
26
n = MIN(nb_sectors, bs_sectors - (sector_num - src_cur_offset));
28
+clusters inside the Parallels image file. The offsets of these clusters are
27
- qemu_iovec_init_buf(&qiov, buf, n << BDRV_SECTOR_BITS);
29
+saved in the L1 offset table specified by the feature extension. Each L1 table
28
30
+entry is a 64 bit integer as described below:
29
- ret = blk_co_preadv(
31
30
+ ret = blk_co_pread(
32
-Given an offset in bytes into the bitmap data, the offset in bytes into the
31
blk, (sector_num - src_cur_offset) << BDRV_SECTOR_BITS,
33
-image file can be obtained as follows:
32
- n << BDRV_SECTOR_BITS, &qiov, 0);
34
+Given an offset in bytes into the bitmap data, corresponding L1 entry is
33
+ n << BDRV_SECTOR_BITS, buf, 0);
35
34
if (ret < 0) {
36
- offset = l1_table[offset / cluster_size] + (offset % cluster_size)
35
return ret;
37
+ l1_table[offset / cluster_size]
36
}
38
37
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn convert_co_write(ImgConvertState *s, int64_t sector_num,
39
-If an L1 table entry is 0, the corresponding cluster of the bitmap is assumed
38
enum ImgConvertBlockStatus status)
40
-to be zero.
39
{
41
+If an L1 table entry is 0, all bits in the corresponding cluster of the bitmap
40
int ret;
42
+are assumed to be 0.
41
- QEMUIOVector qiov;
43
42
44
-If an L1 table entry is 1, the corresponding cluster of the bitmap is assumed
43
while (nb_sectors > 0) {
45
-to have all bits set.
44
int n = nb_sectors;
46
+If an L1 table entry is 1, all bits in the corresponding cluster of the bitmap
45
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn convert_co_write(ImgConvertState *s, int64_t sector_num,
47
+are assumed to be 1.
46
(s->compressed &&
48
47
!buffer_is_zero(buf, n * BDRV_SECTOR_SIZE)))
49
-If an L1 table entry is not 0 or 1, it allocates a cluster from the data area.
48
{
50
+If an L1 table entry is not 0 or 1, it contains the corresponding cluster
49
- qemu_iovec_init_buf(&qiov, buf, n << BDRV_SECTOR_BITS);
51
+offset (in 512b sectors). Given an offset in bytes into the bitmap data the
50
-
52
+offset in bytes into the image file can be obtained as follows:
51
- ret = blk_co_pwritev(s->target, sector_num << BDRV_SECTOR_BITS,
53
+
52
- n << BDRV_SECTOR_BITS, &qiov, flags);
54
+ offset = l1_table[offset / cluster_size] * 512 + (offset % cluster_size)
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
}
58
--
55
--
59
2.20.1
56
2.29.2
60
57
61
58
diff view generated by jsdifflib
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
2
2
3
We are going to use it in more places, calculating
4
"s->tracks << BDRV_SECTOR_BITS" doesn't look good.
5
3
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
6
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
4
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
7
Message-Id: <20210224104707.88430-4-vsementsov@virtuozzo.com>
5
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
8
Reviewed-by: Denis V. Lunev <den@openvz.org>
6
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7
---
10
---
8
block/parallels.c | 14 ++++++--------
11
block/parallels.h | 1 +
9
1 file changed, 6 insertions(+), 8 deletions(-)
12
block/parallels.c | 8 ++++----
13
2 files changed, 5 insertions(+), 4 deletions(-)
10
14
15
diff --git a/block/parallels.h b/block/parallels.h
16
index XXXXXXX..XXXXXXX 100644
17
--- a/block/parallels.h
18
+++ b/block/parallels.h
19
@@ -XXX,XX +XXX,XX @@ typedef struct BDRVParallelsState {
20
ParallelsPreallocMode prealloc_mode;
21
22
unsigned int tracks;
23
+ unsigned int cluster_size;
24
25
unsigned int off_multiplier;
26
Error *migration_blocker;
11
diff --git a/block/parallels.c b/block/parallels.c
27
diff --git a/block/parallels.c b/block/parallels.c
12
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
13
--- a/block/parallels.c
29
--- a/block/parallels.c
14
+++ b/block/parallels.c
30
+++ b/block/parallels.c
15
@@ -XXX,XX +XXX,XX @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num,
31
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn parallels_co_check(BlockDriverState *bs,
16
if (bs->backing) {
32
int ret;
17
int64_t nb_cow_sectors = to_allocate * s->tracks;
33
uint32_t i;
18
int64_t nb_cow_bytes = nb_cow_sectors << BDRV_SECTOR_BITS;
34
bool flush_bat = false;
19
- QEMUIOVector qiov =
35
- int cluster_size = s->tracks << BDRV_SECTOR_BITS;
20
- QEMU_IOVEC_INIT_BUF(qiov, qemu_blockalign(bs, nb_cow_bytes),
36
21
- nb_cow_bytes);
37
size = bdrv_getlength(bs->file->bs);
22
+ void *buf = qemu_blockalign(bs, nb_cow_bytes);
38
if (size < 0) {
23
39
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn parallels_co_check(BlockDriverState *bs,
24
- ret = bdrv_co_preadv(bs->backing, idx * s->tracks * BDRV_SECTOR_SIZE,
40
high_off = off;
25
- nb_cow_bytes, &qiov, 0);
26
+ ret = bdrv_co_pread(bs->backing, idx * s->tracks * BDRV_SECTOR_SIZE,
27
+ nb_cow_bytes, buf, 0);
28
if (ret < 0) {
29
- qemu_vfree(qemu_iovec_buf(&qiov));
30
+ qemu_vfree(buf);
31
return ret;
32
}
41
}
33
42
34
ret = bdrv_co_pwritev(bs->file, s->data_end * BDRV_SECTOR_SIZE,
43
- if (prev_off != 0 && (prev_off + cluster_size) != off) {
35
- nb_cow_bytes, &qiov, 0);
44
+ if (prev_off != 0 && (prev_off + s->cluster_size) != off) {
36
- qemu_vfree(qemu_iovec_buf(&qiov));
45
res->bfi.fragmented_clusters++;
37
+ nb_cow_bytes, buf, 0);
38
+ qemu_vfree(buf);
39
if (ret < 0) {
40
return ret;
41
}
46
}
47
prev_off = off;
48
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn parallels_co_check(BlockDriverState *bs,
49
}
50
}
51
52
- res->image_end_offset = high_off + cluster_size;
53
+ res->image_end_offset = high_off + s->cluster_size;
54
if (size > res->image_end_offset) {
55
int64_t count;
56
- count = DIV_ROUND_UP(size - res->image_end_offset, cluster_size);
57
+ count = DIV_ROUND_UP(size - res->image_end_offset, s->cluster_size);
58
fprintf(stderr, "%s space leaked at the end of the image %" PRId64 "\n",
59
fix & BDRV_FIX_LEAKS ? "Repairing" : "ERROR",
60
size - res->image_end_offset);
61
@@ -XXX,XX +XXX,XX @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags,
62
ret = -EFBIG;
63
goto fail;
64
}
65
+ s->cluster_size = s->tracks << BDRV_SECTOR_BITS;
66
67
s->bat_size = le32_to_cpu(ph.bat_entries);
68
if (s->bat_size > INT_MAX / sizeof(uint32_t)) {
42
--
69
--
43
2.20.1
70
2.29.2
44
71
45
72
diff view generated by jsdifflib
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
2
2
3
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
3
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
4
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
4
Message-Id: <20210224104707.88430-5-vsementsov@virtuozzo.com>
5
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
5
Reviewed-by: Denis V. Lunev <den@openvz.org>
6
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
6
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7
---
7
---
8
include/block/block_int.h | 16 ++++++++++++++++
8
block/parallels.h | 6 +-
9
include/sysemu/block-backend.h | 19 +++++++++++++++++++
9
block/parallels-ext.c | 300 ++++++++++++++++++++++++++++++++++++++++++
10
2 files changed, 35 insertions(+)
10
block/parallels.c | 18 +++
11
block/meson.build | 3 +-
12
4 files changed, 325 insertions(+), 2 deletions(-)
13
create mode 100644 block/parallels-ext.c
11
14
12
diff --git a/include/block/block_int.h b/include/block/block_int.h
15
diff --git a/block/parallels.h b/block/parallels.h
13
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
14
--- a/include/block/block_int.h
17
--- a/block/parallels.h
15
+++ b/include/block/block_int.h
18
+++ b/block/parallels.h
16
@@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_pwritev(BdrvChild *child,
19
@@ -XXX,XX +XXX,XX @@ typedef struct ParallelsHeader {
17
int64_t offset, unsigned int bytes, QEMUIOVector *qiov,
20
uint64_t nb_sectors;
18
BdrvRequestFlags flags);
21
uint32_t inuse;
19
22
uint32_t data_off;
20
+static inline int coroutine_fn bdrv_co_pread(BdrvChild *child,
23
- char padding[12];
21
+ int64_t offset, unsigned int bytes, void *buf, BdrvRequestFlags flags)
24
+ uint32_t flags;
25
+ uint64_t ext_off;
26
} QEMU_PACKED ParallelsHeader;
27
28
typedef enum ParallelsPreallocMode {
29
@@ -XXX,XX +XXX,XX @@ typedef struct BDRVParallelsState {
30
Error *migration_blocker;
31
} BDRVParallelsState;
32
33
+int parallels_read_format_extension(BlockDriverState *bs,
34
+ int64_t ext_off, Error **errp);
35
+
36
#endif
37
diff --git a/block/parallels-ext.c b/block/parallels-ext.c
38
new file mode 100644
39
index XXXXXXX..XXXXXXX
40
--- /dev/null
41
+++ b/block/parallels-ext.c
42
@@ -XXX,XX +XXX,XX @@
43
+/*
44
+ * Support of Parallels Format Extension. It's a part of Parallels format
45
+ * driver.
46
+ *
47
+ * Copyright (c) 2021 Virtuozzo International GmbH
48
+ *
49
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
50
+ * of this software and associated documentation files (the "Software"), to deal
51
+ * in the Software without restriction, including without limitation the rights
52
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
53
+ * copies of the Software, and to permit persons to whom the Software is
54
+ * furnished to do so, subject to the following conditions:
55
+ *
56
+ * The above copyright notice and this permission notice shall be included in
57
+ * all copies or substantial portions of the Software.
58
+ *
59
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
60
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
61
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
62
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
63
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
64
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
65
+ * THE SOFTWARE.
66
+ */
67
+
68
+#include "qemu/osdep.h"
69
+#include "qapi/error.h"
70
+#include "block/block_int.h"
71
+#include "parallels.h"
72
+#include "crypto/hash.h"
73
+#include "qemu/uuid.h"
74
+
75
+#define PARALLELS_FORMAT_EXTENSION_MAGIC 0xAB234CEF23DCEA87ULL
76
+
77
+#define PARALLELS_END_OF_FEATURES_MAGIC 0x0ULL
78
+#define PARALLELS_DIRTY_BITMAP_FEATURE_MAGIC 0x20385FAE252CB34AULL
79
+
80
+typedef struct ParallelsFormatExtensionHeader {
81
+ uint64_t magic; /* PARALLELS_FORMAT_EXTENSION_MAGIC */
82
+ uint8_t check_sum[16];
83
+} QEMU_PACKED ParallelsFormatExtensionHeader;
84
+
85
+typedef struct ParallelsFeatureHeader {
86
+ uint64_t magic;
87
+ uint64_t flags;
88
+ uint32_t data_size;
89
+ uint32_t _unused;
90
+} QEMU_PACKED ParallelsFeatureHeader;
91
+
92
+typedef struct ParallelsDirtyBitmapFeature {
93
+ uint64_t size;
94
+ uint8_t id[16];
95
+ uint32_t granularity;
96
+ uint32_t l1_size;
97
+ /* L1 table follows */
98
+} QEMU_PACKED ParallelsDirtyBitmapFeature;
99
+
100
+/* Given L1 table read bitmap data from the image and populate @bitmap */
101
+static int parallels_load_bitmap_data(BlockDriverState *bs,
102
+ const uint64_t *l1_table,
103
+ uint32_t l1_size,
104
+ BdrvDirtyBitmap *bitmap,
105
+ Error **errp)
22
+{
106
+{
23
+ QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes);
107
+ BDRVParallelsState *s = bs->opaque;
24
+
108
+ int ret = 0;
25
+ return bdrv_co_preadv(child, offset, bytes, &qiov, flags);
109
+ uint64_t offset, limit;
110
+ uint64_t bm_size = bdrv_dirty_bitmap_size(bitmap);
111
+ uint8_t *buf = NULL;
112
+ uint64_t i, tab_size =
113
+ DIV_ROUND_UP(bdrv_dirty_bitmap_serialization_size(bitmap, 0, bm_size),
114
+ s->cluster_size);
115
+
116
+ if (tab_size != l1_size) {
117
+ error_setg(errp, "Bitmap table size %" PRIu32 " does not correspond "
118
+ "to bitmap size and cluster size. Expected %" PRIu64,
119
+ l1_size, tab_size);
120
+ return -EINVAL;
121
+ }
122
+
123
+ buf = qemu_blockalign(bs, s->cluster_size);
124
+ limit = bdrv_dirty_bitmap_serialization_coverage(s->cluster_size, bitmap);
125
+ for (i = 0, offset = 0; i < tab_size; ++i, offset += limit) {
126
+ uint64_t count = MIN(bm_size - offset, limit);
127
+ uint64_t entry = l1_table[i];
128
+
129
+ if (entry == 0) {
130
+ /* No need to deserialize zeros because @bitmap is cleared. */
131
+ continue;
132
+ }
133
+
134
+ if (entry == 1) {
135
+ bdrv_dirty_bitmap_deserialize_ones(bitmap, offset, count, false);
136
+ } else {
137
+ ret = bdrv_pread(bs->file, entry << BDRV_SECTOR_BITS, buf,
138
+ s->cluster_size);
139
+ if (ret < 0) {
140
+ error_setg_errno(errp, -ret,
141
+ "Failed to read bitmap data cluster");
142
+ goto finish;
143
+ }
144
+ bdrv_dirty_bitmap_deserialize_part(bitmap, buf, offset, count,
145
+ false);
146
+ }
147
+ }
148
+ ret = 0;
149
+
150
+ bdrv_dirty_bitmap_deserialize_finish(bitmap);
151
+
152
+finish:
153
+ qemu_vfree(buf);
154
+
155
+ return ret;
26
+}
156
+}
27
+
157
+
28
+static inline int coroutine_fn bdrv_co_pwrite(BdrvChild *child,
158
+/*
29
+ int64_t offset, unsigned int bytes, void *buf, BdrvRequestFlags flags)
159
+ * @data buffer (of @data_size size) is the Dirty bitmaps feature which
160
+ * consists of ParallelsDirtyBitmapFeature followed by L1 table.
161
+ */
162
+static BdrvDirtyBitmap *parallels_load_bitmap(BlockDriverState *bs,
163
+ uint8_t *data,
164
+ size_t data_size,
165
+ Error **errp)
30
+{
166
+{
31
+ QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes);
167
+ int ret;
32
+
168
+ ParallelsDirtyBitmapFeature bf;
33
+ return bdrv_co_pwritev(child, offset, bytes, &qiov, flags);
169
+ g_autofree uint64_t *l1_table = NULL;
170
+ BdrvDirtyBitmap *bitmap;
171
+ QemuUUID uuid;
172
+ char uuidstr[UUID_FMT_LEN + 1];
173
+ int i;
174
+
175
+ if (data_size < sizeof(bf)) {
176
+ error_setg(errp, "Too small Bitmap Feature area in Parallels Format "
177
+ "Extension: %zu bytes, expected at least %zu bytes",
178
+ data_size, sizeof(bf));
179
+ return NULL;
180
+ }
181
+ memcpy(&bf, data, sizeof(bf));
182
+ bf.size = le64_to_cpu(bf.size);
183
+ bf.granularity = le32_to_cpu(bf.granularity) << BDRV_SECTOR_BITS;
184
+ bf.l1_size = le32_to_cpu(bf.l1_size);
185
+ data += sizeof(bf);
186
+ data_size -= sizeof(bf);
187
+
188
+ if (bf.size != bs->total_sectors) {
189
+ error_setg(errp, "Bitmap size (in sectors) %" PRId64 " differs from "
190
+ "disk size in sectors %" PRId64, bf.size, bs->total_sectors);
191
+ return NULL;
192
+ }
193
+
194
+ if (bf.l1_size * sizeof(uint64_t) > data_size) {
195
+ error_setg(errp, "Bitmaps feature corrupted: l1 table exceeds "
196
+ "extension data_size");
197
+ return NULL;
198
+ }
199
+
200
+ memcpy(&uuid, bf.id, sizeof(uuid));
201
+ qemu_uuid_unparse(&uuid, uuidstr);
202
+ bitmap = bdrv_create_dirty_bitmap(bs, bf.granularity, uuidstr, errp);
203
+ if (!bitmap) {
204
+ return NULL;
205
+ }
206
+
207
+ l1_table = g_new(uint64_t, bf.l1_size);
208
+ for (i = 0; i < bf.l1_size; i++, data += sizeof(uint64_t)) {
209
+ l1_table[i] = ldq_le_p(data);
210
+ }
211
+
212
+ ret = parallels_load_bitmap_data(bs, l1_table, bf.l1_size, bitmap, errp);
213
+ if (ret < 0) {
214
+ bdrv_release_dirty_bitmap(bitmap);
215
+ return NULL;
216
+ }
217
+
218
+ /* We support format extension only for RO parallels images. */
219
+ assert(!(bs->open_flags & BDRV_O_RDWR));
220
+ bdrv_dirty_bitmap_set_readonly(bitmap, true);
221
+
222
+ return bitmap;
34
+}
223
+}
35
+
224
+
36
extern unsigned int bdrv_drain_all_count;
225
+static int parallels_parse_format_extension(BlockDriverState *bs,
37
void bdrv_apply_subtree_drain(BdrvChild *child, BlockDriverState *new_parent);
226
+ uint8_t *ext_cluster, Error **errp)
38
void bdrv_unapply_subtree_drain(BdrvChild *child, BlockDriverState *old_parent);
227
+{
39
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
228
+ BDRVParallelsState *s = bs->opaque;
229
+ int ret;
230
+ int remaining = s->cluster_size;
231
+ uint8_t *pos = ext_cluster;
232
+ ParallelsFormatExtensionHeader eh;
233
+ g_autofree uint8_t *hash = NULL;
234
+ size_t hash_len = 0;
235
+ GSList *bitmaps = NULL, *el;
236
+
237
+ memcpy(&eh, pos, sizeof(eh));
238
+ eh.magic = le64_to_cpu(eh.magic);
239
+ pos += sizeof(eh);
240
+ remaining -= sizeof(eh);
241
+
242
+ if (eh.magic != PARALLELS_FORMAT_EXTENSION_MAGIC) {
243
+ error_setg(errp, "Wrong parallels Format Extension magic: 0x%" PRIx64
244
+ ", expected: 0x%llx", eh.magic,
245
+ PARALLELS_FORMAT_EXTENSION_MAGIC);
246
+ goto fail;
247
+ }
248
+
249
+ ret = qcrypto_hash_bytes(QCRYPTO_HASH_ALG_MD5, (char *)pos, remaining,
250
+ &hash, &hash_len, errp);
251
+ if (ret < 0) {
252
+ goto fail;
253
+ }
254
+
255
+ if (hash_len != sizeof(eh.check_sum) ||
256
+ memcmp(hash, eh.check_sum, sizeof(eh.check_sum)) != 0) {
257
+ error_setg(errp, "Wrong checksum in Format Extension header. Format "
258
+ "extension is corrupted.");
259
+ goto fail;
260
+ }
261
+
262
+ while (true) {
263
+ ParallelsFeatureHeader fh;
264
+ BdrvDirtyBitmap *bitmap;
265
+
266
+ if (remaining < sizeof(fh)) {
267
+ error_setg(errp, "Can not read feature header, as remaining bytes "
268
+ "(%d) in Format Extension is less than Feature header "
269
+ "size (%zu)", remaining, sizeof(fh));
270
+ goto fail;
271
+ }
272
+
273
+ memcpy(&fh, pos, sizeof(fh));
274
+ pos += sizeof(fh);
275
+ remaining -= sizeof(fh);
276
+
277
+ fh.magic = le64_to_cpu(fh.magic);
278
+ fh.flags = le64_to_cpu(fh.flags);
279
+ fh.data_size = le32_to_cpu(fh.data_size);
280
+
281
+ if (fh.flags) {
282
+ error_setg(errp, "Flags for extension feature are unsupported");
283
+ goto fail;
284
+ }
285
+
286
+ if (fh.data_size > remaining) {
287
+ error_setg(errp, "Feature data_size exceedes Format Extension "
288
+ "cluster");
289
+ goto fail;
290
+ }
291
+
292
+ switch (fh.magic) {
293
+ case PARALLELS_END_OF_FEATURES_MAGIC:
294
+ return 0;
295
+
296
+ case PARALLELS_DIRTY_BITMAP_FEATURE_MAGIC:
297
+ bitmap = parallels_load_bitmap(bs, pos, fh.data_size, errp);
298
+ if (!bitmap) {
299
+ goto fail;
300
+ }
301
+ bitmaps = g_slist_append(bitmaps, bitmap);
302
+ break;
303
+
304
+ default:
305
+ error_setg(errp, "Unknown feature: 0x%" PRIu64, fh.magic);
306
+ goto fail;
307
+ }
308
+
309
+ pos = ext_cluster + QEMU_ALIGN_UP(pos + fh.data_size - ext_cluster, 8);
310
+ }
311
+
312
+fail:
313
+ for (el = bitmaps; el; el = el->next) {
314
+ bdrv_release_dirty_bitmap(el->data);
315
+ }
316
+ g_slist_free(bitmaps);
317
+
318
+ return -EINVAL;
319
+}
320
+
321
+int parallels_read_format_extension(BlockDriverState *bs,
322
+ int64_t ext_off, Error **errp)
323
+{
324
+ BDRVParallelsState *s = bs->opaque;
325
+ int ret;
326
+ uint8_t *ext_cluster = qemu_blockalign(bs, s->cluster_size);
327
+
328
+ assert(ext_off > 0);
329
+
330
+ ret = bdrv_pread(bs->file, ext_off, ext_cluster, s->cluster_size);
331
+ if (ret < 0) {
332
+ error_setg_errno(errp, -ret, "Failed to read Format Extension cluster");
333
+ goto out;
334
+ }
335
+
336
+ ret = parallels_parse_format_extension(bs, ext_cluster, errp);
337
+
338
+out:
339
+ qemu_vfree(ext_cluster);
340
+
341
+ return ret;
342
+}
343
diff --git a/block/parallels.c b/block/parallels.c
40
index XXXXXXX..XXXXXXX 100644
344
index XXXXXXX..XXXXXXX 100644
41
--- a/include/sysemu/block-backend.h
345
--- a/block/parallels.c
42
+++ b/include/sysemu/block-backend.h
346
+++ b/block/parallels.c
43
@@ -XXX,XX +XXX,XX @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset,
347
@@ -XXX,XX +XXX,XX @@
44
int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset,
348
*/
45
unsigned int bytes, QEMUIOVector *qiov,
349
46
BdrvRequestFlags flags);
350
#include "qemu/osdep.h"
47
+
351
+#include "qemu/error-report.h"
48
+static inline int coroutine_fn blk_co_pread(BlockBackend *blk, int64_t offset,
352
#include "qapi/error.h"
49
+ unsigned int bytes, void *buf,
353
#include "block/block_int.h"
50
+ BdrvRequestFlags flags)
354
#include "block/qdict.h"
51
+{
355
@@ -XXX,XX +XXX,XX @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags,
52
+ QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes);
356
goto fail_options;
53
+
357
}
54
+ return blk_co_preadv(blk, offset, bytes, &qiov, flags);
358
55
+}
359
+ if (ph.ext_off) {
56
+
360
+ if (flags & BDRV_O_RDWR) {
57
+static inline int coroutine_fn blk_co_pwrite(BlockBackend *blk, int64_t offset,
361
+ /*
58
+ unsigned int bytes, void *buf,
362
+ * It's unsafe to open image RW if there is an extension (as we
59
+ BdrvRequestFlags flags)
363
+ * don't support it). But parallels driver in QEMU historically
60
+{
364
+ * ignores the extension, so print warning and don't care.
61
+ QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes);
365
+ */
62
+
366
+ warn_report("Format Extension ignored in RW mode");
63
+ return blk_co_pwritev(blk, offset, bytes, &qiov, flags);
367
+ } else {
64
+}
368
+ ret = parallels_read_format_extension(
65
+
369
+ bs, le64_to_cpu(ph.ext_off) << BDRV_SECTOR_BITS, errp);
66
int blk_pwrite_zeroes(BlockBackend *blk, int64_t offset,
370
+ if (ret < 0) {
67
int bytes, BdrvRequestFlags flags);
371
+ goto fail;
68
BlockAIOCB *blk_aio_pwrite_zeroes(BlockBackend *blk, int64_t offset,
372
+ }
373
+ }
374
+ }
375
+
376
if ((flags & BDRV_O_RDWR) && !(flags & BDRV_O_INACTIVE)) {
377
s->header->inuse = cpu_to_le32(HEADER_INUSE_MAGIC);
378
ret = parallels_update_header(bs);
379
diff --git a/block/meson.build b/block/meson.build
380
index XXXXXXX..XXXXXXX 100644
381
--- a/block/meson.build
382
+++ b/block/meson.build
383
@@ -XXX,XX +XXX,XX @@ block_ss.add(when: 'CONFIG_QED', if_true: files(
384
'qed-table.c',
385
'qed.c',
386
))
387
-block_ss.add(when: [libxml2, 'CONFIG_PARALLELS'], if_true: files('parallels.c'))
388
+block_ss.add(when: [libxml2, 'CONFIG_PARALLELS'],
389
+ if_true: files('parallels.c', 'parallels-ext.c'))
390
block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-win32.c', 'win32-aio.c'))
391
block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), coref, iokit])
392
block_ss.add(when: libiscsi, if_true: files('iscsi-opts.c'))
69
--
393
--
70
2.20.1
394
2.29.2
71
395
72
396
diff view generated by jsdifflib
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
2
2
3
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
3
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
4
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
4
Message-Id: <20210224104707.88430-6-vsementsov@virtuozzo.com>
5
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
5
Reviewed-by: Denis V. Lunev <den@openvz.org>
6
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
6
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7
---
7
---
8
block/qcow2.c | 9 ++-------
8
tests/qemu-iotests/iotests.py | 10 ++++++++++
9
1 file changed, 2 insertions(+), 7 deletions(-)
9
1 file changed, 10 insertions(+)
10
10
11
diff --git a/block/qcow2.c b/block/qcow2.c
11
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
12
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
13
--- a/block/qcow2.c
13
--- a/tests/qemu-iotests/iotests.py
14
+++ b/block/qcow2.c
14
+++ b/tests/qemu-iotests/iotests.py
15
@@ -XXX,XX +XXX,XX @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset,
15
@@ -XXX,XX +XXX,XX @@
16
uint64_t bytes, QEMUIOVector *qiov)
16
#
17
{
17
18
BDRVQcow2State *s = bs->opaque;
18
import atexit
19
- QEMUIOVector hd_qiov;
19
+import bz2
20
int ret;
20
from collections import OrderedDict
21
ssize_t out_len;
21
import faulthandler
22
uint8_t *buf, *out_buf;
22
import io
23
@@ -XXX,XX +XXX,XX @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset,
23
@@ -XXX,XX +XXX,XX @@
24
goto fail;
24
import logging
25
}
25
import os
26
26
import re
27
- qemu_iovec_init_buf(&hd_qiov, out_buf, out_len);
27
+import shutil
28
-
28
import signal
29
BLKDBG_EVENT(s->data_file, BLKDBG_WRITE_COMPRESSED);
29
import struct
30
- ret = bdrv_co_pwritev(s->data_file, cluster_offset, out_len, &hd_qiov, 0);
30
import subprocess
31
+ ret = bdrv_co_pwrite(s->data_file, cluster_offset, out_len, out_buf, 0);
31
@@ -XXX,XX +XXX,XX @@
32
if (ret < 0) {
32
os.environ.get('IMGKEYSECRET', '')
33
goto fail;
33
luks_default_key_secret_opt = 'key-secret=keysec0'
34
}
34
35
@@ -XXX,XX +XXX,XX @@ qcow2_co_preadv_compressed(BlockDriverState *bs,
35
+sample_img_dir = os.environ['SAMPLE_IMG_DIR']
36
int ret = 0, csize, nb_csectors;
36
+
37
uint64_t coffset;
37
+
38
uint8_t *buf, *out_buf;
38
+def unarchive_sample_image(sample, fname):
39
- QEMUIOVector local_qiov;
39
+ sample_fname = os.path.join(sample_img_dir, sample + '.bz2')
40
int offset_in_cluster = offset_into_cluster(s, offset);
40
+ with bz2.open(sample_fname) as f_in, open(fname, 'wb') as f_out:
41
41
+ shutil.copyfileobj(f_in, f_out)
42
coffset = file_cluster_offset & s->cluster_offset_mask;
42
+
43
@@ -XXX,XX +XXX,XX @@ qcow2_co_preadv_compressed(BlockDriverState *bs,
43
44
if (!buf) {
44
def qemu_tool_pipe_and_status(tool: str, args: Sequence[str],
45
return -ENOMEM;
45
connect_stderr: bool = True) -> Tuple[str, int]:
46
}
47
- qemu_iovec_init_buf(&local_qiov, buf, csize);
48
49
out_buf = qemu_blockalign(bs, s->cluster_size);
50
51
BLKDBG_EVENT(bs->file, BLKDBG_READ_COMPRESSED);
52
- ret = bdrv_co_preadv(bs->file, coffset, csize, &local_qiov, 0);
53
+ ret = bdrv_co_pread(bs->file, coffset, csize, buf, 0);
54
if (ret < 0) {
55
goto fail;
56
}
57
--
46
--
58
2.20.1
47
2.29.2
59
48
60
49
diff view generated by jsdifflib
1
From: Alberto Garcia <berto@igalia.com>
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
2
2
3
This tests the fix from the previous patch.
3
Test support for reading bitmap from parallels image format.
4
parallels-with-bitmap.bz2 is generated on Virtuozzo by
5
parallels-with-bitmap.sh
4
6
5
Signed-off-by: Alberto Garcia <berto@igalia.com>
7
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
8
Message-Id: <20210224104707.88430-7-vsementsov@virtuozzo.com>
9
Reviewed-by: Denis V. Lunev <den@openvz.org>
6
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7
---
11
---
8
tests/qemu-iotests/249 | 115 +++++++++++++++++++++++++++++++++++++
12
.../sample_images/parallels-with-bitmap.bz2 | Bin 0 -> 203 bytes
9
tests/qemu-iotests/249.out | 35 +++++++++++
13
.../sample_images/parallels-with-bitmap.sh | 51 ++++++++++++++++
10
tests/qemu-iotests/group | 1 +
14
.../qemu-iotests/tests/parallels-read-bitmap | 55 ++++++++++++++++++
11
3 files changed, 151 insertions(+)
15
.../tests/parallels-read-bitmap.out | 6 ++
12
create mode 100755 tests/qemu-iotests/249
16
4 files changed, 112 insertions(+)
13
create mode 100644 tests/qemu-iotests/249.out
17
create mode 100644 tests/qemu-iotests/sample_images/parallels-with-bitmap.bz2
18
create mode 100755 tests/qemu-iotests/sample_images/parallels-with-bitmap.sh
19
create mode 100755 tests/qemu-iotests/tests/parallels-read-bitmap
20
create mode 100644 tests/qemu-iotests/tests/parallels-read-bitmap.out
14
21
15
diff --git a/tests/qemu-iotests/249 b/tests/qemu-iotests/249
22
diff --git a/tests/qemu-iotests/sample_images/parallels-with-bitmap.bz2 b/tests/qemu-iotests/sample_images/parallels-with-bitmap.bz2
23
new file mode 100644
24
index XXXXXXX..XXXXXXX
25
GIT binary patch
26
literal 203
27
zcmV;+05tzXT4*^jL0KkKS@=;0bpT+Hf7|^?Km<xfFyKQJ7=Y^F-%vt;00~Ysa6|-=
28
zk&7Szk`SoS002EkfMftPG<ipnsiCK}K_sNmm}me3FiZr%Oaf_u5F8kD;mB_~cxD-r
29
z5P$(X{&Tq5C`<xK02D?NNdN+t$~z$m00O|zFh^ynq*yaCtkn+NZzWom<#OEoF`?zb
30
zv(i3x^K~wt!aLPcRBP+PckUsIh6*LgjYSh0`}#7hMC9NR5D)+W0d&8Mxgwk>NPH-R
31
Fx`3oHQ9u9y
32
33
literal 0
34
HcmV?d00001
35
36
diff --git a/tests/qemu-iotests/sample_images/parallels-with-bitmap.sh b/tests/qemu-iotests/sample_images/parallels-with-bitmap.sh
16
new file mode 100755
37
new file mode 100755
17
index XXXXXXX..XXXXXXX
38
index XXXXXXX..XXXXXXX
18
--- /dev/null
39
--- /dev/null
19
+++ b/tests/qemu-iotests/249
40
+++ b/tests/qemu-iotests/sample_images/parallels-with-bitmap.sh
20
@@ -XXX,XX +XXX,XX @@
41
@@ -XXX,XX +XXX,XX @@
21
+#!/usr/bin/env bash
42
+#!/bin/bash
22
+#
43
+#
23
+# Test that a backing image is put back in read-only mode after
44
+# Test parallels load bitmap
24
+# block-commit (both when it fails and when it succeeds).
25
+#
45
+#
26
+# Copyright (C) 2019 Igalia, S.L.
46
+# Copyright (c) 2021 Virtuozzo International GmbH.
27
+#
47
+#
28
+# This program is free software; you can redistribute it and/or modify
48
+# This program is free software; you can redistribute it and/or modify
29
+# it under the terms of the GNU General Public License as published by
49
+# it under the terms of the GNU General Public License as published by
30
+# the Free Software Foundation; either version 2 of the License, or
50
+# the Free Software Foundation; either version 2 of the License, or
31
+# (at your option) any later version.
51
+# (at your option) any later version.
...
...
37
+#
57
+#
38
+# You should have received a copy of the GNU General Public License
58
+# You should have received a copy of the GNU General Public License
39
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
59
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
40
+#
60
+#
41
+
61
+
42
+# creator
62
+CT=parallels-with-bitmap-ct
43
+owner=berto@igalia.com
63
+DIR=$PWD/parallels-with-bitmap-dir
64
+IMG=$DIR/root.hds
65
+XML=$DIR/DiskDescriptor.xml
66
+TARGET=parallels-with-bitmap.bz2
44
+
67
+
45
+seq="$(basename $0)"
68
+rm -rf $DIR
46
+echo "QA output created by $seq"
47
+
69
+
48
+status=1    # failure is the default!
70
+prlctl create $CT --vmtype ct
71
+prlctl set $CT --device-add hdd --image $DIR --recreate --size 2G
49
+
72
+
50
+_cleanup()
73
+# cleanup the image
51
+{
74
+qemu-img create -f parallels $IMG 64G
52
+ _cleanup_test_img
53
+ rm -f "$TEST_IMG.base"
54
+ rm -f "$TEST_IMG.int"
55
+}
56
+trap "_cleanup; exit \$status" 0 1 2 3 15
57
+
75
+
58
+# get standard environment, filters and checks
76
+# create bitmap
59
+. ./common.rc
77
+prlctl backup $CT
60
+. ./common.filter
61
+. ./common.qemu
62
+
78
+
63
+# Any format implementing BlockDriver.bdrv_change_backing_file
79
+prlctl set $CT --device-del hdd1
64
+_supported_fmt qcow2 qed
80
+prlctl destroy $CT
65
+_supported_proto file
66
+_supported_os Linux
67
+
81
+
68
+IMG_SIZE=1M
82
+dev=$(ploop mount $XML | sed -n 's/^Adding delta dev=\(\/dev\/ploop[0-9]\+\).*/\1/p')
83
+dd if=/dev/zero of=$dev bs=64K seek=5 count=2 oflag=direct
84
+dd if=/dev/zero of=$dev bs=64K seek=30 count=1 oflag=direct
85
+dd if=/dev/zero of=$dev bs=64K seek=10 count=3 oflag=direct
86
+ploop umount $XML # bitmap name will be in the output
69
+
87
+
70
+# Create the images: base <- int <- active
88
+bzip2 -z $IMG
71
+TEST_IMG="$TEST_IMG.base" _make_test_img $IMG_SIZE | _filter_imgfmt
72
+TEST_IMG="$TEST_IMG.int" _make_test_img -b "$TEST_IMG.base" | _filter_imgfmt
73
+_make_test_img -b "$TEST_IMG.int" | _filter_imgfmt
74
+
89
+
75
+# Launch QEMU with these two drives:
90
+mv $IMG.bz2 $TARGET
76
+# none0: base (read-only)
77
+# none1: base <- int <- active
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
80
+
91
+
81
+_send_qemu_cmd $QEMU_HANDLE \
92
+rm -rf $DIR
82
+ "{ 'execute': 'qmp_capabilities' }" \
93
diff --git a/tests/qemu-iotests/tests/parallels-read-bitmap b/tests/qemu-iotests/tests/parallels-read-bitmap
83
+ 'return'
94
new file mode 100755
95
index XXXXXXX..XXXXXXX
96
--- /dev/null
97
+++ b/tests/qemu-iotests/tests/parallels-read-bitmap
98
@@ -XXX,XX +XXX,XX @@
99
+#!/usr/bin/env python3
100
+#
101
+# Test parallels load bitmap
102
+#
103
+# Copyright (c) 2021 Virtuozzo International GmbH.
104
+#
105
+# This program is free software; you can redistribute it and/or modify
106
+# it under the terms of the GNU General Public License as published by
107
+# the Free Software Foundation; either version 2 of the License, or
108
+# (at your option) any later version.
109
+#
110
+# This program is distributed in the hope that it will be useful,
111
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
112
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
113
+# GNU General Public License for more details.
114
+#
115
+# You should have received a copy of the GNU General Public License
116
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
117
+#
84
+
118
+
85
+echo
119
+import json
86
+echo '=== Send a write command to a drive opened in read-only mode (1)'
120
+import iotests
87
+echo
121
+from iotests import qemu_nbd_popen, qemu_img_pipe, log, file_path
88
+_send_qemu_cmd $QEMU_HANDLE \
89
+ "{ 'execute': 'human-monitor-command',
90
+ 'arguments': {'command-line': 'qemu-io none0 \"aio_write 0 2k\"'}}" \
91
+ 'return'
92
+
122
+
93
+echo
123
+iotests.script_initialize(supported_fmts=['parallels'])
94
+echo '=== Run block-commit on base using an invalid filter node name'
95
+echo
96
+_send_qemu_cmd $QEMU_HANDLE \
97
+ "{ 'execute': 'block-commit',
98
+ 'arguments': {'job-id': 'job0', 'device': 'none1', 'top-node': 'int',
99
+ 'filter-node-name': '1234'}}" \
100
+ 'error'
101
+
124
+
102
+echo
125
+nbd_sock = file_path('nbd-sock', base_dir=iotests.sock_dir)
103
+echo '=== Send a write command to a drive opened in read-only mode (2)'
126
+disk = iotests.file_path('disk')
104
+echo
127
+bitmap = 'e4f2eed0-37fe-4539-b50b-85d2e7fd235f'
105
+_send_qemu_cmd $QEMU_HANDLE \
128
+nbd_opts = f'driver=nbd,server.type=unix,server.path={nbd_sock}' \
106
+ "{ 'execute': 'human-monitor-command',
129
+ f',x-dirty-bitmap=qemu:dirty-bitmap:{bitmap}'
107
+ 'arguments': {'command-line': 'qemu-io none0 \"aio_write 0 2k\"'}}" \
108
+ 'return'
109
+
130
+
110
+echo
111
+echo '=== Run block-commit on base using the default filter node name'
112
+echo
113
+_send_qemu_cmd $QEMU_HANDLE \
114
+ "{ 'execute': 'block-commit',
115
+ 'arguments': {'job-id': 'job0', 'device': 'none1', 'top-node': 'int'}}" \
116
+ 'return'
117
+
131
+
118
+# Wait for block-commit to finish
132
+iotests.unarchive_sample_image('parallels-with-bitmap', disk)
119
+_send_qemu_cmd $QEMU_HANDLE '' \
120
+ '"status": "null"'
121
+
133
+
122
+echo
123
+echo '=== Send a write command to a drive opened in read-only mode (3)'
124
+echo
125
+_send_qemu_cmd $QEMU_HANDLE \
126
+ "{ 'execute': 'human-monitor-command',
127
+ 'arguments': {'command-line': 'qemu-io none0 \"aio_write 0 2k\"'}}" \
128
+ 'return'
129
+
134
+
130
+_cleanup_qemu
135
+with qemu_nbd_popen('--read-only', f'--socket={nbd_sock}',
136
+ f'--bitmap={bitmap}', '-f', iotests.imgfmt, disk):
137
+ out = qemu_img_pipe('map', '--output=json', '--image-opts', nbd_opts)
138
+ chunks = json.loads(out)
139
+ cluster = 64 * 1024
131
+
140
+
132
+# success, all done
141
+ log('dirty clusters (cluster size is 64K):')
133
+echo "*** done"
142
+ for c in chunks:
134
+rm -f $seq.full
143
+ assert c['start'] % cluster == 0
135
+status=0
144
+ assert c['length'] % cluster == 0
136
diff --git a/tests/qemu-iotests/249.out b/tests/qemu-iotests/249.out
145
+ if c['data']:
146
+ continue
147
+
148
+ a = c['start'] // cluster
149
+ b = (c['start'] + c['length']) // cluster
150
+ if b - a > 1:
151
+ log(f'{a}-{b-1}')
152
+ else:
153
+ log(a)
154
diff --git a/tests/qemu-iotests/tests/parallels-read-bitmap.out b/tests/qemu-iotests/tests/parallels-read-bitmap.out
137
new file mode 100644
155
new file mode 100644
138
index XXXXXXX..XXXXXXX
156
index XXXXXXX..XXXXXXX
139
--- /dev/null
157
--- /dev/null
140
+++ b/tests/qemu-iotests/249.out
158
+++ b/tests/qemu-iotests/tests/parallels-read-bitmap.out
141
@@ -XXX,XX +XXX,XX @@
159
@@ -XXX,XX +XXX,XX @@
142
+QA output created by 249
160
+Start NBD server
143
+Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=1048576
161
+dirty clusters (cluster size is 64K):
144
+Formatting 'TEST_DIR/t.IMGFMT.int', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT.base
162
+5-6
145
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT.int
163
+10-12
146
+{"return": {}}
164
+30
147
+
165
+Kill NBD server
148
+=== Send a write command to a drive opened in read-only mode (1)
149
+
150
+{"return": "Block node is read-onlyrn"}
151
+
152
+=== Run block-commit on base using an invalid filter node name
153
+
154
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}}
155
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}}
156
+{"error": {"class": "GenericError", "desc": "Invalid node name"}}
157
+
158
+=== Send a write command to a drive opened in read-only mode (2)
159
+
160
+{"return": "Block node is read-onlyrn"}
161
+
162
+=== Run block-commit on base using the default filter node name
163
+
164
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}}
165
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}}
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"}}
172
+
173
+=== Send a write command to a drive opened in read-only mode (3)
174
+
175
+{"return": "Block node is read-onlyrn"}
176
+*** done
177
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
178
index XXXXXXX..XXXXXXX 100644
179
--- a/tests/qemu-iotests/group
180
+++ b/tests/qemu-iotests/group
181
@@ -XXX,XX +XXX,XX @@
182
246 rw auto quick
183
247 rw auto quick
184
248 rw auto quick
185
+249 rw auto quick
186
--
166
--
187
2.20.1
167
2.29.2
188
168
189
169
diff view generated by jsdifflib
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
2
2
3
Move to _co_ versions of io functions qed_read_table() and
3
Add new parallels-ext.c and myself as co-maintainer.
4
qed_write_table(), as we use qemu_co_mutex_unlock()
5
anyway.
6
4
7
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
8
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
6
Message-Id: <20210304095151.19358-1-vsementsov@virtuozzo.com>
9
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
7
Reviewed-by: Denis V. Lunev <den@openvz.org>
10
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11
---
9
---
12
block/qed-table.c | 12 +++++-------
10
MAINTAINERS | 3 +++
13
block/qed.c | 6 ++----
11
1 file changed, 3 insertions(+)
14
2 files changed, 7 insertions(+), 11 deletions(-)
15
12
16
diff --git a/block/qed-table.c b/block/qed-table.c
13
diff --git a/MAINTAINERS b/MAINTAINERS
17
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
18
--- a/block/qed-table.c
15
--- a/MAINTAINERS
19
+++ b/block/qed-table.c
16
+++ b/MAINTAINERS
20
@@ -XXX,XX +XXX,XX @@
17
@@ -XXX,XX +XXX,XX @@ F: block/dmg.c
21
/* Called with table_lock held. */
18
parallels
22
static int qed_read_table(BDRVQEDState *s, uint64_t offset, QEDTable *table)
19
M: Stefan Hajnoczi <stefanha@redhat.com>
23
{
20
M: Denis V. Lunev <den@openvz.org>
24
- QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(
21
+M: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
25
- qiov, table->offsets, s->header.cluster_size * s->header.table_size);
22
L: qemu-block@nongnu.org
26
+ unsigned int bytes = s->header.cluster_size * s->header.table_size;
23
S: Supported
27
+
24
F: block/parallels.c
28
int noffsets;
25
+F: block/parallels-ext.c
29
int i, ret;
26
F: docs/interop/parallels.txt
30
27
+T: git https://src.openvz.org/scm/~vsementsov/qemu.git parallels
31
trace_qed_read_table(s, offset, table);
28
32
29
qed
33
qemu_co_mutex_unlock(&s->table_lock);
30
M: Stefan Hajnoczi <stefanha@redhat.com>
34
- ret = bdrv_preadv(s->bs->file, offset, &qiov);
35
+ ret = bdrv_co_pread(s->bs->file, offset, bytes, table->offsets, 0);
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;
101
}
102
--
31
--
103
2.20.1
32
2.29.2
104
33
105
34
diff view generated by jsdifflib
1
From: Alberto Garcia <berto@igalia.com>
1
The 'name' option for NBD exports is optional. Add a note that the
2
default for the option is the node name (people could otherwise expect
3
that it's the empty string like for qemu-nbd).
2
4
3
You can reproduce this by passing an invalid filter-node-name (like
5
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4
"1234") to block-commit. In this case the base image is put in
6
Message-Id: <20210305094856.18964-1-kwolf@redhat.com>
5
read-write mode but is never reset back to read-only.
6
7
Signed-off-by: Alberto Garcia <berto@igalia.com>
8
Reviewed-by: Max Reitz <mreitz@redhat.com>
7
Reviewed-by: Max Reitz <mreitz@redhat.com>
9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10
---
9
---
11
block/commit.c | 3 +++
10
docs/tools/qemu-storage-daemon.rst | 5 +++--
12
1 file changed, 3 insertions(+)
11
1 file changed, 3 insertions(+), 2 deletions(-)
13
12
14
diff --git a/block/commit.c b/block/commit.c
13
diff --git a/docs/tools/qemu-storage-daemon.rst b/docs/tools/qemu-storage-daemon.rst
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/block/commit.c
15
--- a/docs/tools/qemu-storage-daemon.rst
17
+++ b/block/commit.c
16
+++ b/docs/tools/qemu-storage-daemon.rst
18
@@ -XXX,XX +XXX,XX @@ fail:
17
@@ -XXX,XX +XXX,XX @@ Standard options:
19
if (s->top) {
18
requests for modifying data (the default is off).
20
blk_unref(s->top);
19
21
}
20
The ``nbd`` export type requires ``--nbd-server`` (see below). ``name`` is
22
+ if (s->base_read_only) {
21
- the NBD export name. ``bitmap`` is the name of a dirty bitmap reachable from
23
+ bdrv_reopen_set_read_only(base, true, NULL);
22
- the block node, so the NBD client can use NBD_OPT_SET_META_CONTEXT with the
24
+ }
23
+ the NBD export name (if not specified, it defaults to the given
25
job_early_fail(&s->common.job);
24
+ ``node-name``). ``bitmap`` is the name of a dirty bitmap reachable from the
26
/* commit_top_bs has to be replaced after deleting the block job,
25
+ block node, so the NBD client can use NBD_OPT_SET_META_CONTEXT with the
27
* otherwise this would fail because of lack of permissions. */
26
metadata context name "qemu:dirty-bitmap:BITMAP" to inspect the bitmap.
27
28
The ``vhost-user-blk`` export type takes a vhost-user socket address on which
28
--
29
--
29
2.20.1
30
2.29.2
30
31
31
32
diff view generated by jsdifflib