return 0;
}
-template <typename I>
-int Journal<I>::is_tag_owner(I *image_ctx, bool *is_tag_owner) {
- return Journal<I>::is_tag_owner(image_ctx->md_ctx, image_ctx->id,
- is_tag_owner, image_ctx->op_work_queue);
-}
-
-template <typename I>
-int Journal<I>::is_tag_owner(librados::IoCtx& io_ctx, std::string& image_id,
- bool *is_tag_owner, ContextWQ *op_work_queue) {
- C_SaferCond ctx;
- Journal<I>::is_tag_owner(io_ctx, image_id, is_tag_owner, op_work_queue, &ctx);
-
- int r = ctx.wait();
- if (r < 0) {
- return r;
- }
- return r;
-}
-
template <typename I>
void Journal<I>::is_tag_owner(I *image_ctx, bool *owner,
Context *on_finish) {
&is_tag_owner_ctx->tag_data, is_tag_owner_ctx);
}
-template <typename I>
-int Journal<I>::get_tag_owner(I *image_ctx, std::string *mirror_uuid) {
- C_SaferCond get_tags_ctx;
- get_tag_owner(image_ctx->md_ctx, image_ctx->id, mirror_uuid,
- image_ctx->op_work_queue, &get_tags_ctx);
-
- int r = get_tags_ctx.wait();
- if (r < 0) {
- return r;
- }
- return 0;
-}
-
template <typename I>
void Journal<I>::get_tag_owner(IoCtx& io_ctx, std::string& image_id,
std::string *mirror_uuid,
static int remove(librados::IoCtx &io_ctx, const std::string &image_id);
static int reset(librados::IoCtx &io_ctx, const std::string &image_id);
- static int is_tag_owner(ImageCtxT *image_ctx, bool *is_tag_owner);
- static int is_tag_owner(librados::IoCtx& io_ctx, std::string& image_id,
- bool *is_tag_owner, ContextWQ *op_work_queue);
static void is_tag_owner(ImageCtxT *image_ctx, bool *is_tag_owner,
Context *on_finish);
static void is_tag_owner(librados::IoCtx& io_ctx, std::string& image_id,
bool *is_tag_owner, ContextWQ *op_work_queue,
Context *on_finish);
- static int get_tag_owner(ImageCtxT *image_ctx, std::string *mirror_uuid);
static void get_tag_owner(librados::IoCtx& io_ctx, std::string& image_id,
std::string *mirror_uuid,
ContextWQ *op_work_queue, Context *on_finish);
return r;
}
- std::string mirror_uuid;
- r = Journal<I>::get_tag_owner(ictx, &mirror_uuid);
+ C_SaferCond tag_owner_ctx;
+ bool is_tag_owner;
+ Journal<I>::is_tag_owner(ictx, &is_tag_owner, &tag_owner_ctx);
+ r = tag_owner_ctx.wait();
if (r < 0) {
lderr(cct) << "failed to determine tag ownership: " << cpp_strerror(r)
<< dendl;
return r;
- } else if (mirror_uuid == Journal<>::LOCAL_MIRROR_UUID) {
+ } else if (is_tag_owner) {
lderr(cct) << "image is primary, cannot resync to itself" << dendl;
return -EINVAL;
}
}
bool is_primary = false;
- r = Journal<>::is_tag_owner(ioctx, local_image_id, &is_primary,
- m_work_queue);
+ C_SaferCond tag_owner_ctx;
+ Journal<>::is_tag_owner(ioctx, local_image_id, &is_primary,
+ m_work_queue, &tag_owner_ctx);
+ r = tag_owner_ctx.wait();
if (r < 0 && r != -ENOENT) {
derr << "error retrieving image primary info for image " << global_image_id
<< ": " << cpp_strerror(r) << dendl;