static OpenLocalImageRequest* create(librados::IoCtx &local_io_ctx,
librbd::MockTestImageCtx **local_image_ctx,
- const std::string &local_image_name,
const std::string &local_image_id,
ContextWQ *work_queue,
Context *on_finish) {
return new MockBootstrapRequest(m_local_io_ctx,
m_remote_io_ctx,
mock_image_sync_throttler,
- &m_local_test_image_ctx,
- "local image name",
+ &m_local_test_image_ctx, "",
remote_image_id,
global_image_id,
m_threads->work_queue,
template <typename I>
void ImageReplayer<I>::bootstrap() {
- dout(20) << "bootstrap params: "
- << "local_image_name=" << m_local_image_name << dendl;
+ dout(20) << dendl;
Context *ctx = create_context_callback<
ImageReplayer, &ImageReplayer<I>::handle_bootstrap>(this);
BootstrapRequest<I> *request = BootstrapRequest<I>::create(
m_local_ioctx, m_remote_image.io_ctx, m_image_sync_throttler,
- &m_local_image_ctx, m_local_image_name, m_remote_image.image_id,
+ &m_local_image_ctx, m_local_image_id, m_remote_image.image_id,
m_global_image_id, m_threads->work_queue, m_threads->timer,
&m_threads->timer_lock, m_local_mirror_uuid, m_remote_image.mirror_uuid,
m_remote_journaler, &m_client_meta, ctx, &m_do_resync, &m_progress_cxt);
m_bootstrap_request = nullptr;
if (m_local_image_ctx) {
m_local_image_id = m_local_image_ctx->id;
- m_local_image_name = m_local_image_ctx->name;
}
}
Mutex::Locker locker(m_lock);
return m_local_image_id;
}
- inline std::string get_local_image_name() {
- Mutex::Locker locker(m_lock);
- return m_local_image_name;
- }
void start(Context *on_finish = nullptr, bool manual = false);
void stop(Context *on_finish = nullptr, bool manual = false,
int64_t m_local_pool_id;
std::string m_local_image_id;
std::string m_global_image_id;
- std::string m_local_image_name;
std::string m_name;
mutable Mutex m_lock;
State m_state = STATE_STOPPED;
librados::IoCtx &remote_io_ctx,
std::shared_ptr<ImageSyncThrottler<I>> image_sync_throttler,
I **local_image_ctx,
- const std::string &local_image_name,
+ const std::string &local_image_id,
const std::string &remote_image_id,
const std::string &global_image_id,
ContextWQ *work_queue, SafeTimer *timer,
reinterpret_cast<CephContext*>(local_io_ctx.cct()), on_finish),
m_local_io_ctx(local_io_ctx), m_remote_io_ctx(remote_io_ctx),
m_image_sync_throttler(image_sync_throttler),
- m_local_image_ctx(local_image_ctx), m_local_image_name(local_image_name),
+ m_local_image_ctx(local_image_ctx), m_local_image_id(local_image_id),
m_remote_image_id(remote_image_id), m_global_image_id(global_image_id),
m_work_queue(work_queue), m_timer(timer), m_timer_lock(timer_lock),
m_local_mirror_uuid(local_mirror_uuid),
return;
}
- // default local image name to the remote image name if not provided
- if (m_local_image_name.empty()) {
- m_local_image_name = m_remote_image_ctx->name;
- }
-
if (m_local_image_id.empty()) {
create_local_image();
return;
BootstrapRequest<I>, &BootstrapRequest<I>::handle_open_local_image>(
this);
OpenLocalImageRequest<I> *request = OpenLocalImageRequest<I>::create(
- m_local_io_ctx, m_local_image_ctx,
- (!m_local_image_id.empty() ? std::string() : m_local_image_name),
- m_local_image_id, m_work_queue, ctx);
+ m_local_io_ctx, m_local_image_ctx, m_local_image_id, m_work_queue,
+ ctx);
request->send();
}
m_local_image_id = "";
update_progress("CREATE_LOCAL_IMAGE");
+ m_remote_image_ctx->snap_lock.get_read();
+ std::string image_name = m_remote_image_ctx->name;
+ m_remote_image_ctx->snap_lock.put_read();
+
Context *ctx = create_context_callback<
BootstrapRequest<I>, &BootstrapRequest<I>::handle_create_local_image>(
this);
CreateImageRequest<I> *request = CreateImageRequest<I>::create(
m_local_io_ctx, m_work_queue, m_global_image_id, m_remote_mirror_uuid,
- m_local_image_name, m_remote_image_ctx, &m_local_image_id, ctx);
+ image_name, m_remote_image_ctx, &m_local_image_id, ctx);
request->send();
}
librados::IoCtx &remote_io_ctx,
ImageSyncThrottlerRef<ImageCtxT> image_sync_throttler,
ImageCtxT **local_image_ctx,
- const std::string &local_image_name,
+ const std::string &local_image_id,
const std::string &remote_image_id,
const std::string &global_image_id,
ContextWQ *work_queue, SafeTimer *timer,
ProgressContext *progress_ctx = nullptr) {
return new BootstrapRequest(local_io_ctx, remote_io_ctx,
image_sync_throttler, local_image_ctx,
- local_image_name, remote_image_id,
+ local_image_id, remote_image_id,
global_image_id, work_queue, timer, timer_lock,
local_mirror_uuid, remote_mirror_uuid,
journaler, client_meta, on_finish, do_resync,
librados::IoCtx &remote_io_ctx,
ImageSyncThrottlerRef<ImageCtxT> image_sync_throttler,
ImageCtxT **local_image_ctx,
- const std::string &local_image_name,
+ const std::string &local_image_id,
const std::string &remote_image_id,
const std::string &global_image_id, ContextWQ *work_queue,
SafeTimer *timer, Mutex *timer_lock,
librados::IoCtx &m_remote_io_ctx;
ImageSyncThrottlerRef<ImageCtxT> m_image_sync_throttler;
ImageCtxT **m_local_image_ctx;
- std::string m_local_image_name;
std::string m_local_image_id;
std::string m_remote_image_id;
std::string m_global_image_id;
template <typename I>
OpenLocalImageRequest<I>::OpenLocalImageRequest(librados::IoCtx &local_io_ctx,
I **local_image_ctx,
- const std::string &local_image_name,
const std::string &local_image_id,
ContextWQ *work_queue,
Context *on_finish)
: m_local_io_ctx(local_io_ctx), m_local_image_ctx(local_image_ctx),
- m_local_image_name(local_image_name), m_local_image_id(local_image_id),
- m_work_queue(work_queue), m_on_finish(on_finish) {
+ m_local_image_id(local_image_id), m_work_queue(work_queue),
+ m_on_finish(on_finish) {
}
template <typename I>
void OpenLocalImageRequest<I>::send_open_image() {
dout(20) << dendl;
- *m_local_image_ctx = I::create(m_local_image_name, m_local_image_id, nullptr,
+ *m_local_image_ctx = I::create("", m_local_image_id, nullptr,
m_local_io_ctx, false);
{
RWLock::WLocker owner_locker((*m_local_image_ctx)->owner_lock);
public:
static OpenLocalImageRequest* create(librados::IoCtx &local_io_ctx,
ImageCtxT **local_image_ctx,
- const std::string &local_image_name,
const std::string &local_image_id,
ContextWQ *work_queue,
Context *on_finish) {
return new OpenLocalImageRequest(local_io_ctx, local_image_ctx,
- local_image_name, local_image_id,
- work_queue, on_finish);
+ local_image_id, work_queue, on_finish);
}
OpenLocalImageRequest(librados::IoCtx &local_io_ctx,
ImageCtxT **local_image_ctx,
- const std::string &local_image_name,
const std::string &local_image_id,
ContextWQ *m_work_queue,
Context *on_finish);
*/
librados::IoCtx &m_local_io_ctx;
ImageCtxT **m_local_image_ctx;
- std::string m_local_image_name;
std::string m_local_image_id;
ContextWQ *m_work_queue;
Context *m_on_finish;