Return(0)));
}
+ void expect_clone(librados::MockTestMemIoCtxImpl* mock_io_ctx) {
+ EXPECT_CALL(*mock_io_ctx, clone())
+ .WillRepeatedly(Invoke([mock_io_ctx]() {
+ mock_io_ctx->get();
+ return mock_io_ctx;
+ }));
+ }
+
void expect_leader_watcher_init(MockLeaderWatcher& mock_leader_watcher,
int r) {
EXPECT_CALL(mock_leader_watcher, init())
auto mock_remote_rados_client = mock_cluster.do_create_rados_client(
g_ceph_context);
+ expect_clone(mock_local_io_ctx);
expect_mirror_mode_get(mock_local_io_ctx);
InSequence seq;
auto mock_remote_rados_client = mock_cluster.do_create_rados_client(
g_ceph_context);
+ expect_clone(mock_local_io_ctx);
expect_mirror_mode_get(mock_local_io_ctx);
InSequence seq;
}
for (auto &name : names) {
+ librados::IoCtx ns_ioctx;
+ ns_ioctx.dup(m_local_io_ctx);
+ ns_ioctx.set_namespace(name);
+
cls::rbd::MirrorMode mirror_mode = cls::rbd::MIRROR_MODE_DISABLED;
- int r = librbd::cls_client::mirror_mode_get(&m_local_io_ctx, &mirror_mode);
+ int r = librbd::cls_client::mirror_mode_get(&ns_ioctx, &mirror_mode);
if (r < 0 && r != -ENOENT) {
derr << "failed to get namespace mirror mode: " << cpp_strerror(r)
<< dendl;