summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKevin Wolf2019-04-24 17:41:46 +0200
committerKevin Wolf2019-06-04 15:22:22 +0200
commit132ada80c4a6fea7b67e8bb0a5fd299994d927c6 (patch)
tree3457b1a3fb7bc3c40ec2d1bbed86b374809ce79f /tests
parentscsi-disk: Use qdev_prop_drive_iothread (diff)
downloadqemu-132ada80c4a6fea7b67e8bb0a5fd299994d927c6.tar.gz
qemu-132ada80c4a6fea7b67e8bb0a5fd299994d927c6.tar.xz
qemu-132ada80c4a6fea7b67e8bb0a5fd299994d927c6.zip
block: Adjust AioContexts when attaching nodes
So far, we only made sure that updating the AioContext of a node affected the whole subtree. However, if a node is newly attached to a new parent, we also need to make sure that both the subtree of the node and the parent are in the same AioContext. This tries to move the new child node to the parent AioContext and returns an error if this isn't possible. BlockBackends now actually apply their AioContext to their root node. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-bdrv-drain.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c
index fabbd52d93..16ea2b813f 100644
--- a/tests/test-bdrv-drain.c
+++ b/tests/test-bdrv-drain.c
@@ -912,6 +912,7 @@ static void test_blockjob_common_drain_node(enum drain_type drain_type,
&error_abort);
blk_target = blk_new(qemu_get_aio_context(), BLK_PERM_ALL, BLK_PERM_ALL);
blk_insert_bs(blk_target, target, &error_abort);
+ blk_set_allow_aio_context_change(blk_target, true);
aio_context_acquire(ctx);
tjob = block_job_create("job0", &test_job_driver, NULL, src,
@@ -972,7 +973,7 @@ static void test_blockjob_common_drain_node(enum drain_type drain_type,
g_assert_false(job->job.paused);
g_assert_true(job->job.busy); /* We're in qemu_co_sleep_ns() */
- do_drain_begin(drain_type, target);
+ do_drain_begin_unlocked(drain_type, target);
if (drain_type == BDRV_DRAIN_ALL) {
/* bdrv_drain_all() drains both src and target */
@@ -983,7 +984,7 @@ static void test_blockjob_common_drain_node(enum drain_type drain_type,
g_assert_true(job->job.paused);
g_assert_false(job->job.busy); /* The job is paused */
- do_drain_end(drain_type, target);
+ do_drain_end_unlocked(drain_type, target);
if (use_iothread) {
/* paused is reset in the I/O thread, wait for it */
@@ -1002,6 +1003,7 @@ static void test_blockjob_common_drain_node(enum drain_type drain_type,
if (use_iothread) {
blk_set_aio_context(blk_src, qemu_get_aio_context(), &error_abort);
+ blk_set_aio_context(blk_target, qemu_get_aio_context(), &error_abort);
}
aio_context_release(ctx);