From 18e683932ee1a3f0126ad56ade3bfb8a0d860c6c Mon Sep 17 00:00:00 2001 From: zhengyin Date: Tue, 25 Feb 2020 22:51:36 +0800 Subject: [PATCH] test: add read balance mode test case Signed-off-by: Zheng Yin --- qa/suites/rbd/qemu/features/readbalance.yaml | 11 +++++++++++ src/test/librbd/mock/MockImageCtx.h | 2 ++ src/test/librbd/test_librbd.cc | 1 + 3 files changed, 14 insertions(+) create mode 100644 qa/suites/rbd/qemu/features/readbalance.yaml diff --git a/qa/suites/rbd/qemu/features/readbalance.yaml b/qa/suites/rbd/qemu/features/readbalance.yaml new file mode 100644 index 00000000000..463925de6e5 --- /dev/null +++ b/qa/suites/rbd/qemu/features/readbalance.yaml @@ -0,0 +1,11 @@ +overrides: + ceph: + conf: + client: + rbd read from replica policy: balance + +tasks: +- exec: + osd.0: + - ceph osd require-osd-release octopus + - ceph osd set-require-min-compat-client octopus diff --git a/src/test/librbd/mock/MockImageCtx.h b/src/test/librbd/mock/MockImageCtx.h index 870bbe08dcc..32097393ea3 100644 --- a/src/test/librbd/mock/MockImageCtx.h +++ b/src/test/librbd/mock/MockImageCtx.h @@ -98,6 +98,7 @@ struct MockImageCtx { blkin_trace_all(image_ctx.blkin_trace_all), enable_alloc_hint(image_ctx.enable_alloc_hint), alloc_hint_flags(image_ctx.alloc_hint_flags), + read_flags(image_ctx.read_flags), ignore_migrating(image_ctx.ignore_migrating), enable_sparse_copyup(image_ctx.enable_sparse_copyup), mtime_update_interval(image_ctx.mtime_update_interval), @@ -305,6 +306,7 @@ struct MockImageCtx { bool blkin_trace_all; bool enable_alloc_hint; uint32_t alloc_hint_flags; + uint32_t read_flags; bool ignore_migrating; bool enable_sparse_copyup; uint64_t mtime_update_interval; diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc index 7529a1ce57e..24d9822a707 100644 --- a/src/test/librbd/test_librbd.cc +++ b/src/test/librbd/test_librbd.cc @@ -1948,6 +1948,7 @@ TEST_F(TestLibRBD, TestIO) uint64_t size = 2 << 20; ASSERT_EQ(0, create_image(ioctx, name.c_str(), size, &order)); + ASSERT_EQ(0, rados_conf_set(_cluster, "rbd_read_from_replica_policy", "balance")); ASSERT_EQ(0, rbd_open(ioctx, name.c_str(), &image, NULL)); char test_data[TEST_IO_SIZE + 1];