iotests/307: Test multi-thread export interface
Test the QAPI interface for multi-threaded exports. None of our exports currently support multi-threading, so it's always an error in the end, but we can still test the specific errors. Signed-off-by: Hanna Czenczek <hreitz@redhat.com> Message-ID: <20260309150856.26800-22-hreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Hanna Czenczek committed
Mar 9, 2026 at 16:08 UTC
1a089577046f3b3f0ac08c9a2565e0d4f0a29f0f
2 files changed
+65
tests/qemu-iotests/307
+47
@@ -142,5 +142,52 @@ with iotests.FilePath('image') as img, \
142
vm.qmp_log('query-block-exports')
143
iotests.qemu_nbd_list_log('-k', socket)
144
145
+ iotests.log('\n=== Using multi-thread with NBD ===')
146
+
147
+ # Actual multi-threading; (currently) not supported by NBD
148
+ vm.qmp_log('block-export-add',
149
+ id='export0',
150
+ type='nbd',
151
+ node_name='fmt',
152
+ iothread=['iothread0', 'iothread1'])
153
+
154
+ # Should be treated the same way as actual multi-threading, even if there's
155
+ # only a single thread
156
+ vm.qmp_log('block-export-add',
157
+ id='export0',
158
+ type='nbd',
159
+ node_name='fmt',
160
+ iothread=['iothread0'])
161
+
162
+ iotests.log('\n=== Empty thread list')
163
+
164
+ # Simply not allowed
165
+ vm.qmp_log('block-export-add',
166
+ id='export0',
167
+ type='nbd',
168
+ node_name='fmt',
169
+ iothread=[])
170
+
171
+ iotests.log('\n=== Non-existent thread name in list')
172
+
173
+ # Expect an error, even if NBD does not support multi-threading, because the
174
+ # list is parsed before being passed to NBD
175
+ vm.qmp_log('block-export-add',
176
+ id='export0',
177
+ type='nbd',
178
+ node_name='fmt',
179
+ iothread=['iothread0', 'nothread', 'iothread1'])
180
+
181
+ iotests.log('\n=== Multi-thread with fixed-iothread')
182
+
183
+ # With multi-threading, there is no single context to give the BDS, so it is
184
+ # just left where it is. fixed-iothread does not make sense then.
185
+ vm.qmp_log('block-export-add',
186
+ id='export0',
187
+ type='nbd',
188
+ node_name='fmt',
189
+ iothread=['iothread0', 'iothread1'],
190
+ fixed_iothread=True)
191
+
192
iotests.log('\n=== Shut down QEMU ===')
193
vm.shutdown()
tests/qemu-iotests/307.out
+18
@@ -134,4 +134,22 @@ read failed: Input/output error
134
exports available: 0
135
136
137
+=== Using multi-thread with NBD ===
138
+{"execute": "block-export-add", "arguments": {"id": "export0", "iothread": ["iothread0", "iothread1"], "node-name": "fmt", "type": "nbd"}}
139
+{"error": {"class": "GenericError", "desc": "NBD export does not support multi-threading"}}
140
+{"execute": "block-export-add", "arguments": {"id": "export0", "iothread": ["iothread0"], "node-name": "fmt", "type": "nbd"}}
141
+{"error": {"class": "GenericError", "desc": "NBD export does not support multi-threading"}}
142
+
143
+=== Empty thread list
144
+{"execute": "block-export-add", "arguments": {"id": "export0", "iothread": [], "node-name": "fmt", "type": "nbd"}}
145
+{"error": {"class": "GenericError", "desc": "The set of I/O threads must not be empty"}}
146
+
147
+=== Non-existent thread name in list
148
+{"execute": "block-export-add", "arguments": {"id": "export0", "iothread": ["iothread0", "nothread", "iothread1"], "node-name": "fmt", "type": "nbd"}}
149
+{"error": {"class": "GenericError", "desc": "iothread \"nothread\" not found"}}
150
+
151
+=== Multi-thread with fixed-iothread
152
+{"execute": "block-export-add", "arguments": {"fixed-iothread": true, "id": "export0", "iothread": ["iothread0", "iothread1"], "node-name": "fmt", "type": "nbd"}}
153
+{"error": {"class": "GenericError", "desc": "Cannot use fixed-iothread for a multi-threaded export"}}
154
+
155
=== Shut down QEMU ===