summaryrefslogtreecommitdiffstats
path: root/src/test/rbd_mirror/test_ImageSync.cc
diff options
context:
space:
mode:
authorJason Dillaman <dillaman@redhat.com>2020-01-08 05:44:25 +0100
committerJason Dillaman <dillaman@redhat.com>2020-01-09 16:48:52 +0100
commita6d1d1226277eba4fcf71560865502b5673ed541 (patch)
treee818d33b922c7914484b5a840b74a8cb6602d6db /src/test/rbd_mirror/test_ImageSync.cc
parentrbd-mirror: helper abstraction layer for image sync points (diff)
downloadceph-a6d1d1226277eba4fcf71560865502b5673ed541.tar.xz
ceph-a6d1d1226277eba4fcf71560865502b5673ed541.zip
rbd-mirror: switch image sync to use abstract sync point handler
This removes all journal-specific code from the image sync path. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Diffstat (limited to 'src/test/rbd_mirror/test_ImageSync.cc')
-rw-r--r--src/test/rbd_mirror/test_ImageSync.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/test/rbd_mirror/test_ImageSync.cc b/src/test/rbd_mirror/test_ImageSync.cc
index b585ea571fb..c8aab54b0b5 100644
--- a/src/test/rbd_mirror/test_ImageSync.cc
+++ b/src/test/rbd_mirror/test_ImageSync.cc
@@ -21,6 +21,7 @@
#include "tools/rbd_mirror/InstanceWatcher.h"
#include "tools/rbd_mirror/Threads.h"
#include "tools/rbd_mirror/Throttler.h"
+#include "tools/rbd_mirror/image_replayer/journal/StateBuilder.h"
void register_test_image_sync() {
}
@@ -92,11 +93,21 @@ public:
encode(client_data, client_data_bl);
ASSERT_EQ(0, m_remote_journaler->register_client(client_data_bl));
+
+ m_state_builder = rbd::mirror::image_replayer::journal::StateBuilder<
+ librbd::ImageCtx>::create("global image id");
+ m_state_builder->remote_journaler = m_remote_journaler;
+ m_state_builder->remote_client_meta = m_client_meta;
+ m_sync_point_handler = m_state_builder->create_sync_point_handler();
}
void TearDown() override {
m_instance_watcher->handle_release_leader();
+ m_state_builder->remote_journaler = nullptr;
+ m_state_builder->destroy_sync_point_handler();
+ m_state_builder->destroy();
+
delete m_remote_journaler;
delete m_instance_watcher;
delete m_image_sync_throttler;
@@ -119,10 +130,9 @@ public:
}
ImageSync<> *create_request(Context *ctx) {
- return new ImageSync<>(m_local_image_ctx, m_remote_image_ctx,
- m_threads->timer, &m_threads->timer_lock,
- "mirror-uuid", m_remote_journaler, &m_client_meta,
- m_threads->work_queue, m_instance_watcher, ctx);
+ return new ImageSync<>(m_threads, m_local_image_ctx, m_remote_image_ctx,
+ "mirror-uuid", m_sync_point_handler,
+ m_instance_watcher, nullptr, ctx);
}
librbd::ImageCtx *m_remote_image_ctx;
@@ -131,6 +141,8 @@ public:
rbd::mirror::InstanceWatcher<> *m_instance_watcher;
::journal::Journaler *m_remote_journaler;
librbd::journal::MirrorPeerClientMeta m_client_meta;
+ rbd::mirror::image_replayer::journal::StateBuilder<librbd::ImageCtx>* m_state_builder = nullptr;
+ rbd::mirror::image_sync::SyncPointHandler* m_sync_point_handler = nullptr;
};
TEST_F(TestImageSync, Empty) {