2 * Block node draining tests
4 * Copyright (c) 2017 Kevin Wolf <kwolf@redhat.com>
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 #include "qemu/osdep.h"
26 #include "block/block.h"
27 #include "block/blockjob_int.h"
28 #include "sysemu/block-backend.h"
29 #include "qapi/error.h"
31 typedef struct BDRVTestState
{
35 static void coroutine_fn
bdrv_test_co_drain_begin(BlockDriverState
*bs
)
37 BDRVTestState
*s
= bs
->opaque
;
41 static void coroutine_fn
bdrv_test_co_drain_end(BlockDriverState
*bs
)
43 BDRVTestState
*s
= bs
->opaque
;
47 static void bdrv_test_close(BlockDriverState
*bs
)
49 BDRVTestState
*s
= bs
->opaque
;
50 g_assert_cmpint(s
->drain_count
, >, 0);
53 static int coroutine_fn
bdrv_test_co_preadv(BlockDriverState
*bs
,
54 uint64_t offset
, uint64_t bytes
,
55 QEMUIOVector
*qiov
, int flags
)
57 /* We want this request to stay until the polling loop in drain waits for
58 * it to complete. We need to sleep a while as bdrv_drain_invoke() comes
59 * first and polls its result, too, but it shouldn't accidentally complete
60 * this request yet. */
61 qemu_co_sleep_ns(QEMU_CLOCK_REALTIME
, 100000);
66 static BlockDriver bdrv_test
= {
67 .format_name
= "test",
68 .instance_size
= sizeof(BDRVTestState
),
70 .bdrv_close
= bdrv_test_close
,
71 .bdrv_co_preadv
= bdrv_test_co_preadv
,
73 .bdrv_co_drain_begin
= bdrv_test_co_drain_begin
,
74 .bdrv_co_drain_end
= bdrv_test_co_drain_end
,
76 .bdrv_child_perm
= bdrv_format_default_perms
,
79 static void aio_ret_cb(void *opaque
, int ret
)
81 int *aio_ret
= opaque
;
85 typedef struct CallInCoroutineData
{
88 } CallInCoroutineData
;
90 static coroutine_fn
void call_in_coroutine_entry(void *opaque
)
92 CallInCoroutineData
*data
= opaque
;
98 static void call_in_coroutine(void (*entry
)(void))
101 CallInCoroutineData data
= {
106 co
= qemu_coroutine_create(call_in_coroutine_entry
, &data
);
107 qemu_coroutine_enter(co
);
109 aio_poll(qemu_get_aio_context(), true);
120 static void do_drain_begin(enum drain_type drain_type
, BlockDriverState
*bs
)
122 switch (drain_type
) {
123 case BDRV_DRAIN_ALL
: bdrv_drain_all_begin(); break;
124 case BDRV_DRAIN
: bdrv_drained_begin(bs
); break;
125 case BDRV_SUBTREE_DRAIN
: bdrv_subtree_drained_begin(bs
); break;
126 default: g_assert_not_reached();
130 static void do_drain_end(enum drain_type drain_type
, BlockDriverState
*bs
)
132 switch (drain_type
) {
133 case BDRV_DRAIN_ALL
: bdrv_drain_all_end(); break;
134 case BDRV_DRAIN
: bdrv_drained_end(bs
); break;
135 case BDRV_SUBTREE_DRAIN
: bdrv_subtree_drained_end(bs
); break;
136 default: g_assert_not_reached();
140 static void test_drv_cb_common(enum drain_type drain_type
, bool recursive
)
143 BlockDriverState
*bs
, *backing
;
144 BDRVTestState
*s
, *backing_s
;
153 qemu_iovec_init_external(&qiov
, &iov
, 1);
155 blk
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
156 bs
= bdrv_new_open_driver(&bdrv_test
, "test-node", BDRV_O_RDWR
,
159 blk_insert_bs(blk
, bs
, &error_abort
);
161 backing
= bdrv_new_open_driver(&bdrv_test
, "backing", 0, &error_abort
);
162 backing_s
= backing
->opaque
;
163 bdrv_set_backing_hd(bs
, backing
, &error_abort
);
165 /* Simple bdrv_drain_all_begin/end pair, check that CBs are called */
166 g_assert_cmpint(s
->drain_count
, ==, 0);
167 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
169 do_drain_begin(drain_type
, bs
);
171 g_assert_cmpint(s
->drain_count
, ==, 1);
172 g_assert_cmpint(backing_s
->drain_count
, ==, !!recursive
);
174 do_drain_end(drain_type
, bs
);
176 g_assert_cmpint(s
->drain_count
, ==, 0);
177 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
179 /* Now do the same while a request is pending */
180 aio_ret
= -EINPROGRESS
;
181 acb
= blk_aio_preadv(blk
, 0, &qiov
, 0, aio_ret_cb
, &aio_ret
);
182 g_assert(acb
!= NULL
);
183 g_assert_cmpint(aio_ret
, ==, -EINPROGRESS
);
185 g_assert_cmpint(s
->drain_count
, ==, 0);
186 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
188 do_drain_begin(drain_type
, bs
);
190 g_assert_cmpint(aio_ret
, ==, 0);
191 g_assert_cmpint(s
->drain_count
, ==, 1);
192 g_assert_cmpint(backing_s
->drain_count
, ==, !!recursive
);
194 do_drain_end(drain_type
, bs
);
196 g_assert_cmpint(s
->drain_count
, ==, 0);
197 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
204 static void test_drv_cb_drain_all(void)
206 test_drv_cb_common(BDRV_DRAIN_ALL
, true);
209 static void test_drv_cb_drain(void)
211 test_drv_cb_common(BDRV_DRAIN
, false);
214 static void test_drv_cb_drain_subtree(void)
216 test_drv_cb_common(BDRV_SUBTREE_DRAIN
, true);
219 static void test_drv_cb_co_drain(void)
221 call_in_coroutine(test_drv_cb_drain
);
224 static void test_drv_cb_co_drain_subtree(void)
226 call_in_coroutine(test_drv_cb_drain_subtree
);
229 static void test_quiesce_common(enum drain_type drain_type
, bool recursive
)
232 BlockDriverState
*bs
, *backing
;
234 blk
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
235 bs
= bdrv_new_open_driver(&bdrv_test
, "test-node", BDRV_O_RDWR
,
237 blk_insert_bs(blk
, bs
, &error_abort
);
239 backing
= bdrv_new_open_driver(&bdrv_test
, "backing", 0, &error_abort
);
240 bdrv_set_backing_hd(bs
, backing
, &error_abort
);
242 g_assert_cmpint(bs
->quiesce_counter
, ==, 0);
243 g_assert_cmpint(backing
->quiesce_counter
, ==, 0);
245 do_drain_begin(drain_type
, bs
);
247 g_assert_cmpint(bs
->quiesce_counter
, ==, 1);
248 g_assert_cmpint(backing
->quiesce_counter
, ==, !!recursive
);
250 do_drain_end(drain_type
, bs
);
252 g_assert_cmpint(bs
->quiesce_counter
, ==, 0);
253 g_assert_cmpint(backing
->quiesce_counter
, ==, 0);
260 static void test_quiesce_drain_all(void)
262 // XXX drain_all doesn't quiesce
263 //test_quiesce_common(BDRV_DRAIN_ALL, true);
266 static void test_quiesce_drain(void)
268 test_quiesce_common(BDRV_DRAIN
, false);
271 static void test_quiesce_drain_subtree(void)
273 test_quiesce_common(BDRV_SUBTREE_DRAIN
, true);
276 static void test_quiesce_co_drain(void)
278 call_in_coroutine(test_quiesce_drain
);
281 static void test_quiesce_co_drain_subtree(void)
283 call_in_coroutine(test_quiesce_drain_subtree
);
286 static void test_nested(void)
289 BlockDriverState
*bs
, *backing
;
290 BDRVTestState
*s
, *backing_s
;
291 enum drain_type outer
, inner
;
293 blk
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
294 bs
= bdrv_new_open_driver(&bdrv_test
, "test-node", BDRV_O_RDWR
,
297 blk_insert_bs(blk
, bs
, &error_abort
);
299 backing
= bdrv_new_open_driver(&bdrv_test
, "backing", 0, &error_abort
);
300 backing_s
= backing
->opaque
;
301 bdrv_set_backing_hd(bs
, backing
, &error_abort
);
303 for (outer
= 0; outer
< DRAIN_TYPE_MAX
; outer
++) {
304 for (inner
= 0; inner
< DRAIN_TYPE_MAX
; inner
++) {
305 /* XXX bdrv_drain_all() doesn't increase the quiesce_counter */
306 int bs_quiesce
= (outer
!= BDRV_DRAIN_ALL
) +
307 (inner
!= BDRV_DRAIN_ALL
);
308 int backing_quiesce
= (outer
== BDRV_SUBTREE_DRAIN
) +
309 (inner
== BDRV_SUBTREE_DRAIN
);
310 int backing_cb_cnt
= (outer
!= BDRV_DRAIN
) +
311 (inner
!= BDRV_DRAIN
);
313 g_assert_cmpint(bs
->quiesce_counter
, ==, 0);
314 g_assert_cmpint(backing
->quiesce_counter
, ==, 0);
315 g_assert_cmpint(s
->drain_count
, ==, 0);
316 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
318 do_drain_begin(outer
, bs
);
319 do_drain_begin(inner
, bs
);
321 g_assert_cmpint(bs
->quiesce_counter
, ==, bs_quiesce
);
322 g_assert_cmpint(backing
->quiesce_counter
, ==, backing_quiesce
);
323 g_assert_cmpint(s
->drain_count
, ==, 2);
324 g_assert_cmpint(backing_s
->drain_count
, ==, backing_cb_cnt
);
326 do_drain_end(inner
, bs
);
327 do_drain_end(outer
, bs
);
329 g_assert_cmpint(bs
->quiesce_counter
, ==, 0);
330 g_assert_cmpint(backing
->quiesce_counter
, ==, 0);
331 g_assert_cmpint(s
->drain_count
, ==, 0);
332 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
341 static void test_multiparent(void)
343 BlockBackend
*blk_a
, *blk_b
;
344 BlockDriverState
*bs_a
, *bs_b
, *backing
;
345 BDRVTestState
*a_s
, *b_s
, *backing_s
;
347 blk_a
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
348 bs_a
= bdrv_new_open_driver(&bdrv_test
, "test-node-a", BDRV_O_RDWR
,
351 blk_insert_bs(blk_a
, bs_a
, &error_abort
);
353 blk_b
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
354 bs_b
= bdrv_new_open_driver(&bdrv_test
, "test-node-b", BDRV_O_RDWR
,
357 blk_insert_bs(blk_b
, bs_b
, &error_abort
);
359 backing
= bdrv_new_open_driver(&bdrv_test
, "backing", 0, &error_abort
);
360 backing_s
= backing
->opaque
;
361 bdrv_set_backing_hd(bs_a
, backing
, &error_abort
);
362 bdrv_set_backing_hd(bs_b
, backing
, &error_abort
);
364 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 0);
365 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 0);
366 g_assert_cmpint(backing
->quiesce_counter
, ==, 0);
367 g_assert_cmpint(a_s
->drain_count
, ==, 0);
368 g_assert_cmpint(b_s
->drain_count
, ==, 0);
369 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
371 do_drain_begin(BDRV_SUBTREE_DRAIN
, bs_a
);
373 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 1);
374 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 1);
375 g_assert_cmpint(backing
->quiesce_counter
, ==, 1);
376 g_assert_cmpint(a_s
->drain_count
, ==, 1);
377 g_assert_cmpint(b_s
->drain_count
, ==, 1);
378 g_assert_cmpint(backing_s
->drain_count
, ==, 1);
380 do_drain_begin(BDRV_SUBTREE_DRAIN
, bs_b
);
382 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 2);
383 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 2);
384 g_assert_cmpint(backing
->quiesce_counter
, ==, 2);
385 g_assert_cmpint(a_s
->drain_count
, ==, 2);
386 g_assert_cmpint(b_s
->drain_count
, ==, 2);
387 g_assert_cmpint(backing_s
->drain_count
, ==, 2);
389 do_drain_end(BDRV_SUBTREE_DRAIN
, bs_b
);
391 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 1);
392 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 1);
393 g_assert_cmpint(backing
->quiesce_counter
, ==, 1);
394 g_assert_cmpint(a_s
->drain_count
, ==, 1);
395 g_assert_cmpint(b_s
->drain_count
, ==, 1);
396 g_assert_cmpint(backing_s
->drain_count
, ==, 1);
398 do_drain_end(BDRV_SUBTREE_DRAIN
, bs_a
);
400 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 0);
401 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 0);
402 g_assert_cmpint(backing
->quiesce_counter
, ==, 0);
403 g_assert_cmpint(a_s
->drain_count
, ==, 0);
404 g_assert_cmpint(b_s
->drain_count
, ==, 0);
405 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
414 static void test_graph_change(void)
416 BlockBackend
*blk_a
, *blk_b
;
417 BlockDriverState
*bs_a
, *bs_b
, *backing
;
418 BDRVTestState
*a_s
, *b_s
, *backing_s
;
420 blk_a
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
421 bs_a
= bdrv_new_open_driver(&bdrv_test
, "test-node-a", BDRV_O_RDWR
,
424 blk_insert_bs(blk_a
, bs_a
, &error_abort
);
426 blk_b
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
427 bs_b
= bdrv_new_open_driver(&bdrv_test
, "test-node-b", BDRV_O_RDWR
,
430 blk_insert_bs(blk_b
, bs_b
, &error_abort
);
432 backing
= bdrv_new_open_driver(&bdrv_test
, "backing", 0, &error_abort
);
433 backing_s
= backing
->opaque
;
434 bdrv_set_backing_hd(bs_a
, backing
, &error_abort
);
436 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 0);
437 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 0);
438 g_assert_cmpint(backing
->quiesce_counter
, ==, 0);
439 g_assert_cmpint(a_s
->drain_count
, ==, 0);
440 g_assert_cmpint(b_s
->drain_count
, ==, 0);
441 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
443 do_drain_begin(BDRV_SUBTREE_DRAIN
, bs_a
);
444 do_drain_begin(BDRV_SUBTREE_DRAIN
, bs_a
);
445 do_drain_begin(BDRV_SUBTREE_DRAIN
, bs_a
);
446 do_drain_begin(BDRV_SUBTREE_DRAIN
, bs_b
);
447 do_drain_begin(BDRV_SUBTREE_DRAIN
, bs_b
);
449 bdrv_set_backing_hd(bs_b
, backing
, &error_abort
);
450 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 5);
451 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 5);
452 g_assert_cmpint(backing
->quiesce_counter
, ==, 5);
453 g_assert_cmpint(a_s
->drain_count
, ==, 5);
454 g_assert_cmpint(b_s
->drain_count
, ==, 5);
455 g_assert_cmpint(backing_s
->drain_count
, ==, 5);
457 bdrv_set_backing_hd(bs_b
, NULL
, &error_abort
);
458 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 3);
459 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 2);
460 g_assert_cmpint(backing
->quiesce_counter
, ==, 3);
461 g_assert_cmpint(a_s
->drain_count
, ==, 3);
462 g_assert_cmpint(b_s
->drain_count
, ==, 2);
463 g_assert_cmpint(backing_s
->drain_count
, ==, 3);
465 bdrv_set_backing_hd(bs_b
, backing
, &error_abort
);
466 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 5);
467 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 5);
468 g_assert_cmpint(backing
->quiesce_counter
, ==, 5);
469 g_assert_cmpint(a_s
->drain_count
, ==, 5);
470 g_assert_cmpint(b_s
->drain_count
, ==, 5);
471 g_assert_cmpint(backing_s
->drain_count
, ==, 5);
473 do_drain_end(BDRV_SUBTREE_DRAIN
, bs_b
);
474 do_drain_end(BDRV_SUBTREE_DRAIN
, bs_b
);
475 do_drain_end(BDRV_SUBTREE_DRAIN
, bs_a
);
476 do_drain_end(BDRV_SUBTREE_DRAIN
, bs_a
);
477 do_drain_end(BDRV_SUBTREE_DRAIN
, bs_a
);
479 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 0);
480 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 0);
481 g_assert_cmpint(backing
->quiesce_counter
, ==, 0);
482 g_assert_cmpint(a_s
->drain_count
, ==, 0);
483 g_assert_cmpint(b_s
->drain_count
, ==, 0);
484 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
494 typedef struct TestBlockJob
{
496 bool should_complete
;
499 static void test_job_completed(Job
*job
, void *opaque
)
501 BlockJob
*bjob
= container_of(job
, BlockJob
, job
);
502 block_job_completed(bjob
, 0);
505 static void coroutine_fn
test_job_start(void *opaque
)
507 TestBlockJob
*s
= opaque
;
509 block_job_event_ready(&s
->common
);
510 while (!s
->should_complete
) {
511 job_sleep_ns(&s
->common
.job
, 100000);
514 job_defer_to_main_loop(&s
->common
.job
, test_job_completed
, NULL
);
517 static void test_job_complete(BlockJob
*job
, Error
**errp
)
519 TestBlockJob
*s
= container_of(job
, TestBlockJob
, common
);
520 s
->should_complete
= true;
523 BlockJobDriver test_job_driver
= {
525 .instance_size
= sizeof(TestBlockJob
),
526 .free
= block_job_free
,
527 .user_resume
= block_job_user_resume
,
528 .drain
= block_job_drain
,
529 .start
= test_job_start
,
531 .complete
= test_job_complete
,
534 static void test_blockjob_common(enum drain_type drain_type
)
536 BlockBackend
*blk_src
, *blk_target
;
537 BlockDriverState
*src
, *target
;
541 src
= bdrv_new_open_driver(&bdrv_test
, "source", BDRV_O_RDWR
,
543 blk_src
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
544 blk_insert_bs(blk_src
, src
, &error_abort
);
546 target
= bdrv_new_open_driver(&bdrv_test
, "target", BDRV_O_RDWR
,
548 blk_target
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
549 blk_insert_bs(blk_target
, target
, &error_abort
);
551 job
= block_job_create("job0", &test_job_driver
, NULL
, src
, 0, BLK_PERM_ALL
,
552 0, 0, NULL
, NULL
, &error_abort
);
553 block_job_add_bdrv(job
, "target", target
, 0, BLK_PERM_ALL
, &error_abort
);
554 job_start(&job
->job
);
556 g_assert_cmpint(job
->job
.pause_count
, ==, 0);
557 g_assert_false(job
->job
.paused
);
558 g_assert_false(job
->job
.busy
); /* We're in job_sleep_ns() */
560 do_drain_begin(drain_type
, src
);
562 if (drain_type
== BDRV_DRAIN_ALL
) {
563 /* bdrv_drain_all() drains both src and target */
564 g_assert_cmpint(job
->job
.pause_count
, ==, 2);
566 g_assert_cmpint(job
->job
.pause_count
, ==, 1);
568 /* XXX We don't wait until the job is actually paused. Is this okay? */
569 /* g_assert_true(job->job.paused); */
570 g_assert_false(job
->job
.busy
); /* The job is paused */
572 do_drain_end(drain_type
, src
);
574 g_assert_cmpint(job
->job
.pause_count
, ==, 0);
575 g_assert_false(job
->job
.paused
);
576 g_assert_false(job
->job
.busy
); /* We're in job_sleep_ns() */
578 do_drain_begin(drain_type
, target
);
580 if (drain_type
== BDRV_DRAIN_ALL
) {
581 /* bdrv_drain_all() drains both src and target */
582 g_assert_cmpint(job
->job
.pause_count
, ==, 2);
584 g_assert_cmpint(job
->job
.pause_count
, ==, 1);
586 /* XXX We don't wait until the job is actually paused. Is this okay? */
587 /* g_assert_true(job->job.paused); */
588 g_assert_false(job
->job
.busy
); /* The job is paused */
590 do_drain_end(drain_type
, target
);
592 g_assert_cmpint(job
->job
.pause_count
, ==, 0);
593 g_assert_false(job
->job
.paused
);
594 g_assert_false(job
->job
.busy
); /* We're in job_sleep_ns() */
596 ret
= block_job_complete_sync(job
, &error_abort
);
597 g_assert_cmpint(ret
, ==, 0);
600 blk_unref(blk_target
);
605 static void test_blockjob_drain_all(void)
607 test_blockjob_common(BDRV_DRAIN_ALL
);
610 static void test_blockjob_drain(void)
612 test_blockjob_common(BDRV_DRAIN
);
615 static void test_blockjob_drain_subtree(void)
617 test_blockjob_common(BDRV_SUBTREE_DRAIN
);
620 int main(int argc
, char **argv
)
623 qemu_init_main_loop(&error_abort
);
625 g_test_init(&argc
, &argv
, NULL
);
627 g_test_add_func("/bdrv-drain/driver-cb/drain_all", test_drv_cb_drain_all
);
628 g_test_add_func("/bdrv-drain/driver-cb/drain", test_drv_cb_drain
);
629 g_test_add_func("/bdrv-drain/driver-cb/drain_subtree",
630 test_drv_cb_drain_subtree
);
632 // XXX bdrv_drain_all() doesn't work in coroutine context
633 g_test_add_func("/bdrv-drain/driver-cb/co/drain", test_drv_cb_co_drain
);
634 g_test_add_func("/bdrv-drain/driver-cb/co/drain_subtree",
635 test_drv_cb_co_drain_subtree
);
638 g_test_add_func("/bdrv-drain/quiesce/drain_all", test_quiesce_drain_all
);
639 g_test_add_func("/bdrv-drain/quiesce/drain", test_quiesce_drain
);
640 g_test_add_func("/bdrv-drain/quiesce/drain_subtree",
641 test_quiesce_drain_subtree
);
643 // XXX bdrv_drain_all() doesn't work in coroutine context
644 g_test_add_func("/bdrv-drain/quiesce/co/drain", test_quiesce_co_drain
);
645 g_test_add_func("/bdrv-drain/quiesce/co/drain_subtree",
646 test_quiesce_co_drain_subtree
);
648 g_test_add_func("/bdrv-drain/nested", test_nested
);
649 g_test_add_func("/bdrv-drain/multiparent", test_multiparent
);
650 g_test_add_func("/bdrv-drain/graph-change", test_graph_change
);
652 g_test_add_func("/bdrv-drain/blockjob/drain_all", test_blockjob_drain_all
);
653 g_test_add_func("/bdrv-drain/blockjob/drain", test_blockjob_drain
);
654 g_test_add_func("/bdrv-drain/blockjob/drain_subtree",
655 test_blockjob_drain_subtree
);