[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 18/28] test-block-iothread: BlockBackend AioContext a
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 18/28] test-block-iothread: BlockBackend AioContext across root node change |
Date: |
Mon, 3 Jun 2019 17:02:23 +0200 |
Test that BlockBackends preserve their assigned AioContext even when the
root node goes away. Inserting a new root node will move it to the right
AioContext.
Signed-off-by: Kevin Wolf <address@hidden>
---
tests/test-block-iothread.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/tests/test-block-iothread.c b/tests/test-block-iothread.c
index 38f59999ab..f41082e3bd 100644
--- a/tests/test-block-iothread.c
+++ b/tests/test-block-iothread.c
@@ -695,6 +695,38 @@ static void test_attach_second_node(void)
blk_unref(blk);
}
+static void test_attach_preserve_blk_ctx(void)
+{
+ IOThread *iothread = iothread_new();
+ AioContext *ctx = iothread_get_aio_context(iothread);
+ BlockBackend *blk;
+ BlockDriverState *bs;
+
+ blk = blk_new(ctx, BLK_PERM_ALL, BLK_PERM_ALL);
+ bs = bdrv_new_open_driver(&bdrv_test, "base", BDRV_O_RDWR, &error_abort);
+ bs->total_sectors = 65536 / BDRV_SECTOR_SIZE;
+
+ /* Add node to BlockBackend that has an iothread context assigned */
+ blk_insert_bs(blk, bs, &error_abort);
+ g_assert(blk_get_aio_context(blk) == ctx);
+ g_assert(bdrv_get_aio_context(bs) == ctx);
+
+ /* Remove the node again */
+ blk_remove_bs(blk);
+ /* TODO bs should move back to main context here */
+ g_assert(blk_get_aio_context(blk) == ctx);
+ g_assert(bdrv_get_aio_context(bs) == ctx);
+
+ /* Re-attach the node */
+ blk_insert_bs(blk, bs, &error_abort);
+ g_assert(blk_get_aio_context(blk) == ctx);
+ g_assert(bdrv_get_aio_context(bs) == ctx);
+
+ blk_set_aio_context(blk, qemu_get_aio_context(), &error_abort);
+ bdrv_unref(bs);
+ blk_unref(blk);
+}
+
int main(int argc, char **argv)
{
int i;
@@ -711,6 +743,7 @@ int main(int argc, char **argv)
g_test_add_func("/attach/blockjob", test_attach_blockjob);
g_test_add_func("/attach/second_node", test_attach_second_node);
+ g_test_add_func("/attach/preserve_blk_ctx", test_attach_preserve_blk_ctx);
g_test_add_func("/propagate/basic", test_propagate_basic);
g_test_add_func("/propagate/diamond", test_propagate_diamond);
g_test_add_func("/propagate/mirror", test_propagate_mirror);
--
2.20.1
- [Qemu-devel] [PULL 11/28] nbd-server: Call blk_set_allow_aio_context_change(), (continued)
- [Qemu-devel] [PULL 11/28] nbd-server: Call blk_set_allow_aio_context_change(), Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 13/28] block: Add BlockBackend.ctx, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 14/28] block: Add qdev_prop_drive_iothread property type, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 17/28] test-block-iothread: Test adding parent to iothread node, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 19/28] block: Move node without parents to main AioContext, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 16/28] block: Adjust AioContexts when attaching nodes, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 20/28] blockdev: Use bdrv_try_set_aio_context() for monitor commands, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 15/28] scsi-disk: Use qdev_prop_drive_iothread, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 22/28] virtio-scsi-test: Test attaching new overlay with iothreads, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 21/28] block: Remove wrong bdrv_set_aio_context() calls, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 18/28] test-block-iothread: BlockBackend AioContext across root node change,
Kevin Wolf <=
- [Qemu-devel] [PULL 23/28] iotests: Attach new devices to node in non-default iothread, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 24/28] test-bdrv-drain: Use bdrv_try_set_aio_context(), Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 25/28] block: Remove bdrv_set_aio_context(), Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 26/28] block/qcow2-refcount: add trace-point to qcow2_process_discards, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 27/28] block/io: bdrv_pdiscard: support int64_t bytes parameter, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 28/28] iotests: Fix duplicated diff output on failure, Kevin Wolf, 2019/06/03
- Re: [Qemu-devel] [PULL 00/28] Block layer patches, Peter Maydell, 2019/06/03
- Re: [Qemu-devel] [PULL 00/28] Block layer patches, no-reply, 2019/06/03