ImageSync should never be needed for snapshot-based mirroring.
Credits and thanks to Nithya and Ilya for highlighting it.
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
}
ImageSync<> *create_request(Context *ctx) {
- return new ImageSync<>(m_threads, nullptr, m_local_image_ctx,
- m_remote_image_ctx, "mirror-uuid",
- m_sync_point_handler, m_instance_watcher, nullptr,
- 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;
#include "librbd/asio/ContextWQ.h"
#include "librbd/deep_copy/Handler.h"
#include "tools/rbd_mirror/Threads.h"
-#include "tools/rbd_mirror/Types.h"
#include "tools/rbd_mirror/image_sync/SyncPointCreateRequest.h"
#include "tools/rbd_mirror/image_sync/SyncPointPruneRequest.h"
#include "tools/rbd_mirror/image_sync/Types.h"
template <typename I>
ImageSync<I>::ImageSync(
Threads<I>* threads,
- GroupCtx *local_group_ctx,
I *local_image_ctx,
I *remote_image_ctx,
const std::string &local_mirror_uuid,
m_update_sync_point_interval(
m_local_image_ctx->cct->_conf.template get_val<double>(
"rbd_mirror_sync_point_update_age")) {
- if (local_group_ctx == nullptr) {
- m_sync_id = m_local_image_ctx->id;
- } else {
- m_sync_id = stringify(m_local_image_ctx->md_ctx.get_id()) + ":" +
- m_local_image_ctx->id;
- }
}
template <typename I>
m_canceled = true;
- if (m_instance_watcher->cancel_sync_request(m_sync_id)) {
+ if (m_instance_watcher->cancel_sync_request(m_local_image_ctx->id)) {
return;
}
Context *ctx = create_async_context_callback(
m_threads->work_queue, create_context_callback<
ImageSync<I>, &ImageSync<I>::handle_notify_sync_request>(this));
- m_instance_watcher->notify_sync_request(m_sync_id, ctx);
+ m_instance_watcher->notify_sync_request(m_local_image_ctx->id, ctx);
m_lock.unlock();
}
void ImageSync<I>::finish(int r) {
dout(20) << ": r=" << r << dendl;
- m_instance_watcher->notify_sync_complete(m_sync_id);
+ m_instance_watcher->notify_sync_complete(m_local_image_ctx->id);
CancelableRequest::finish(r);
}
class ProgressContext;
template <typename> class InstanceWatcher;
template <typename> class Threads;
-struct GroupCtx;
namespace image_sync { struct SyncPointHandler; }
public:
static ImageSync* create(
Threads<ImageCtxT>* threads,
- GroupCtx *local_group_ctx,
ImageCtxT *local_image_ctx,
ImageCtxT *remote_image_ctx,
const std::string &local_mirror_uuid,
InstanceWatcher<ImageCtxT> *instance_watcher,
ProgressContext *progress_ctx,
Context *on_finish) {
- return new ImageSync(threads, local_group_ctx, local_image_ctx,
- remote_image_ctx, local_mirror_uuid,
- sync_point_handler, instance_watcher, progress_ctx,
- on_finish);
+ return new ImageSync(threads, local_image_ctx, remote_image_ctx,
+ local_mirror_uuid, sync_point_handler,
+ instance_watcher, progress_ctx, on_finish);
}
ImageSync(
Threads<ImageCtxT>* threads,
- GroupCtx *local_group_ctx,
ImageCtxT *local_image_ctx,
ImageCtxT *remote_image_ctx,
const std::string &local_mirror_uuid,
ceph::mutex m_lock;
bool m_canceled = false;
- std::string m_sync_id;
librbd::DeepCopyRequest<ImageCtxT> *m_image_copy_request = nullptr;
ImageCopyProgressHandler *m_image_copy_prog_handler = nullptr;
Context *ctx = create_context_callback<
BootstrapRequest<I>, &BootstrapRequest<I>::handle_image_sync>(this);
m_image_sync = ImageSync<I>::create(
- m_threads, m_local_group_ctx, state_builder->local_image_ctx,
- state_builder->remote_image_ctx, m_local_mirror_uuid, sync_point_handler,
- m_instance_watcher, m_progress_ctx, ctx);
+ m_threads, state_builder->local_image_ctx, state_builder->remote_image_ctx,
+ m_local_mirror_uuid, sync_point_handler, m_instance_watcher,
+ m_progress_ctx, ctx);
m_image_sync->get();
locker.unlock();