mock_listener);
C_SaferCond ctx;
mock_pool_watcher.init(&ctx);
- ASSERT_EQ(0, ctx.wait());
+ ASSERT_EQ(-ENOENT, ctx.wait());
ASSERT_TRUE(wait_for_update(1));
expect_mirroring_watcher_unregister(mock_mirroring_watcher, 0);
void PoolReplayer<I>::handle_init_remote_pool_watcher(
int r, Context *on_finish) {
dout(10) << "r=" << r << dendl;
- if (r < 0) {
+ if (r == -ENOENT) {
+ // Technically nothing to do since the other side doesn't
+ // have mirroring enabled. Eventually the remote pool watcher will
+ // detect images (if mirroring is enabled), so no point propagating
+ // an error which would just busy-spin the state machines.
+ dout(0) << "remote peer does not have mirroring configured" << dendl;
+ } else if (r < 0) {
derr << "failed to retrieve remote images: " << cpp_strerror(r) << dendl;
on_finish = new FunctionContext([on_finish, r](int) {
on_finish->complete(r);
} else if (r == -ENOENT) {
dout(5) << "mirroring directory does not exist" << dendl;
schedule_refresh_images(30);
+
+ Mutex::Locker locker(m_lock);
+ std::swap(on_init_finish, m_on_init_finish);
} else {
derr << "unexpected error registering mirroring directory watch: "
<< cpp_strerror(r) << dendl;