: m_image_ctx(image_ctx), m_state(STATE_UNINITIALIZED),
m_lock(util::unique_lock_name("librbd::ImageState::m_lock", this)),
m_last_refresh(0), m_refresh_seq(0),
- m_update_watchers(new ImageUpdateWatchers(image_ctx->cct)) {
+ m_update_watchers(new ImageUpdateWatchers(image_ctx->cct)),
+ m_skip_open_parent_image(false) {
}
template <typename I>
}
template <typename I>
-int ImageState<I>::open() {
+int ImageState<I>::open(bool skip_open_parent) {
C_SaferCond ctx;
- open(&ctx);
+ open(skip_open_parent, &ctx);
return ctx.wait();
}
template <typename I>
-void ImageState<I>::open(Context *on_finish) {
+void ImageState<I>::open(bool skip_open_parent, Context *on_finish) {
CephContext *cct = m_image_ctx->cct;
ldout(cct, 20) << __func__ << dendl;
m_lock.Lock();
assert(m_state == STATE_UNINITIALIZED);
+ m_skip_open_parent_image = skip_open_parent;
Action action(ACTION_TYPE_OPEN);
action.refresh_seq = m_refresh_seq;
*m_image_ctx, create_context_callback<
ImageState<I>, &ImageState<I>::handle_open>(this));
image::OpenRequest<I> *req = image::OpenRequest<I>::create(
- m_image_ctx, ctx);
+ m_image_ctx, m_skip_open_parent_image, ctx);
m_lock.Unlock();
req->send();
*m_image_ctx, create_context_callback<
ImageState<I>, &ImageState<I>::handle_refresh>(this));
image::RefreshRequest<I> *req = image::RefreshRequest<I>::create(
- *m_image_ctx, false, ctx);
+ *m_image_ctx, false, false, ctx);
m_lock.Unlock();
req->send();
ImageState(ImageCtxT *image_ctx);
~ImageState();
- int open();
- void open(Context *on_finish);
+ int open(bool skip_open_parent);
+ void open(bool skip_open_parent, Context *on_finish);
int close();
void close(Context *on_finish);
ImageUpdateWatchers *m_update_watchers;
+ bool m_skip_open_parent_image;
+
bool is_transition_state() const;
bool is_closed() const;
// ImageState is blocked waiting for lock to complete -- safe to directly
// refresh
image::RefreshRequest<I> *req = image::RefreshRequest<I>::create(
- m_image_ctx, true, ctx);
+ m_image_ctx, true, false, ctx);
req->send();
}
using util::create_rados_ack_callback;
template <typename I>
-OpenRequest<I>::OpenRequest(I *image_ctx, Context *on_finish)
- : m_image_ctx(image_ctx), m_on_finish(on_finish), m_error_result(0),
+OpenRequest<I>::OpenRequest(I *image_ctx, bool skip_open_parent,
+ Context *on_finish)
+ : m_image_ctx(image_ctx), m_skip_open_parent_image(skip_open_parent),
+ m_on_finish(on_finish), m_error_result(0),
m_last_metadata_key(ImageCtx::METADATA_CONF_PREFIX) {
}
using klass = OpenRequest<I>;
RefreshRequest<I> *req = RefreshRequest<I>::create(
- *m_image_ctx, false,
+ *m_image_ctx, false, m_skip_open_parent_image,
create_context_callback<klass, &klass::handle_refresh>(this));
req->send();
}
template <typename ImageCtxT = ImageCtx>
class OpenRequest {
public:
- static OpenRequest *create(ImageCtxT *image_ctx, Context *on_finish) {
- return new OpenRequest(image_ctx, on_finish);
+ static OpenRequest *create(ImageCtxT *image_ctx, bool skip_open_parent,
+ Context *on_finish) {
+ return new OpenRequest(image_ctx, skip_open_parent, on_finish);
}
void send();
* @endverbatim
*/
- OpenRequest(ImageCtxT *image_ctx, Context *on_finish);
+ OpenRequest(ImageCtxT *image_ctx, bool skip_open_parent, Context *on_finish);
ImageCtxT *m_image_ctx;
+ bool m_skip_open_parent_image;
Context *m_on_finish;
bufferlist m_out_bl;
Context *ctx = create_async_context_callback(
m_child_image_ctx, create_context_callback<
klass, &klass::handle_open_parent, false>(this));
- OpenRequest<I> *req = OpenRequest<I>::create(m_parent_image_ctx, ctx);
+ OpenRequest<I> *req = OpenRequest<I>::create(m_parent_image_ctx, false, ctx);
req->send();
}
template <typename I>
RefreshRequest<I>::RefreshRequest(I &image_ctx, bool acquiring_lock,
- Context *on_finish)
+ bool skip_open_parent, Context *on_finish)
: m_image_ctx(image_ctx), m_acquiring_lock(acquiring_lock),
+ m_skip_open_parent_image(skip_open_parent),
m_on_finish(create_async_context_callback(m_image_ctx, on_finish)),
m_error_result(0), m_flush_aio(false), m_exclusive_lock(nullptr),
m_object_map(nullptr), m_journal(nullptr), m_refresh_parent(nullptr) {
parent_info parent_md;
int r = get_parent_info(m_image_ctx.snap_id, &parent_md);
- if (r < 0 ||
- RefreshParentRequest<I>::is_refresh_required(m_image_ctx, parent_md)) {
+ if (!m_skip_open_parent_image && (r < 0 ||
+ RefreshParentRequest<I>::is_refresh_required(m_image_ctx, parent_md))) {
CephContext *cct = m_image_ctx.cct;
ldout(cct, 10) << this << " " << __func__ << dendl;
class RefreshRequest {
public:
static RefreshRequest *create(ImageCtxT &image_ctx, bool acquiring_lock,
- Context *on_finish) {
- return new RefreshRequest(image_ctx, acquiring_lock, on_finish);
+ bool skip_open_parent, Context *on_finish) {
+ return new RefreshRequest(image_ctx, acquiring_lock, skip_open_parent,
+ on_finish);
}
- RefreshRequest(ImageCtxT &image_ctx, bool acquiring_lock, Context *on_finish);
+ RefreshRequest(ImageCtxT &image_ctx, bool acquiring_lock,
+ bool skip_open_parent, Context *on_finish);
~RefreshRequest();
void send();
ImageCtxT &m_image_ctx;
bool m_acquiring_lock;
+ bool m_skip_open_parent_image;
Context *m_on_finish;
int m_error_result;
for (auto &id_it : info.second) {
ImageCtx *imctx = new ImageCtx("", id_it, NULL, ioctx, false);
- int r = imctx->state->open();
+ int r = imctx->state->open(false);
if (r < 0) {
lderr(cct) << "error opening image: "
<< cpp_strerror(r) << dendl;
// make sure parent snapshot exists
ImageCtx *p_imctx = new ImageCtx(p_name, "", p_snap_name, p_ioctx, true);
- int r = p_imctx->state->open();
+ int r = p_imctx->state->open(false);
if (r < 0) {
lderr(cct) << "error opening parent image: "
<< cpp_strerror(r) << dendl;
}
c_imctx = new ImageCtx(c_name, "", NULL, c_ioctx, false);
- r = c_imctx->state->open();
+ r = c_imctx->state->open(false);
if (r < 0) {
lderr(cct) << "Error opening new image: " << cpp_strerror(r) << dendl;
delete c_imctx;
<< dstname << dendl;
ImageCtx *ictx = new ImageCtx(srcname, "", "", io_ctx, false);
- int r = ictx->state->open();
+ int r = ictx->state->open(false);
if (r < 0) {
lderr(ictx->cct) << "error opening source image: " << cpp_strerror(r)
<< dendl;
bool unknown_format = true;
ImageCtx *ictx = new ImageCtx(
(id.empty() ? name : std::string()), id, nullptr, io_ctx, false);
- int r = ictx->state->open();
+ int r = ictx->state->open(true);
if (r < 0) {
ldout(cct, 2) << "error opening image: " << cpp_strerror(-r) << dendl;
delete ictx;
ImageCtx *dest = new librbd::ImageCtx(destname, "", NULL,
dest_md_ctx, false);
- r = dest->state->open();
+ r = dest->state->open(false);
if (r < 0) {
delete dest;
lderr(cct) << "failed to read newly created header" << dendl;
if ((features & RBD_FEATURE_JOURNALING) != 0) {
ImageCtx *img_ctx = new ImageCtx("", img_pair.second, nullptr,
io_ctx, false);
- r = img_ctx->state->open();
+ r = img_ctx->state->open(false);
if (r < 0) {
lderr(cct) << "error opening image "<< img_pair.first << ": "
<< cpp_strerror(r) << dendl;
}
} else {
ImageCtx *img_ctx = new ImageCtx("", img_id, nullptr, io_ctx, false);
- r = img_ctx->state->open();
+ r = img_ctx->state->open(false);
if (r < 0) {
lderr(cct) << "error opening image id "<< img_id << ": "
<< cpp_strerror(r) << dendl;
virtual void finish(int r) {
ldout(ictx->cct, 20) << "C_OpenAfterCloseComplete::finish: r=" << r
<< dendl;
- ictx->state->open(new C_OpenComplete(ictx, comp, ictxp, true));
+ ictx->state->open(false, new C_OpenComplete(ictx, comp, ictxp, true));
}
};
image.ctx = NULL;
}
- int r = ictx->state->open();
+ int r = ictx->state->open(false);
if (r < 0) {
delete ictx;
tracepoint(librbd, open_image_exit, r);
reinterpret_cast<ImageCtx*>(image.ctx)->state->close(
new C_OpenAfterCloseComplete(ictx, get_aio_completion(c), &image.ctx));
} else {
- ictx->state->open(new C_OpenComplete(ictx, get_aio_completion(c),
+ ictx->state->open(false, new C_OpenComplete(ictx, get_aio_completion(c),
&image.ctx));
}
tracepoint(librbd, aio_open_image_exit, 0);
image.ctx = NULL;
}
- int r = ictx->state->open();
+ int r = ictx->state->open(false);
if (r < 0) {
delete ictx;
tracepoint(librbd, open_image_exit, r);
reinterpret_cast<ImageCtx*>(image.ctx)->state->close(
new C_OpenAfterCloseComplete(ictx, get_aio_completion(c), &image.ctx));
} else {
- ictx->state->open(new C_OpenComplete(ictx, get_aio_completion(c),
+ ictx->state->open(false, new C_OpenComplete(ictx, get_aio_completion(c),
&image.ctx));
}
tracepoint(librbd, aio_open_image_exit, 0);
false);
tracepoint(librbd, open_image_enter, ictx, ictx->name.c_str(), ictx->id.c_str(), ictx->snap_name.c_str(), ictx->read_only);
- int r = ictx->state->open();
+ int r = ictx->state->open(false);
if (r < 0) {
delete ictx;
} else {
false);
librbd::RBD::AioCompletion *comp = (librbd::RBD::AioCompletion *)c;
tracepoint(librbd, aio_open_image_enter, ictx, ictx->name.c_str(), ictx->id.c_str(), ictx->snap_name.c_str(), ictx->read_only, comp->pc);
- ictx->state->open(new C_OpenComplete(ictx, get_aio_completion(comp), image));
+ ictx->state->open(false, new C_OpenComplete(ictx, get_aio_completion(comp), image));
tracepoint(librbd, aio_open_image_exit, 0);
return 0;
}
true);
tracepoint(librbd, open_image_enter, ictx, ictx->name.c_str(), ictx->id.c_str(), ictx->snap_name.c_str(), ictx->read_only);
- int r = ictx->state->open();
+ int r = ictx->state->open(false);
if (r < 0) {
delete ictx;
} else {
true);
librbd::RBD::AioCompletion *comp = (librbd::RBD::AioCompletion *)c;
tracepoint(librbd, aio_open_image_enter, ictx, ictx->name.c_str(), ictx->id.c_str(), ictx->snap_name.c_str(), ictx->read_only, comp->pc);
- ictx->state->open(new C_OpenComplete(ictx, get_aio_completion(comp), image));
+ ictx->state->open(false, new C_OpenComplete(ictx, get_aio_completion(comp),
+ image));
tracepoint(librbd, aio_open_image_exit, 0);
return 0;
}
librados::IoCtx::from_rados_ioctx_t(image_p, io_ctx);
librbd::ImageCtx *ictx = new librbd::ImageCtx(image_name, "", "", io_ctx, false);
- int r = ictx->state->open();
+ int r = ictx->state->open(false);
if (r < 0) {
delete ictx;
tracepoint(librbd, open_image_exit, r);
static RefreshRequest *create(librbd::MockTestImageCtx &image_ctx,
bool acquire_lock_refresh,
- Context *on_finish) {
+ bool skip_open_parent, Context *on_finish) {
EXPECT_TRUE(acquire_lock_refresh);
assert(s_instance != nullptr);
s_instance->on_finish = on_finish;
expect_init_layout(mock_image_ctx);
C_SaferCond ctx;
- MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, &ctx);
+ MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
expect_add_snap(mock_image_ctx, "snap", ictx->snap_ids.begin()->second);
C_SaferCond ctx;
- MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, &ctx);
+ MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
}
C_SaferCond ctx;
- MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, &ctx);
+ MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
expect_add_snap(mock_image_ctx, "snap", ictx->snap_ids.begin()->second);
C_SaferCond ctx;
- MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, &ctx);
+ MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
expect_get_snap_id(mock_image_ctx, "snap", ictx->snap_ids.begin()->second);
C_SaferCond ctx;
- MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, &ctx);
+ MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
expect_refresh_parent_finalize(mock_image_ctx, *mock_refresh_parent_request, 0);
C_SaferCond ctx;
- MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, &ctx);
+ MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
+ req->send();
+
+ ASSERT_EQ(0, ctx.wait());
+}
+
+TEST_F(TestMockImageRefreshRequest, SuccessChildDontOpenParent) {
+ REQUIRE_FEATURE(RBD_FEATURE_LAYERING);
+
+ librbd::ImageCtx *ictx;
+ librbd::ImageCtx *ictx2 = nullptr;
+ std::string clone_name = get_temp_image_name();
+
+ ASSERT_EQ(0, open_image(m_image_name, &ictx));
+ ASSERT_EQ(0, snap_create(*ictx, "snap"));
+ ASSERT_EQ(0, snap_protect(*ictx, "snap"));
+ BOOST_SCOPE_EXIT_ALL((&)) {
+ if (ictx2 != nullptr) {
+ close_image(ictx2);
+ }
+
+ librbd::NoOpProgressContext no_op;
+ ASSERT_EQ(0, librbd::remove(m_ioctx, clone_name, "", no_op));
+ ASSERT_EQ(0, ictx->operations->snap_unprotect("snap"));
+ };
+
+ int order = ictx->order;
+ ASSERT_EQ(0, librbd::clone(m_ioctx, m_image_name.c_str(), "snap", m_ioctx,
+ clone_name.c_str(), ictx->features, &order, 0, 0));
+
+ ASSERT_EQ(0, open_image(clone_name, &ictx2));
+
+ MockRefreshImageCtx mock_image_ctx(*ictx2);
+ MockExclusiveLock mock_exclusive_lock;
+ expect_op_work_queue(mock_image_ctx);
+ expect_test_features(mock_image_ctx);
+
+ InSequence seq;
+ expect_get_mutable_metadata(mock_image_ctx, 0);
+ expect_get_flags(mock_image_ctx, 0);
+ expect_get_group(mock_image_ctx, 0);
+ if (ictx->test_features(RBD_FEATURE_EXCLUSIVE_LOCK)) {
+ expect_init_exclusive_lock(mock_image_ctx, mock_exclusive_lock, 0);
+ }
+
+ C_SaferCond ctx;
+ MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, true, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
expect_shut_down_exclusive_lock(mock_image_ctx, *mock_exclusive_lock, 0);
C_SaferCond ctx;
- MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, &ctx);
+ MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
expect_refresh_parent_is_required(mock_refresh_parent_request, false);
C_SaferCond ctx;
- MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, true, &ctx);
+ MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, true, false, &ctx);
req->send();
ASSERT_EQ(-ERESTART, ctx.wait());
expect_journal_disabled(mock_journal_policy, true);
C_SaferCond ctx;
- MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, &ctx);
+ MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
expect_open_journal(mock_image_ctx, mock_journal, 0);
C_SaferCond ctx;
- MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, &ctx);
+ MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
expect_set_require_lock_on_read(mock_image_ctx);
C_SaferCond ctx;
- MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, &ctx);
+ MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
expect_unblock_writes(mock_image_ctx);
C_SaferCond ctx;
- MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, &ctx);
+ MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
expect_open_object_map(mock_image_ctx, &mock_object_map, 0);
C_SaferCond ctx;
- MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, &ctx);
+ MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
expect_refresh_parent_is_required(mock_refresh_parent_request, false);
C_SaferCond ctx;
- MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, &ctx);
+ MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
expect_close_object_map(mock_image_ctx, *mock_object_map, 0);
C_SaferCond ctx;
- MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, &ctx);
+ MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
expect_open_object_map(mock_image_ctx, mock_object_map, -EFBIG);
C_SaferCond ctx;
- MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, &ctx);
+ MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
*ictx = new librbd::ImageCtx(image_name.c_str(), "", NULL, m_ioctx, false);
m_ictxs.insert(*ictx);
- return (*ictx)->state->open();
+ return (*ictx)->state->open(false);
}
int TestFixture::snap_create(librbd::ImageCtx &ictx,
close_image(ictx);
ictx = new librbd::ImageCtx("", id, nullptr, m_ioctx, true);
- ASSERT_EQ(0, ictx->state->open());
+ ASSERT_EQ(0, ictx->state->open(false));
ASSERT_EQ(ictx->name, m_image_name);
close_image(ictx);
}
librbd::ImageCtx *ictx = new librbd::ImageCtx(parent_image_ctx->name,
"", "", m_remote_io_ctx,
false);
- ictx->state->open();
+ ictx->state->open(false);
EXPECT_EQ(0, ictx->operations->snap_create(snap_name.c_str(),
cls::rbd::UserSnapshotNamespace()));
EXPECT_EQ(0, ictx->operations->snap_protect(snap_name.c_str()));
EXPECT_EQ(0, create_image(rbd, m_local_io_ctx, m_image_name, 1 << 20));
ImageCtx *ictx = new ImageCtx(m_image_name, "", "", m_local_io_ctx,
false);
- EXPECT_EQ(0, ictx->state->open());
+ EXPECT_EQ(0, ictx->state->open(false));
m_local_image_id = ictx->id;
cls::rbd::MirrorImage mirror_image(GLOBAL_IMAGE_ID,
if (!ictx) {
ictx = new ImageCtx("", m_local_image_id, "", m_local_io_ctx,
false);
- r = ictx->state->open();
+ r = ictx->state->open(false);
close = (r == 0);
}
if (!ictx) {
ictx = new ImageCtx("", m_local_image_id, "", m_local_io_ctx,
false);
- EXPECT_EQ(0, ictx->state->open());
+ EXPECT_EQ(0, ictx->state->open(false));
close = true;
}
void create_snapshot(std::string snap_name="snap1", bool protect=false) {
ImageCtx *ictx = new ImageCtx("", m_local_image_id, "", m_local_io_ctx,
false);
- EXPECT_EQ(0, ictx->state->open());
+ EXPECT_EQ(0, ictx->state->open(false));
promote_image(ictx);
EXPECT_EQ(0, ictx->operations->snap_create(snap_name.c_str(),
std::string create_clone() {
ImageCtx *ictx = new ImageCtx("", m_local_image_id, "", m_local_io_ctx,
false);
- EXPECT_EQ(0, ictx->state->open());
+ EXPECT_EQ(0, ictx->state->open(false));
promote_image(ictx);
EXPECT_EQ(0, ictx->operations->snap_create("snap1",
std::string clone_id;
ImageCtx *ictx_clone = new ImageCtx("clone1", "", "", m_local_io_ctx,
false);
- EXPECT_EQ(0, ictx_clone->state->open());
+ EXPECT_EQ(0, ictx_clone->state->open(false));
clone_id = ictx_clone->id;
cls::rbd::MirrorImage mirror_image(GLOBAL_CLONE_IMAGE_ID,
MirrorImageState::MIRROR_IMAGE_STATE_ENABLED);
void check_image_deleted() {
ImageCtx *ictx = new ImageCtx("", m_local_image_id, "", m_local_io_ctx,
false);
- EXPECT_EQ(-ENOENT, ictx->state->open());
+ EXPECT_EQ(-ENOENT, ictx->state->open(false));
delete ictx;
cls::rbd::MirrorImage mirror_image;
TEST_F(TestImageDeleter, Fail_Delete_NonPrimary_Image) {
ImageCtx *ictx = new ImageCtx("", m_local_image_id, "", m_local_io_ctx,
false);
- EXPECT_EQ(0, ictx->state->open());
+ EXPECT_EQ(0, ictx->state->open(false));
m_deleter->schedule_image_delete(_rados, m_local_pool_id, m_local_image_id,
m_image_name, GLOBAL_IMAGE_ID);
TEST_F(TestImageDeleter, Retry_Failed_Deletes) {
ImageCtx *ictx = new ImageCtx("", m_local_image_id, "", m_local_io_ctx,
false);
- EXPECT_EQ(0, ictx->state->open());
+ EXPECT_EQ(0, ictx->state->open(false));
m_deleter->set_failed_timer_interval(2);
TEST_F(TestImageDeleter, Delete_Is_Idempotent) {
ImageCtx *ictx = new ImageCtx("", m_local_image_id, "", m_local_io_ctx,
false);
- EXPECT_EQ(0, ictx->state->open());
+ EXPECT_EQ(0, ictx->state->open(false));
m_deleter->schedule_image_delete(_rados, m_local_pool_id, m_local_image_id,
m_image_name, GLOBAL_IMAGE_ID);
{
librbd::ImageCtx *ictx = new librbd::ImageCtx(image_name.c_str(),
"", "", ioctx, readonly);
- EXPECT_EQ(0, ictx->state->open());
+ EXPECT_EQ(0, ictx->state->open(false));
*ictxp = ictx;
}
{
librbd::ImageCtx *ictx = new librbd::ImageCtx(parent_image_name.c_str(),
"", "", pioctx, false);
- ictx->state->open();
+ ictx->state->open(false);
EXPECT_EQ(0, ictx->operations->snap_create(snap_name.c_str(),
cls::rbd::UserSnapshotNamespace()));
EXPECT_EQ(0, ictx->operations->snap_protect(snap_name.c_str()));
*image_ctx = new librbd::ImageCtx(image_name.c_str(), "", NULL, io_ctx,
false);
m_image_ctxs.insert(*image_ctx);
- return (*image_ctx)->state->open();
+ return (*image_ctx)->state->open(false);
}
int TestFixture::create_snap(librbd::ImageCtx *image_ctx, const char* snap_name,
ImageCtx *imgctx = new ImageCtx("", m_active_delete->local_image_id,
nullptr, ioctx, false);
- r = imgctx->state->open();
+ r = imgctx->state->open(false);
if (r < 0) {
derr << "error opening image id " << m_active_delete->local_image_id
<< ": " << cpp_strerror(r) << dendl;
Context *ctx = create_context_callback<
OpenImageRequest<I>, &OpenImageRequest<I>::handle_open_image>(
this);
- (*m_image_ctx)->state->open(ctx);
+ (*m_image_ctx)->state->open(false, ctx);
}
template <typename I>
Context *ctx = create_context_callback<
OpenLocalImageRequest<I>, &OpenLocalImageRequest<I>::handle_open_image>(
this);
- (*m_local_image_ctx)->state->open(ctx);
+ (*m_local_image_ctx)->state->open(false, ctx);
}
template <typename I>