const std::string&,
ProgressContext*,
Context*));
- MOCK_METHOD6(create_prepare_replay_request,
+ MOCK_METHOD5(create_prepare_replay_request,
BaseRequest*(const std::string&,
- librbd::mirror::PromotionState,
ProgressContext*,
bool*, bool*, Context*));
void expect_prepare_replay(MockStateBuilder& mock_state_builder,
bool resync_requested, bool syncing, int r) {
EXPECT_CALL(mock_state_builder,
- create_prepare_replay_request(_, _, _, _, _, _))
- .WillOnce(WithArgs<3, 4, 5>(
+ create_prepare_replay_request(_, _, _, _, _))
+ .WillOnce(WithArgs<2, 3, 4>(
Invoke([this, &mock_state_builder, resync_requested, syncing, r]
(bool* resync, bool* sync, Context* ctx) {
if (r >= 0) {
std::string local_image_id;
std::string remote_image_id;
std::string remote_mirror_uuid;
+ librbd::mirror::PromotionState remote_promotion_state;
virtual ~StateBuilder() {}
ASSERT_TRUE(mock_state_builder != nullptr);
ASSERT_EQ(std::string("remote image id"),
mock_journal_state_builder.remote_image_id);
+ ASSERT_EQ(librbd::mirror::PROMOTION_STATE_PRIMARY,
+ mock_journal_state_builder.remote_promotion_state);
ASSERT_TRUE(mock_journal_state_builder.remote_journaler != nullptr);
ASSERT_EQ(cls::journal::CLIENT_STATE_DISCONNECTED,
mock_journal_state_builder.remote_client_state);
ASSERT_TRUE(mock_state_builder != nullptr);
ASSERT_EQ(std::string("remote image id"),
mock_journal_state_builder.remote_image_id);
+ ASSERT_EQ(librbd::mirror::PROMOTION_STATE_PRIMARY,
+ mock_journal_state_builder.remote_promotion_state);
ASSERT_TRUE(mock_journal_state_builder.remote_journaler != nullptr);
ASSERT_EQ(cls::journal::CLIENT_STATE_CONNECTED,
mock_journal_state_builder.remote_client_state);
auto ctx = create_context_callback<
BootstrapRequest<I>, &BootstrapRequest<I>::handle_prepare_replay>(this);
auto request = (*m_state_builder)->create_prepare_replay_request(
- m_local_mirror_uuid, m_promotion_state, m_progress_ctx, m_do_resync,
- &m_syncing, ctx);
+ m_local_mirror_uuid, m_progress_ctx, m_do_resync, &m_syncing, ctx);
request->send();
}
state_builder->remote_mirror_uuid = m_remote_pool_meta.mirror_uuid;
state_builder->remote_image_id = m_remote_image_id;
+ state_builder->remote_promotion_state = m_promotion_state;
state_builder->remote_journaler = m_remote_journaler;
state_builder->remote_client_state = client_state;
state_builder->remote_client_meta = client_meta;
virtual BaseRequest* create_prepare_replay_request(
const std::string& local_mirror_uuid,
- librbd::mirror::PromotionState remote_promotion_state,
ProgressContext* progress_ctx,
bool* resync_requested,
bool* syncing,
std::string remote_mirror_uuid;
std::string remote_image_id;
+ librbd::mirror::PromotionState remote_promotion_state =
+ librbd::mirror::PROMOTION_STATE_NON_PRIMARY;
protected:
image_sync::SyncPointHandler* m_sync_point_handler = nullptr;
template <typename I>
BaseRequest* StateBuilder<I>::create_prepare_replay_request(
const std::string& local_mirror_uuid,
- librbd::mirror::PromotionState remote_promotion_state,
ProgressContext* progress_ctx,
bool* resync_requested,
bool* syncing,
Context* on_finish) {
return PrepareReplayRequest<I>::create(
- local_mirror_uuid, remote_promotion_state, progress_ctx, this,
+ local_mirror_uuid, this->remote_promotion_state, progress_ctx, this,
resync_requested, syncing, on_finish);
}
BaseRequest* create_prepare_replay_request(
const std::string& local_mirror_uuid,
- librbd::mirror::PromotionState remote_promotion_state,
ProgressContext* progress_ctx,
bool* resync_requested,
bool* syncing,
template <typename I>
BaseRequest* StateBuilder<I>::create_prepare_replay_request(
const std::string& local_mirror_uuid,
- librbd::mirror::PromotionState remote_promotion_state,
ProgressContext* progress_ctx,
bool* resync_requested,
bool* syncing,
BaseRequest* create_prepare_replay_request(
const std::string& local_mirror_uuid,
- librbd::mirror::PromotionState remote_promotion_state,
ProgressContext* progress_ctx,
bool* resync_requested,
bool* syncing,