bufferlist *pbl) {
TestIoCtxImpl *ctx = reinterpret_cast<TestIoCtxImpl*>(io_ctx_impl);
TestObjectOperationImpl *ops = reinterpret_cast<TestObjectOperationImpl*>(op->impl);
- return ctx->aio_operate_read(oid, *ops, c->pc, flags, pbl);
+ return ctx->aio_operate_read(oid, *ops, c->pc, flags, pbl,
+ ctx->get_snap_read());
}
int IoCtx::aio_operate(const std::string& oid, AioCompletion *c,
TestIoCtxImpl *ctx = reinterpret_cast<TestIoCtxImpl*>(io_ctx_impl);
return ctx->execute_operation(
oid, boost::bind(&TestIoCtxImpl::exec, _1, _2, get_class_handler(), cls,
- method, inbl, &outbl, ctx->get_snap_context()));
+ method, inbl, &outbl, ctx->get_snap_read(),
+ ctx->get_snap_context()));
}
void IoCtx::from_rados_ioctx_t(rados_ioctx_t p, IoCtx &io) {
uint64_t off) {
TestIoCtxImpl *ctx = reinterpret_cast<TestIoCtxImpl*>(io_ctx_impl);
return ctx->execute_operation(
- oid, boost::bind(&TestIoCtxImpl::read, _1, _2, len, off, &bl));
+ oid, boost::bind(&TestIoCtxImpl::read, _1, _2, len, off, &bl,
+ ctx->get_snap_read()));
}
int IoCtx::remove(const std::string& oid) {
bufferlist& bl, size_t len, uint64_t off) {
TestIoCtxImpl *ctx = reinterpret_cast<TestIoCtxImpl*>(io_ctx_impl);
return ctx->execute_operation(
- oid, boost::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, &m, &bl));
+ oid, boost::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, &m, &bl,
+ ctx->get_snap_read()));
}
int IoCtx::stat(const std::string& oid, uint64_t *psize, time_t *pmtime) {
int IoCtx::cmpext(const std::string& oid, uint64_t off, bufferlist& cmp_bl) {
TestIoCtxImpl *ctx = reinterpret_cast<TestIoCtxImpl*>(io_ctx_impl);
return ctx->execute_operation(
- oid, boost::bind(&TestIoCtxImpl::cmpext, _1, _2, off, cmp_bl));
+ oid, boost::bind(&TestIoCtxImpl::cmpext, _1, _2, off, cmp_bl,
+ ctx->get_snap_read()));
}
int IoCtx::application_enable(const std::string& app_name, bool force) {
void ObjectOperation::assert_exists() {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
- o->ops.push_back(boost::bind(&TestIoCtxImpl::assert_exists, _1, _2));
+ o->ops.push_back(boost::bind(&TestIoCtxImpl::assert_exists, _1, _2, _4));
}
void ObjectOperation::exec(const char *cls, const char *method,
bufferlist& inbl) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
o->ops.push_back(boost::bind(&TestIoCtxImpl::exec, _1, _2,
- get_class_handler(), cls, method, inbl, _3, _4));
+ get_class_handler(), cls, method, inbl, _3, _4,
+ _5));
}
void ObjectOperation::set_op_flags2(int flags) {
void ObjectOperation::cmpext(uint64_t off, const bufferlist& cmp_bl,
int *prval) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
- ObjectOperationTestImpl op = boost::bind(&TestIoCtxImpl::cmpext, _1, _2, off, cmp_bl);
+ ObjectOperationTestImpl op = boost::bind(&TestIoCtxImpl::cmpext, _1, _2, off,
+ cmp_bl, _4);
if (prval != NULL) {
op = boost::bind(save_operation_result,
- boost::bind(op, _1, _2, _3, _4), prval);
+ boost::bind(op, _1, _2, _3, _4, _5), prval);
}
o->ops.push_back(op);
}
out_snaps);
if (prval != NULL) {
op = boost::bind(save_operation_result,
- boost::bind(op, _1, _2, _3, _4), prval);
+ boost::bind(op, _1, _2, _3, _4, _5), prval);
}
o->ops.push_back(op);
}
_2, out_watchers);
if (prval != NULL) {
op = boost::bind(save_operation_result,
- boost::bind(op, _1, _2, _3, _4), prval);
+ boost::bind(op, _1, _2, _3, _4, _5), prval);
}
o->ops.push_back(op);
}
ObjectOperationTestImpl op;
if (pbl != NULL) {
- op = boost::bind(&TestIoCtxImpl::read, _1, _2, len, off, pbl);
+ op = boost::bind(&TestIoCtxImpl::read, _1, _2, len, off, pbl, _4);
} else {
- op = boost::bind(&TestIoCtxImpl::read, _1, _2, len, off, _3);
+ op = boost::bind(&TestIoCtxImpl::read, _1, _2, len, off, _3, _4);
}
if (prval != NULL) {
op = boost::bind(save_operation_result,
- boost::bind(op, _1, _2, _3, _4), prval);
+ boost::bind(op, _1, _2, _3, _4, _5), prval);
}
o->ops.push_back(op);
}
ObjectOperationTestImpl op;
if (pbl != NULL) {
- op = boost::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, m, pbl);
+ op = boost::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, m, pbl, _4);
} else {
- op = boost::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, m, _3);
+ op = boost::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, m, _3, _4);
}
if (prval != NULL) {
op = boost::bind(save_operation_result,
- boost::bind(op, _1, _2, _3, _4), prval);
+ boost::bind(op, _1, _2, _3, _4, _5), prval);
}
o->ops.push_back(op);
}
if (prval != NULL) {
op = boost::bind(save_operation_result,
- boost::bind(op, _1, _2, _3, _4), prval);
+ boost::bind(op, _1, _2, _3, _4, _5), prval);
}
o->ops.push_back(op);
}
void ObjectWriteOperation::append(const bufferlist &bl) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
- o->ops.push_back(boost::bind(&TestIoCtxImpl::append, _1, _2, bl, _4));
+ o->ops.push_back(boost::bind(&TestIoCtxImpl::append, _1, _2, bl, _5));
}
void ObjectWriteOperation::create(bool exclusive) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
- o->ops.push_back(boost::bind(&TestIoCtxImpl::create, _1, _2, exclusive, _4));
+ o->ops.push_back(boost::bind(&TestIoCtxImpl::create, _1, _2, exclusive, _5));
}
void ObjectWriteOperation::omap_set(const std::map<std::string, bufferlist> &map) {
void ObjectWriteOperation::remove() {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
- o->ops.push_back(boost::bind(&TestIoCtxImpl::remove, _1, _2, _4));
+ o->ops.push_back(boost::bind(&TestIoCtxImpl::remove, _1, _2, _5));
}
void ObjectWriteOperation::selfmanaged_snap_rollback(uint64_t snapid) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
o->ops.push_back(boost::bind(&TestIoCtxImpl::set_alloc_hint, _1, _2,
expected_object_size, expected_write_size, 0,
- _4));
+ _5));
}
void ObjectWriteOperation::set_alloc_hint2(uint64_t expected_object_size,
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
o->ops.push_back(boost::bind(&TestIoCtxImpl::set_alloc_hint, _1, _2,
expected_object_size, expected_write_size, flags,
- _4));
+ _5));
}
void ObjectWriteOperation::tmap_update(const bufferlist& cmdbl) {
void ObjectWriteOperation::truncate(uint64_t off) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
- o->ops.push_back(boost::bind(&TestIoCtxImpl::truncate, _1, _2, off, _4));
+ o->ops.push_back(boost::bind(&TestIoCtxImpl::truncate, _1, _2, off, _5));
}
void ObjectWriteOperation::write(uint64_t off, const bufferlist& bl) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
o->ops.push_back(boost::bind(&TestIoCtxImpl::write, _1, _2, bl, bl.length(),
- off, _4));
+ off, _5));
}
void ObjectWriteOperation::write_full(const bufferlist& bl) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
- o->ops.push_back(boost::bind(&TestIoCtxImpl::write_full, _1, _2, bl, _4));
+ o->ops.push_back(boost::bind(&TestIoCtxImpl::write_full, _1, _2, bl, _5));
}
-void ObjectWriteOperation::writesame(uint64_t off, uint64_t len, const bufferlist& bl) {
+void ObjectWriteOperation::writesame(uint64_t off, uint64_t len,
+ const bufferlist& bl) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
o->ops.push_back(boost::bind(&TestIoCtxImpl::writesame, _1, _2, bl, len,
- off, _4));
+ off, _5));
}
void ObjectWriteOperation::zero(uint64_t off, uint64_t len) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
- o->ops.push_back(boost::bind(&TestIoCtxImpl::zero, _1, _2, off, len, _4));
+ o->ops.push_back(boost::bind(&TestIoCtxImpl::zero, _1, _2, off, len, _5));
}
Rados::Rados() : client(NULL) {
bufferlist *outbl, uint32_t op_flags) {
librados::TestClassHandler::MethodContext *ctx =
reinterpret_cast<librados::TestClassHandler::MethodContext*>(hctx);
- return ctx->io_ctx_impl->read(ctx->oid, len, ofs, outbl);
+ return ctx->io_ctx_impl->read(ctx->oid, len, ofs, outbl, ctx->snap_id);
}
int cls_cxx_setxattr(cls_method_context_t hctx, const char *name,
return TestMemIoCtxImpl::aio_unwatch(handle, c);
}
- MOCK_METHOD1(assert_exists, int(const std::string &));
- int do_assert_exists(const std::string &oid) {
- return TestMemIoCtxImpl::assert_exists(oid);
+ MOCK_METHOD2(assert_exists, int(const std::string &, uint64_t));
+ int do_assert_exists(const std::string &oid, uint64_t snap_id) {
+ return TestMemIoCtxImpl::assert_exists(oid, snap_id);
}
MOCK_METHOD3(create, int(const std::string&, bool, const SnapContext &));
return TestMemIoCtxImpl::create(oid, exclusive, snapc);
}
- MOCK_METHOD3(cmpext, int(const std::string&, uint64_t, bufferlist&));
- int do_cmpext(const std::string& oid, uint64_t off, bufferlist& cmp_bl) {
- return TestMemIoCtxImpl::cmpext(oid, off, cmp_bl);
+ MOCK_METHOD4(cmpext, int(const std::string&, uint64_t, bufferlist&,
+ uint64_t snap_id));
+ int do_cmpext(const std::string& oid, uint64_t off, bufferlist& cmp_bl,
+ uint64_t snap_id) {
+ return TestMemIoCtxImpl::cmpext(oid, off, cmp_bl, snap_id);
}
- MOCK_METHOD7(exec, int(const std::string& oid,
+ MOCK_METHOD8(exec, int(const std::string& oid,
TestClassHandler *handler,
const char *cls,
const char *method,
bufferlist& inbl,
bufferlist* outbl,
+ uint64_t snap_id,
const SnapContext &snapc));
int do_exec(const std::string& oid, TestClassHandler *handler,
const char *cls, const char *method, bufferlist& inbl,
- bufferlist* outbl, const SnapContext &snapc) {
+ bufferlist* outbl, uint64_t snap_id, const SnapContext &snapc) {
return TestMemIoCtxImpl::exec(oid, handler, cls, method, inbl, outbl,
- snapc);
+ snap_id, snapc);
}
MOCK_CONST_METHOD0(get_instance_id, uint64_t());
void do_set_snap_read(snap_t snap_id) {
return TestMemIoCtxImpl::set_snap_read(snap_id);
}
- MOCK_METHOD5(sparse_read, int(const std::string& oid,
+ MOCK_METHOD6(sparse_read, int(const std::string& oid,
uint64_t off,
uint64_t len,
std::map<uint64_t, uint64_t> *m,
- bufferlist *bl));
+ bufferlist *bl, uint64_t));
int do_sparse_read(const std::string& oid, uint64_t off, size_t len,
- std::map<uint64_t, uint64_t> *m, bufferlist *bl){
- return TestMemIoCtxImpl::sparse_read(oid, off, len, m, bl);
+ std::map<uint64_t, uint64_t> *m, bufferlist *bl,
+ uint64_t snap_id) {
+ return TestMemIoCtxImpl::sparse_read(oid, off, len, m, bl, snap_id);
}
- MOCK_METHOD4(read, int(const std::string& oid,
+ MOCK_METHOD5(read, int(const std::string& oid,
size_t len,
uint64_t off,
- bufferlist *bl));
+ bufferlist *bl, uint64_t snap_id));
int do_read(const std::string& oid, size_t len, uint64_t off,
- bufferlist *bl) {
- return TestMemIoCtxImpl::read(oid, len, off, bl);
+ bufferlist *bl, uint64_t snap_id) {
+ return TestMemIoCtxImpl::read(oid, len, off, bl, snap_id);
}
MOCK_METHOD2(remove, int(const std::string& oid, const SnapContext &snapc));
ON_CALL(*this, aio_operate(_, _, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_aio_operate));
ON_CALL(*this, aio_watch(_, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_aio_watch));
ON_CALL(*this, aio_unwatch(_, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_aio_unwatch));
- ON_CALL(*this, assert_exists(_)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_assert_exists));
+ ON_CALL(*this, assert_exists(_, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_assert_exists));
ON_CALL(*this, create(_, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_create));
- ON_CALL(*this, cmpext(_,_,_)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_cmpext));
- ON_CALL(*this, exec(_, _, _, _, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_exec));
+ ON_CALL(*this, cmpext(_, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_cmpext));
+ ON_CALL(*this, exec(_, _, _, _, _, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_exec));
ON_CALL(*this, get_instance_id()).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_get_instance_id));
ON_CALL(*this, list_snaps(_, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_list_snaps));
ON_CALL(*this, list_watchers(_, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_list_watchers));
ON_CALL(*this, notify(_, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_notify));
- ON_CALL(*this, read(_, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_read));
+ ON_CALL(*this, read(_, _, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_read));
ON_CALL(*this, set_snap_read(_)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_set_snap_read));
- ON_CALL(*this, sparse_read(_, _, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_sparse_read));
+ ON_CALL(*this, sparse_read(_, _, _, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_sparse_read));
ON_CALL(*this, remove(_, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_remove));
ON_CALL(*this, selfmanaged_snap_create(_)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_selfmanaged_snap_create));
ON_CALL(*this, selfmanaged_snap_remove(_)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_selfmanaged_snap_remove));
}
TestClassHandler::SharedMethodContext TestClassHandler::get_method_context(
- TestIoCtxImpl *io_ctx_impl, const std::string &oid,
+ TestIoCtxImpl *io_ctx_impl, const std::string &oid, uint64_t snap_id,
const SnapContext &snapc) {
SharedMethodContext ctx(new MethodContext());
// clone to ioctx to provide a firewall for gmock expectations
ctx->io_ctx_impl = io_ctx_impl->clone();
ctx->oid = oid;
+ ctx->snap_id = snap_id;
ctx->snapc = snapc;
return ctx;
}
TestIoCtxImpl *io_ctx_impl;
std::string oid;
+ uint64_t snap_id;
SnapContext snapc;
};
typedef boost::shared_ptr<MethodContext> SharedMethodContext;
const std::string &method);
SharedMethodContext get_method_context(TestIoCtxImpl *io_ctx_impl,
const std::string &oid,
+ uint64_t snap_id,
const SnapContext &snapc);
int create_filter(cls_handle_t hclass, const std::string& filter_name,
m_pending_ops++;
m_client->add_aio_operation(oid, true, boost::bind(
&TestIoCtxImpl::execute_aio_operations, this, oid, &ops,
- reinterpret_cast<bufferlist*>(0),
+ reinterpret_cast<bufferlist*>(0), m_snap_seq,
snap_context != NULL ? *snap_context : m_snapc), c);
return 0;
}
int TestIoCtxImpl::aio_operate_read(const std::string& oid,
TestObjectOperationImpl &ops,
AioCompletionImpl *c, int flags,
- bufferlist *pbl) {
+ bufferlist *pbl, uint64_t snap_id) {
// TODO ignoring flags for now
ops.get();
m_pending_ops++;
m_client->add_aio_operation(oid, true, boost::bind(
- &TestIoCtxImpl::execute_aio_operations, this, oid, &ops, pbl, m_snapc), c);
+ &TestIoCtxImpl::execute_aio_operations, this, oid, &ops, pbl, snap_id,
+ m_snapc), c);
return 0;
}
int TestIoCtxImpl::exec(const std::string& oid, TestClassHandler *handler,
const char *cls, const char *method,
bufferlist& inbl, bufferlist* outbl,
- const SnapContext &snapc) {
+ uint64_t snap_id, const SnapContext &snapc) {
if (m_client->is_blacklisted()) {
return -EBLACKLISTED;
}
}
return (*call)(reinterpret_cast<cls_method_context_t>(
- handler->get_method_context(this, oid, snapc).get()), &inbl, outbl);
+ handler->get_method_context(this, oid, snap_id, snapc).get()), &inbl,
+ outbl);
}
int TestIoCtxImpl::list_watchers(const std::string& o,
m_client->get_instance_id(), bl);
}
-int TestIoCtxImpl::operate(const std::string& oid, TestObjectOperationImpl &ops) {
+int TestIoCtxImpl::operate(const std::string& oid,
+ TestObjectOperationImpl &ops) {
AioCompletionImpl *comp = new AioCompletionImpl();
ops.get();
m_pending_ops++;
m_client->add_aio_operation(oid, false, boost::bind(
&TestIoCtxImpl::execute_aio_operations, this, oid, &ops,
- reinterpret_cast<bufferlist*>(0), m_snapc), comp);
+ reinterpret_cast<bufferlist*>(0), m_snap_seq, m_snapc), comp);
comp->wait_for_complete();
int ret = comp->get_return_value();
return ret;
}
-int TestIoCtxImpl::operate_read(const std::string& oid, TestObjectOperationImpl &ops,
+int TestIoCtxImpl::operate_read(const std::string& oid,
+ TestObjectOperationImpl &ops,
bufferlist *pbl) {
AioCompletionImpl *comp = new AioCompletionImpl();
m_pending_ops++;
m_client->add_aio_operation(oid, false, boost::bind(
&TestIoCtxImpl::execute_aio_operations, this, oid, &ops, pbl,
- m_snapc), comp);
+ m_snap_seq, m_snapc), comp);
comp->wait_for_complete();
int ret = comp->get_return_value();
if (size > 0) {
bufferlist inbl;
- r = read(oid, size, 0, &inbl);
+ r = read(oid, size, 0, &inbl, CEPH_NOSNAP);
if (r < 0) {
return r;
}
int TestIoCtxImpl::execute_aio_operations(const std::string& oid,
TestObjectOperationImpl *ops,
- bufferlist *pbl,
+ bufferlist *pbl, uint64_t snap_id,
const SnapContext &snapc) {
int ret = 0;
if (m_client->is_blacklisted()) {
TestRadosClient::Transaction transaction(m_client, get_namespace(), oid);
for (ObjectOperations::iterator it = ops->ops.begin();
it != ops->ops.end(); ++it) {
- ret = (*it)(this, oid, pbl, snapc);
+ ret = (*it)(this, oid, pbl, snap_id, snapc);
if (ret < 0) {
break;
}
typedef boost::function<int(TestIoCtxImpl*,
const std::string&,
bufferlist *,
+ uint64_t,
const SnapContext &)> ObjectOperationTestImpl;
typedef std::list<ObjectOperationTestImpl> ObjectOperations;
int flags);
virtual int aio_operate_read(const std::string& oid, TestObjectOperationImpl &ops,
AioCompletionImpl *c, int flags,
- bufferlist *pbl);
+ bufferlist *pbl, uint64_t snap_id);
virtual int aio_remove(const std::string& oid, AioCompletionImpl *c,
int flags = 0) = 0;
virtual int aio_watch(const std::string& o, AioCompletionImpl *c,
virtual int aio_unwatch(uint64_t handle, AioCompletionImpl *c);
virtual int append(const std::string& oid, const bufferlist &bl,
const SnapContext &snapc) = 0;
- virtual int assert_exists(const std::string &oid) = 0;
+ virtual int assert_exists(const std::string &oid, uint64_t snap_id) = 0;
virtual int create(const std::string& oid, bool exclusive,
const SnapContext &snapc) = 0;
virtual int exec(const std::string& oid, TestClassHandler *handler,
const char *cls, const char *method,
bufferlist& inbl, bufferlist* outbl,
- const SnapContext &snapc);
+ uint64_t snap_id, const SnapContext &snapc);
virtual int list_snaps(const std::string& o, snap_set_t *out_snaps) = 0;
virtual int list_watchers(const std::string& o,
std::list<obj_watch_t> *out_watchers);
virtual int operate_read(const std::string& oid, TestObjectOperationImpl &ops,
bufferlist *pbl);
virtual int read(const std::string& oid, size_t len, uint64_t off,
- bufferlist *bl) = 0;
+ bufferlist *bl, uint64_t snap_id) = 0;
virtual int remove(const std::string& oid, const SnapContext &snapc) = 0;
virtual int selfmanaged_snap_create(uint64_t *snapid) = 0;
virtual void aio_selfmanaged_snap_create(uint64_t *snapid,
virtual void set_snap_read(snap_t seq);
virtual int sparse_read(const std::string& oid, uint64_t off, uint64_t len,
std::map<uint64_t,uint64_t> *m,
- bufferlist *data_bl) = 0;
+ bufferlist *data_bl, uint64_t snap_id) = 0;
virtual int stat(const std::string& oid, uint64_t *psize, time_t *pmtime) = 0;
virtual int truncate(const std::string& oid, uint64_t size,
const SnapContext &snapc) = 0;
const SnapContext &snapc) = 0;
virtual int writesame(const std::string& oid, bufferlist& bl, size_t len,
uint64_t off, const SnapContext &snapc) = 0;
- virtual int cmpext(const std::string& oid, uint64_t off, bufferlist& cmp_bl) = 0;
+ virtual int cmpext(const std::string& oid, uint64_t off, bufferlist& cmp_bl,
+ uint64_t snap_id) = 0;
virtual int xattr_get(const std::string& oid,
std::map<std::string, bufferlist>* attrset) = 0;
virtual int xattr_set(const std::string& oid, const std::string &name,
int execute_aio_operations(const std::string& oid,
TestObjectOperationImpl *ops,
- bufferlist *pbl, const SnapContext &snapc);
+ bufferlist *pbl, uint64_t,
+ const SnapContext &snapc);
private:
struct C_AioNotify : public Context {
TestMemCluster::SharedFile file;
{
std::unique_lock l{m_pool->file_lock};
- file = get_file(oid, true, snapc);
+ file = get_file(oid, true, CEPH_NOSNAP, snapc);
}
std::unique_lock l{file->lock};
return 0;
}
-int TestMemIoCtxImpl::assert_exists(const std::string &oid) {
+int TestMemIoCtxImpl::assert_exists(const std::string &oid, uint64_t snap_id) {
if (m_client->is_blacklisted()) {
return -EBLACKLISTED;
}
std::shared_lock l{m_pool->file_lock};
- TestMemCluster::SharedFile file = get_file(oid, false, get_snap_context());
+ TestMemCluster::SharedFile file = get_file(oid, false, snap_id, {});
if (file == NULL) {
return -ENOENT;
}
}
std::unique_lock l{m_pool->file_lock};
- get_file(oid, true, snapc);
+ get_file(oid, true, CEPH_NOSNAP, snapc);
return 0;
}
TestMemCluster::SharedFile file;
{
std::shared_lock l{m_pool->file_lock};
- file = get_file(oid, false, get_snap_context());
+ file = get_file(oid, false, CEPH_NOSNAP, {});
if (file == NULL) {
return -ENOENT;
}
TestMemCluster::SharedFile file;
{
std::unique_lock l{m_pool->file_lock};
- file = get_file(oid, true, get_snap_context());
+ file = get_file(oid, true, CEPH_NOSNAP, get_snap_context());
if (file == NULL) {
return -ENOENT;
}
TestMemCluster::SharedFile file;
{
std::unique_lock l{m_pool->file_lock};
- file = get_file(oid, true, get_snap_context());
+ file = get_file(oid, true, CEPH_NOSNAP, get_snap_context());
if (file == NULL) {
return -ENOENT;
}
}
int TestMemIoCtxImpl::read(const std::string& oid, size_t len, uint64_t off,
- bufferlist *bl) {
+ bufferlist *bl, uint64_t snap_id) {
if (m_client->is_blacklisted()) {
return -EBLACKLISTED;
}
TestMemCluster::SharedFile file;
{
std::shared_lock l{m_pool->file_lock};
- file = get_file(oid, false, get_snap_context());
+ file = get_file(oid, false, snap_id, {});
if (file == NULL) {
return -ENOENT;
}
}
std::unique_lock l{m_pool->file_lock};
- TestMemCluster::SharedFile file = get_file(oid, false, snapc);
+ TestMemCluster::SharedFile file = get_file(oid, false, CEPH_NOSNAP, snapc);
if (file == NULL) {
return -ENOENT;
}
- file = get_file(oid, true, snapc);
+ file = get_file(oid, true, CEPH_NOSNAP, snapc);
{
std::unique_lock l2{file->lock};
{
std::unique_lock l{m_pool->file_lock};
- get_file(oid, true, snapc);
+ get_file(oid, true, CEPH_NOSNAP, snapc);
}
return 0;
int TestMemIoCtxImpl::sparse_read(const std::string& oid, uint64_t off,
uint64_t len,
std::map<uint64_t,uint64_t> *m,
- bufferlist *data_bl) {
+ bufferlist *data_bl, uint64_t snap_id) {
if (m_client->is_blacklisted()) {
return -EBLACKLISTED;
}
TestMemCluster::SharedFile file;
{
std::shared_lock l{m_pool->file_lock};
- file = get_file(oid, false, get_snap_context());
+ file = get_file(oid, false, snap_id, {});
if (file == NULL) {
return -ENOENT;
}
TestMemCluster::SharedFile file;
{
std::shared_lock l{m_pool->file_lock};
- file = get_file(oid, false, get_snap_context());
+ file = get_file(oid, false, CEPH_NOSNAP, {});
if (file == NULL) {
return -ENOENT;
}
TestMemCluster::SharedFile file;
{
std::unique_lock l{m_pool->file_lock};
- file = get_file(oid, true, snapc);
+ file = get_file(oid, true, CEPH_NOSNAP, snapc);
}
std::unique_lock l{file->lock};
TestMemCluster::SharedFile file;
{
std::unique_lock l{m_pool->file_lock};
- file = get_file(oid, true, snapc);
+ file = get_file(oid, true, CEPH_NOSNAP, snapc);
}
std::unique_lock l{file->lock};
TestMemCluster::SharedFile file;
{
std::unique_lock l{m_pool->file_lock};
- file = get_file(oid, true, snapc);
+ file = get_file(oid, true, CEPH_NOSNAP, snapc);
if (file == NULL) {
return -ENOENT;
}
return 0;
}
-int TestMemIoCtxImpl::writesame(const std::string& oid, bufferlist& bl, size_t len,
- uint64_t off, const SnapContext &snapc) {
+int TestMemIoCtxImpl::writesame(const std::string& oid, bufferlist& bl,
+ size_t len, uint64_t off,
+ const SnapContext &snapc) {
if (get_snap_read() != CEPH_NOSNAP) {
return -EROFS;
} else if (m_client->is_blacklisted()) {
TestMemCluster::SharedFile file;
{
std::unique_lock l{m_pool->file_lock};
- file = get_file(oid, true, snapc);
+ file = get_file(oid, true, CEPH_NOSNAP, snapc);
}
std::unique_lock l{file->lock};
}
int TestMemIoCtxImpl::cmpext(const std::string& oid, uint64_t off,
- bufferlist& cmp_bl) {
+ bufferlist& cmp_bl, uint64_t snap_id) {
if (m_client->is_blacklisted()) {
return -EBLACKLISTED;
}
TestMemCluster::SharedFile file;
{
std::shared_lock l{m_pool->file_lock};
- file = get_file(oid, false, get_snap_context());
+ file = get_file(oid, false, snap_id, {});
if (file == NULL) {
return cmpext_compare(cmp_bl, read_bl);
}
TestMemCluster::SharedFile file;
{
std::unique_lock l{m_pool->file_lock};
- file = get_file(oid, false, snapc);
+ file = get_file(oid, false, CEPH_NOSNAP, snapc);
if (!file) {
return 0;
}
- file = get_file(oid, true, snapc);
+ file = get_file(oid, true, CEPH_NOSNAP, snapc);
std::shared_lock l2{file->lock};
if (len > 0 && off + len >= file->data.length()) {
}
TestMemCluster::SharedFile TestMemIoCtxImpl::get_file(
- const std::string &oid, bool write, const SnapContext &snapc) {
+ const std::string &oid, bool write, uint64_t snap_id,
+ const SnapContext &snapc) {
ceph_assert(ceph_mutex_is_locked(m_pool->file_lock) ||
ceph_mutex_is_wlocked(m_pool->file_lock));
ceph_assert(!write || ceph_mutex_is_wlocked(m_pool->file_lock));
return file;
}
- if (get_snap_read() == CEPH_NOSNAP) {
+ if (snap_id == CEPH_NOSNAP) {
if (!file->exists) {
ceph_assert(it->second.size() > 1);
return TestMemCluster::SharedFile();
for (TestMemCluster::FileSnapshots::reverse_iterator it = snaps.rbegin();
it != snaps.rend(); ++it) {
TestMemCluster::SharedFile file = *it;
- if (file->snap_id < get_snap_read()) {
+ if (file->snap_id < snap_id) {
if (!file->exists) {
return TestMemCluster::SharedFile();
}
int append(const std::string& oid, const bufferlist &bl,
const SnapContext &snapc) override;
- int assert_exists(const std::string &oid) override;
+ int assert_exists(const std::string &oid, uint64_t snap_id) override;
int create(const std::string& oid, bool exclusive,
const SnapContext &snapc) override;
int omap_set(const std::string& oid, const std::map<std::string,
bufferlist> &map) override;
int read(const std::string& oid, size_t len, uint64_t off,
- bufferlist *bl) override;
+ bufferlist *bl, uint64_t snap_id) override;
int remove(const std::string& oid, const SnapContext &snapc) override;
int selfmanaged_snap_create(uint64_t *snapid) override;
int selfmanaged_snap_remove(uint64_t snapid) override;
uint64_t expected_write_size, uint32_t flags,
const SnapContext &snapc) override;
int sparse_read(const std::string& oid, uint64_t off, uint64_t len,
- std::map<uint64_t,uint64_t> *m, bufferlist *data_bl) override;
+ std::map<uint64_t,uint64_t> *m, bufferlist *data_bl,
+ uint64_t snap_id) override;
int stat(const std::string& oid, uint64_t *psize, time_t *pmtime) override;
int truncate(const std::string& oid, uint64_t size,
const SnapContext &snapc) override;
const SnapContext &snapc) override;
int writesame(const std::string& oid, bufferlist& bl, size_t len,
uint64_t off, const SnapContext &snapc) override;
- int cmpext(const std::string& oid, uint64_t off, bufferlist& cmp_bl) override;
+ int cmpext(const std::string& oid, uint64_t off, bufferlist& cmp_bl,
+ uint64_t snap_id) override;
int xattr_get(const std::string& oid,
std::map<std::string, bufferlist>* attrset) override;
int xattr_set(const std::string& oid, const std::string &name,
void ensure_minimum_length(size_t len, bufferlist *bl);
TestMemCluster::SharedFile get_file(const std::string &oid, bool write,
+ uint64_t snap_id,
const SnapContext &snapc);
};
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("metadata_set"), ContentsEqual(in_bl), _, _))
+ StrEq("metadata_set"), ContentsEqual(in_bl), _, _, _))
.WillOnce(Return(r));
}
};
void expect_sparse_read(librados::MockTestMemIoCtxImpl &mock_io_ctx, uint64_t offset,
uint64_t length, int r) {
- auto &expect = EXPECT_CALL(mock_io_ctx, sparse_read(_, offset, length, _, _));
+ auto &expect = EXPECT_CALL(mock_io_ctx, sparse_read(_, offset, length, _, _,
+ _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
void expect_set_size(librbd::MockTestImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("set_size"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("set_size"), _, _, _, _))
.WillOnce(Return(r));
}
std::string oid(librbd::ObjectMap<>::object_map_name(mock_image_ctx.id,
snap_id));
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(oid, _, StrEq("rbd"), StrEq("object_map_resize"), _, _, _))
+ exec(oid, _, StrEq("rbd"), StrEq("object_map_resize"), _, _, _,
+ _))
.WillOnce(Return(r));
}
void expect_add_child(MockImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(RBD_CHILDREN, _, StrEq("rbd"), StrEq("add_child"), _, _, _))
+ exec(RBD_CHILDREN, _, StrEq("rbd"), StrEq("add_child"), _, _, _,
+ _))
.WillOnce(Return(r));
}
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(util::header_name(mock_image_ctx.id), _, StrEq("rbd"),
- StrEq("op_features_set"), ContentsEqual(bl), _, _))
+ StrEq("op_features_set"), ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
}
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("child_attach"), ContentsEqual(bl), _, _))
+ StrEq("child_attach"), ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
}
void expect_parent_attach(MockImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("parent_attach"), _, _, _))
+ StrEq("parent_attach"), _, _, _, _))
.WillOnce(Return(r));
}
void expect_set_parent(MockImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("set_parent"), _, _, _))
+ StrEq("set_parent"), _, _, _, _))
.WillOnce(Return(r));
}
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_mode_get"),
- _, _, _))
+ _, _, _, _))
.WillOnce(WithArg<5>(Invoke([out_bl, r](bufferlist* out) {
*out = out_bl;
return r;
EXPECT_CALL(mock_io_ctx_impl,
exec(util::header_name(parent_spec.image_id),
_, StrEq("rbd"), StrEq("child_detach"), ContentsEqual(bl),
- _, _))
+ _, _, _))
.WillOnce(Return(r));
}
void expect_remove_child(MockImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(RBD_CHILDREN, _, StrEq("rbd"), StrEq("remove_child"), _,
- _, _))
+ _, _, _))
.WillOnce(Return(r));
}
using ceph::encode;
EXPECT_CALL(mock_io_ctx_impl,
exec(parent_header_name, _, StrEq("rbd"),
- StrEq("snapshot_get"), _, _, _))
+ StrEq("snapshot_get"), _, _, _, _))
.WillOnce(WithArg<5>(Invoke([snap_info, r](bufferlist* bl) {
encode(snap_info, *bl);
return r;
using ceph::encode;
EXPECT_CALL(mock_io_ctx_impl,
exec(RBD_TRASH, _, StrEq("rbd"),
- StrEq("trash_get"), _, _, _))
+ StrEq("trash_get"), _, _, _, _))
.WillOnce(WithArg<5>(Invoke([trash_spec, r](bufferlist* bl) {
encode(trash_spec, *bl);
return r;
void expect_parent_detach(MockImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("parent_detach"), _, _, _))
+ StrEq("parent_detach"), _, _, _, _))
.WillOnce(Return(r));
}
void expect_remove_parent(MockImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("remove_parent"), _, _, _))
+ StrEq("remove_parent"), _, _, _, _))
.WillOnce(Return(r));
}
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("image_group_get"), _, _, _));
+ StrEq("image_group_get"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
void expect_v1_read_header(MockRefreshImageCtx &mock_image_ctx, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- read(mock_image_ctx.header_oid, _, _, _));
+ read(mock_image_ctx.header_oid, _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
void expect_v1_get_snapshots(MockRefreshImageCtx &mock_image_ctx, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("snap_list"), _, _, _));
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("snap_list"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
void expect_v1_get_locks(MockRefreshImageCtx &mock_image_ctx, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("lock"), StrEq("get_info"), _, _, _));
+ exec(mock_image_ctx.header_oid, _, StrEq("lock"),
+ StrEq("get_info"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
void expect_get_mutable_metadata(MockRefreshImageCtx &mock_image_ctx,
uint64_t features, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_size"), _, _, _));
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_size"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
expect.WillOnce(DoDefault());
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_features"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_features"), _, _, _, _))
.WillOnce(WithArg<5>(Invoke([features, incompatible](bufferlist* out_bl) {
encode(features, *out_bl);
encode(incompatible, *out_bl);
})));
expect_get_flags(mock_image_ctx, 0);
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_snapcontext"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_snapcontext"), _, _, _, _))
.WillOnce(DoDefault());
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("lock"), StrEq("get_info"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("lock"),
+ StrEq("get_info"), _, _, _, _))
.WillOnce(DoDefault());
}
}
void expect_parent_overlap_get(MockRefreshImageCtx &mock_image_ctx, int r) {
auto& expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("parent_overlap_get"), _, _, _));
+ StrEq("parent_overlap_get"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
void expect_get_parent(MockRefreshImageCtx &mock_image_ctx, int r) {
auto& expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("parent_get"), _, _, _));
+ StrEq("parent_get"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
void expect_get_parent_legacy(MockRefreshImageCtx &mock_image_ctx, int r) {
auto& expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("get_parent"), _, _, _));
+ StrEq("get_parent"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
void expect_get_migration_header(MockRefreshImageCtx &mock_image_ctx, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("migration_get"), _, _, _));
+ StrEq("migration_get"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
void expect_get_flags(MockRefreshImageCtx &mock_image_ctx, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_flags"), _, _, _));
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_flags"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
uint64_t op_features, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("op_features_get"), _, _, _))
+ StrEq("op_features_get"), _, _, _, _))
.WillOnce(WithArg<5>(Invoke([op_features, r](bufferlist* out_bl) {
encode(op_features, *out_bl);
return r;
void expect_get_group(MockRefreshImageCtx &mock_image_ctx, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("image_group_get"), _, _, _));
+ StrEq("image_group_get"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
void expect_get_snapshots(MockRefreshImageCtx &mock_image_ctx,
bool legacy_parent, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("snapshot_get"), _, _, _));
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("snapshot_get"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
expect.WillOnce(DoDefault());
if (legacy_parent) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_parent"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_parent"), _, _, _, _))
.WillOnce(DoDefault());
} else {
expect_parent_overlap_get(mock_image_ctx, 0);
}
expect_get_flags(mock_image_ctx, 0);
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_protection_status"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_protection_status"), _, _, _, _))
.WillOnce(DoDefault());
}
}
void expect_get_snapshots_legacy(MockRefreshImageCtx &mock_image_ctx,
bool include_timestamp, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_snapshot_name"), _, _, _));
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_snapshot_name"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
expect.WillOnce(DoDefault());
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_size"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_size"), _, _, _, _))
.WillOnce(DoDefault());
if (include_timestamp) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_snapshot_timestamp"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_snapshot_timestamp"), _, _, _, _))
.WillOnce(DoDefault());
}
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_parent"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_parent"), _, _, _, _))
.WillOnce(DoDefault());
expect_get_flags(mock_image_ctx, 0);
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_protection_status"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_protection_status"), _, _, _, _))
.WillOnce(DoDefault());
}
}
void expect_remove_mirror_image(librados::IoCtx &ioctx, int r) {
EXPECT_CALL(get_mock_io_ctx(ioctx),
- exec(StrEq("rbd_mirroring"), _, StrEq("rbd"), StrEq("mirror_image_remove"),
- _, _, _))
+ exec(StrEq("rbd_mirroring"), _, StrEq("rbd"),
+ StrEq("mirror_image_remove"), _, _, _, _))
.WillOnce(Return(r));
}
void expect_dir_remove_image(librados::IoCtx &ioctx, int r) {
EXPECT_CALL(get_mock_io_ctx(ioctx),
exec(RBD_DIRECTORY, _, StrEq("rbd"), StrEq("dir_remove_image"),
- _, _, _))
+ _, _, _, _))
.WillOnce(Return(r));
}
void expect_read_rbd_info(librados::MockTestMemIoCtxImpl &mock_io_ctx,
const std::string& data, int r) {
- auto& expect = EXPECT_CALL(mock_io_ctx, read(StrEq(RBD_INFO), 0, 0, _));
+ auto& expect = EXPECT_CALL(mock_io_ctx, read(StrEq(RBD_INFO), 0, 0, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
exec(oid, _, StrEq("rbd"), StrEq("copyup"),
- ContentsEqual(in_bl), _, snapc))
+ ContentsEqual(in_bl), _, _, snapc))
.WillOnce(Return(r));
}
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
exec(oid, _, StrEq("rbd"), StrEq("sparse_copyup"),
- ContentsEqual(in_bl), _, snapc))
+ ContentsEqual(in_bl), _, _, snapc))
.WillOnce(Return(r));
}
bl.append(data);
auto& expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
- read(oid, len, off, _));
+ read(oid, len, off, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
bl.append(data);
auto& expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
- sparse_read(oid, off, len, _, _));
+ sparse_read(oid, off, len, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
}
void expect_assert_exists(MockTestImageCtx &mock_image_ctx, int r) {
- EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx), assert_exists(_))
+ EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
+ assert_exists(_, _))
.WillOnce(Return(r));
}
void expect_cmpext(MockTestImageCtx &mock_image_ctx, int offset, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
- cmpext(_, offset, _));
+ cmpext(_, offset, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
bool exclusive = true) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("lock"),
- StrEq("lock"), IsLockType(exclusive), _, _))
+ StrEq("lock"), IsLockType(exclusive), _, _, _))
.WillOnce(Return(r));
}
void expect_break_lock(MockTestImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("lock"), StrEq("break_lock"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("lock"),
+ StrEq("break_lock"), _, _, _, _))
.WillOnce(Return(r));
}
ClsLockType lock_type) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("lock"),
- StrEq("get_info"), _, _, _));
+ StrEq("get_info"), _, _, _, _));
if (r < 0 && r != -ENOENT) {
expect.WillOnce(Return(r));
} else {
bool exclusive = true) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("lock"),
- StrEq("set_cookie"), IsLockType(exclusive), _, _))
+ StrEq("set_cookie"), IsLockType(exclusive), _, _, _))
.WillOnce(Return(r));
}
};
void expect_unlock(MockImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("lock"),
- StrEq("unlock"), _, _, _))
+ StrEq("unlock"), _, _, _, _))
.WillOnce(Return(r));
}
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_get"),
- _, _, _))
+ _, _, _, _))
.WillOnce(DoAll(WithArg<5>(CopyInBufferlist(bl)),
Return(r)));
}
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_peer_list"),
- _, _, _))
+ _, _, _, _))
.WillOnce(DoAll(WithArg<5>(CopyInBufferlist(bl)),
Return(r)));
}
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_peer_list"),
- _, _, _))
+ _, _, _, _))
.WillOnce(DoAll(WithArg<5>(CopyInBufferlist(bl)),
Return(r)));
}
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("metadata_get"), ContentsEqual(in_bl), _, _))
+ StrEq("metadata_get"), ContentsEqual(in_bl), _, _, _))
.WillOnce(DoAll(WithArg<5>(CopyInBufferlist(out_bl)),
Return(r)));
}
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("metadata_set"), ContentsEqual(in_bl), _, _))
+ StrEq("metadata_set"), ContentsEqual(in_bl), _, _, _))
.WillOnce(Return(r));
}
};
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
StrEq("mirror_image_snapshot_unlink_peer"),
- ContentsEqual(bl), _, _))
+ ContentsEqual(bl), _, _, _))
.WillOnce(Invoke([&mock_image_ctx, snap_id, peer_uuid, r](auto&&... args) -> int {
if (r == 0) {
auto it = mock_image_ctx.snap_info.find(snap_id);
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(::journal::Journaler::header_oid(mock_image_ctx.id),
- _, StrEq("journal"), StrEq("client_list"), _, _, _))
+ _, StrEq("journal"), StrEq("client_list"), _, _, _, _))
.WillOnce(DoAll(WithArg<5>(CopyInBufferlist(bl)),
Return(r)));
}
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(::journal::Journaler::header_oid(mock_image_ctx.id),
_, StrEq("journal"), StrEq("client_unregister"),
- ContentsEqual(bl), _, _))
+ ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
}
AsyncRequest<> *request = new InvalidateRequest<>(*ictx, CEPH_NOSNAP, false, &cond_ctx);
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _,
+ _, _))
.Times(0);
{
AsyncRequest<> *request = new InvalidateRequest<>(*ictx, CEPH_NOSNAP, false, &cond_ctx);
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _,
+ _, _))
.WillOnce(DoDefault());
{
&cond_ctx);
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _,
+ _, _))
.WillOnce(DoDefault());
{
AsyncRequest<> *request = new InvalidateRequest<>(*ictx, CEPH_NOSNAP, false, &cond_ctx);
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _,
+ _, _))
.Times(0);
{
AsyncRequest<> *request = new InvalidateRequest<>(*ictx, CEPH_NOSNAP, false, &cond_ctx);
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _,
+ _, _))
.WillOnce(Return(-EINVAL));
{
std::string oid(ObjectMap<>::object_map_name(mock_image_ctx.id,
CEPH_NOSNAP));
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("lock"), _, _, _))
+ exec(oid, _, StrEq("lock"), StrEq("lock"), _, _, _, _))
.WillOnce(Return(r));
}
std::string oid(ObjectMap<>::object_map_name(mock_image_ctx.id,
CEPH_NOSNAP));
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("get_info"), _, _, _));
+ exec(oid, _, StrEq("lock"), StrEq("get_info"), _,
+ _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
std::string oid(ObjectMap<>::object_map_name(mock_image_ctx.id,
CEPH_NOSNAP));
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("break_lock"), _, _, _));
+ exec(oid, _, StrEq("lock"), StrEq("break_lock"),
+ _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
int r) {
std::string oid(ObjectMap<>::object_map_name(mock_image_ctx.id, snap_id));
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(oid, _, StrEq("rbd"), StrEq("object_map_load"), _, _, _));
+ exec(oid, _, StrEq("rbd"),
+ StrEq("object_map_load"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
std::string oid(ObjectMap<>::object_map_name(mock_image_ctx.id,
TEST_SNAP_ID));
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(oid, _, StrEq("rbd"), StrEq("object_map_resize"), _, _, _));
+ exec(oid, _, StrEq("rbd"),
+ StrEq("object_map_resize"), _, _, _, _));
expect.WillOnce(Return(r));
}
std::string oid(ObjectMap<>::object_map_name(ictx->id, snap_id));
if (snap_id == CEPH_NOSNAP) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
+ exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _,
+ _))
.WillOnce(DoDefault());
}
if (r < 0) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("rbd"), StrEq("object_map_resize"), _, _, _))
+ exec(oid, _, StrEq("rbd"), StrEq("object_map_resize"), _, _,
+ _, _))
.WillOnce(Return(r));
} else {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("rbd"), StrEq("object_map_resize"), _, _, _))
+ exec(oid, _, StrEq("rbd"), StrEq("object_map_resize"), _, _,
+ _, _))
.WillOnce(DoDefault());
}
}
void expect_invalidate(librbd::ImageCtx *ictx) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _,
+ _, _, _))
.WillOnce(DoDefault());
}
};
if (r < 0) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
read(ObjectMap<>::object_map_name(ictx->id, CEPH_NOSNAP),
- 0, 0, _)).WillOnce(Return(r));
+ 0, 0, _, _)).WillOnce(Return(r));
} else {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
read(ObjectMap<>::object_map_name(ictx->id, CEPH_NOSNAP),
- 0, 0, _)).WillOnce(DoDefault());
+ 0, 0, _, _)).WillOnce(DoDefault());
}
}
std::string oid(ObjectMap<>::object_map_name(ictx->id, CEPH_NOSNAP));
if (r < 0) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
+ exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _,
+ _))
.WillOnce(Return(r));
} else {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
+ exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _,
+ _))
.WillOnce(DoDefault());
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("rbd"), StrEq("object_map_snap_add"), _, _, _))
+ exec(oid, _, StrEq("rbd"), StrEq("object_map_snap_add"), _, _,
+ _, _))
.WillOnce(DoDefault());
}
}
void expect_invalidate(librbd::ImageCtx *ictx) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _,
+ _, _, _))
.WillOnce(DoDefault());
}
};
std::string snap_oid(ObjectMap<>::object_map_name(ictx->id, snap_id));
if (r < 0) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(snap_oid, _, StrEq("rbd"), StrEq("object_map_load"), _, _, _))
+ exec(snap_oid, _, StrEq("rbd"), StrEq("object_map_load"), _,
+ _, _, _))
.WillOnce(Return(r));
} else {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(snap_oid, _, StrEq("rbd"), StrEq("object_map_load"), _, _, _))
+ exec(snap_oid, _, StrEq("rbd"), StrEq("object_map_load"), _,
+ _, _, _))
.WillOnce(DoDefault());
}
}
std::string oid(ObjectMap<>::object_map_name(ictx->id, CEPH_NOSNAP));
if (r < 0) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
+ exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _,
+ _))
.WillOnce(Return(r));
} else {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
+ exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _,
+ _))
.WillOnce(DoDefault());
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("rbd"), StrEq("object_map_snap_remove"), _, _, _))
+ exec(oid, _, StrEq("rbd"), StrEq("object_map_snap_remove"), _,
+ _, _, _))
.WillOnce(DoDefault());
}
}
void expect_invalidate(librbd::ImageCtx *ictx) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _,
+ _, _, _))
.WillOnce(DoDefault());
}
};
if (r < 0) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
read(ObjectMap<>::object_map_name(ictx->id, snap_id),
- 0, 0, _)).WillOnce(Return(r));
+ 0, 0, _, _)).WillOnce(Return(r));
} else {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
read(ObjectMap<>::object_map_name(ictx->id, snap_id),
- 0, 0, _)).WillOnce(DoDefault());
+ 0, 0, _, _)).WillOnce(DoDefault());
}
}
void expect_write_map(librbd::ImageCtx *ictx, int r) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
exec(ObjectMap<>::object_map_name(ictx->id, CEPH_NOSNAP), _,
- StrEq("lock"), StrEq("assert_locked"), _, _, _))
+ StrEq("lock"), StrEq("assert_locked"), _, _, _, _))
.WillOnce(DoDefault());
if (r < 0) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
void expect_invalidate(librbd::ImageCtx *ictx, uint32_t times) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _,
+ _, _, _))
.Times(times)
.WillRepeatedly(DoDefault());
}
std::string oid(ObjectMap<>::object_map_name(mock_image_ctx.id,
CEPH_NOSNAP));
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("unlock"), _, _, _))
+ exec(oid, _, StrEq("lock"), StrEq("unlock"), _, _, _, _))
.WillOnce(Return(r));
}
};
std::string oid(ObjectMap<>::object_map_name(ictx->id, snap_id));
if (snap_id == CEPH_NOSNAP) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
+ exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _,
+ _))
.WillOnce(DoDefault());
}
if (r < 0) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
exec(oid, _, StrEq("rbd"), StrEq("object_map_update"),
- ContentsEqual(bl), _, _))
+ ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
} else {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
exec(oid, _, StrEq("rbd"), StrEq("object_map_update"),
- ContentsEqual(bl), _, _))
+ ContentsEqual(bl), _, _, _))
.WillOnce(DoDefault());
}
}
void expect_invalidate(librbd::ImageCtx *ictx) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _,
+ _, _, _))
.WillOnce(DoDefault());
}
};
} else {
expect_is_lock_owner(mock_image_ctx);
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("set_size"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("set_size"), _, _, _, _))
.WillOnce(Return(r));
}
}
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
StrEq(mock_image_ctx.old_format ? "snap_add" :
"snapshot_add"),
- _, _, _));
+ _, _, _, _));
if (r == -ESTALE) {
expect.WillOnce(Return(r)).WillOnce(DoDefault());
} else if (r < 0) {
void expect_set_protection_status(MockImageCtx &mock_image_ctx, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("set_protection_status"), _, _, _));
+ StrEq("set_protection_status"), _, _, _,
+ _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
StrEq("snapshot_trash_add"),
- _, _, _));
+ _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
using ceph::encode;
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("snapshot_get"), _, _, _))
+ StrEq("snapshot_get"), _, _, _, _))
.WillOnce(WithArg<5>(Invoke([snap_info, r](bufferlist* bl) {
encode(snap_info, *bl);
return r;
using ceph::encode;
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("children_list"), _, _, _))
+ StrEq("children_list"), _, _, _, _))
.WillOnce(WithArg<5>(Invoke([child_images, r](bufferlist* bl) {
encode(child_images, *bl);
return r;
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(util::header_name(parent_spec.image_id),
_, StrEq("rbd"), StrEq("child_detach"), ContentsEqual(bl),
- _, _))
+ _, _, _))
.WillOnce(Return(r));
}
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
StrEq(mock_image_ctx.old_format ? "snap_remove" :
"snapshot_remove"),
- _, _, _));
+ _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("set_protection_status"), ContentsEqual(bl),
- _, _));
+ StrEq("set_protection_status"),
+ ContentsEqual(bl), _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
encode(children, bl);
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(RBD_CHILDREN, _, StrEq("rbd"), StrEq("get_children"), _,
- _, _));
+ exec(RBD_CHILDREN, _, StrEq("rbd"),
+ StrEq("get_children"), _, _, _, _));
if (r < 0) {
expect.WillRepeatedly(Return(r));
} else {
void TestMockFixture::expect_unlock_exclusive_lock(librbd::ImageCtx &ictx) {
EXPECT_CALL(get_mock_io_ctx(ictx.md_ctx),
- exec(_, _, StrEq("lock"), StrEq("unlock"), _, _, _))
+ exec(_, _, StrEq("lock"), StrEq("unlock"), _, _, _, _))
.WillRepeatedly(DoDefault());
}
int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(StrEq("rbd_trash"), _, StrEq("rbd"), StrEq("trash_add"),
- _, _, _))
+ _, _, _, _))
.WillOnce(WithArg<4>(Invoke([=](bufferlist& in_bl) {
std::string id;
cls::rbd::TrashImageSpec trash_image_spec;
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(StrEq("rbd_directory"), _, StrEq("rbd"), StrEq("dir_remove_image"),
- ContentsEqual(in_bl), _, _))
+ ContentsEqual(in_bl), _, _, _))
.WillOnce(Return(r));
}
};
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(StrEq("rbd_trash"), _, StrEq("rbd"), StrEq("trash_state_set"),
- ContentsEqual(in_bl), _, _))
+ ContentsEqual(in_bl), _, _, _))
.WillOnce(Return(r));
}
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(StrEq("rbd_trash"), _, StrEq("rbd"), StrEq("trash_remove"),
- ContentsEqual(in_bl), _, _))
+ ContentsEqual(in_bl), _, _, _))
.WillOnce(Return(r));
}
};
encode(image_id, bl);
EXPECT_CALL(get_mock_io_ctx(m_local_io_ctx),
- exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_get_image_id"), _, _, _))
+ exec(RBD_MIRRORING, _, StrEq("rbd"),
+ StrEq("mirror_image_get_image_id"), _, _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([bl](bufferlist *out_bl) {
*out_bl = bl;
})),
EXPECT_CALL(get_mock_io_ctx(m_local_io_ctx),
exec(RBD_MIRRORING, _, StrEq("rbd"),
- StrEq("mirror_image_set"), ContentsEqual(bl), _, _))
+ StrEq("mirror_image_set"), ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
}
void expect_mirror_image_remove(librados::IoCtx &ioctx, int r) {
EXPECT_CALL(get_mock_io_ctx(ioctx),
- exec(StrEq("rbd_mirroring"), _, StrEq("rbd"), StrEq("mirror_image_remove"),
- _, _, _))
+ exec(StrEq("rbd_mirroring"), _, StrEq("rbd"),
+ StrEq("mirror_image_remove"), _, _, _, _))
.WillOnce(Return(r));
}
using ceph::encode;
EXPECT_CALL(get_mock_io_ctx(m_local_io_ctx),
exec(StrEq(RBD_TRASH), _, StrEq("rbd"),
- StrEq("trash_get"), _, _, _))
+ StrEq("trash_get"), _, _, _, _))
.WillOnce(WithArg<5>(Invoke([trash_spec, r](bufferlist* bl) {
encode(trash_spec, *bl);
return r;
EXPECT_CALL(get_mock_io_ctx(m_local_io_ctx),
exec(StrEq(RBD_TRASH), _, StrEq("rbd"),
StrEq("trash_state_set"),
- ContentsEqual(in_bl), _, _))
+ ContentsEqual(in_bl), _, _, _))
.WillOnce(Return(r));
}
EXPECT_CALL(get_mock_io_ctx(m_local_io_ctx),
exec(librbd::util::header_name(image_id), _, StrEq("rbd"),
- StrEq("get_snapcontext"), _, _, _))
+ StrEq("get_snapcontext"), _, _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([bl](bufferlist *out_bl) {
*out_bl = bl;
})),
EXPECT_CALL(get_mock_io_ctx(io_ctx),
exec(RBD_TRASH, _, StrEq("rbd"), StrEq("trash_list"),
- ContentsEqual(bl), _, _))
+ ContentsEqual(bl), _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([out_bl](bufferlist *bl) {
*bl = out_bl;
})),
ceph::encode(key, bl);
EXPECT_CALL(get_mock_io_ctx(m_mock_local_image_ctx->md_ctx),
exec(m_mock_local_image_ctx->header_oid, _, StrEq("rbd"),
- StrEq("metadata_remove"), ContentsEqual(bl), _, _))
+ StrEq("metadata_remove"), ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
if (r < 0) {
return;
ceph::encode(pairs, bl);
EXPECT_CALL(get_mock_io_ctx(m_mock_local_image_ctx->md_ctx),
exec(m_mock_local_image_ctx->header_oid, _, StrEq("rbd"),
- StrEq("metadata_set"), ContentsEqual(bl), _, _))
+ StrEq("metadata_set"), ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
}
}
EXPECT_CALL(get_mock_io_ctx(m_local_io_ctx),
exec(RBD_MIRRORING, _, StrEq("rbd"),
- StrEq("mirror_image_set"), ContentsEqual(bl), _, _))
+ StrEq("mirror_image_set"), ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
}
EXPECT_CALL(get_mock_io_ctx(m_local_io_ctx),
exec(StrEq("rbd_mirroring"), _, StrEq("rbd"),
StrEq("mirror_image_remove"),
- ContentsEqual(bl), _, _))
+ ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
}
EXPECT_CALL(get_mock_io_ctx(mock_test_image_ctx.md_ctx),
exec(mock_test_image_ctx.header_oid, _, StrEq("rbd"),
StrEq("mirror_image_snapshot_set_copy_progress"),
- ContentsEqual(bl), _, _))
+ ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
}
encode(mirror_image, bl);
EXPECT_CALL(get_mock_io_ctx(io_ctx),
- exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_get"), _, _, _))
+ exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_get"),
+ _, _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([bl](bufferlist *out_bl) {
*out_bl = bl;
})),
encode(image_id, bl);
EXPECT_CALL(get_mock_io_ctx(io_ctx),
- exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_get_image_id"), _, _, _))
+ exec(RBD_MIRRORING, _, StrEq("rbd"),
+ StrEq("mirror_image_get_image_id"), _, _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([bl](bufferlist *out_bl) {
*out_bl = bl;
})),
encode(image_id, bl);
EXPECT_CALL(get_mock_io_ctx(io_ctx),
- exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_get_image_id"), _, _, _))
+ exec(RBD_MIRRORING, _, StrEq("rbd"),
+ StrEq("mirror_image_get_image_id"), _, _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([bl](bufferlist *out_bl) {
*out_bl = bl;
})),
encode(image_name, bl);
EXPECT_CALL(get_mock_io_ctx(io_ctx),
- exec(RBD_DIRECTORY, _, StrEq("rbd"), StrEq("dir_get_name"), _, _, _))
+ exec(RBD_DIRECTORY, _, StrEq("rbd"), StrEq("dir_get_name"), _,
+ _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([bl](bufferlist *out_bl) {
*out_bl = bl;
})),
encode(ids, bl);
EXPECT_CALL(get_mock_io_ctx(io_ctx),
- exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_list"), _, _, _))
+ exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_list"),
+ _, _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([bl](bufferlist *out_bl) {
*out_bl = bl;
})),
void expect_register_instance(librados::MockTestMemIoCtxImpl &mock_io_ctx,
int r) {
EXPECT_CALL(mock_io_ctx, exec(RBD_MIRROR_LEADER, _, StrEq("rbd"),
- StrEq("mirror_instances_add"), _, _, _))
+ StrEq("mirror_instances_add"), _, _, _, _))
.WillOnce(Return(r));
}
void expect_unregister_instance(librados::MockTestMemIoCtxImpl &mock_io_ctx,
int r) {
EXPECT_CALL(mock_io_ctx, exec(RBD_MIRROR_LEADER, _, StrEq("rbd"),
- StrEq("mirror_instances_remove"), _, _, _))
+ StrEq("mirror_instances_remove"), _, _, _, _))
.WillOnce(Return(r));
}
const cls::rbd::MirrorImageSiteStatus& mirror_image_status, int r) {
EXPECT_CALL(*m_mock_local_io_ctx,
exec(RBD_MIRRORING, _, StrEq("rbd"),
- StrEq("mirror_image_status_set"), _, _, _))
+ StrEq("mirror_image_status_set"), _, _, _, _))
.WillOnce(WithArg<4>(Invoke(
[r, global_image_id, mirror_image_status](bufferlist& in_bl) {
auto bl_it = in_bl.cbegin();
EXPECT_CALL(*io_ctx_impl,
exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_uuid_get"),
- _, _, _))
+ _, _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([out_bl](bufferlist *bl) {
*bl = out_bl;
})),
EXPECT_CALL(*io_ctx_impl,
exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_mode_get"),
- _, _, _))
+ _, _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([out_bl](bufferlist *bl) {
*bl = out_bl;
})),
void expect_mirror_mode_get(librados::MockTestMemIoCtxImpl *io_ctx_impl) {
EXPECT_CALL(*io_ctx_impl,
exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_mode_get"),
- _, _, _))
+ _, _, _, _))
.WillRepeatedly(DoAll(WithArg<5>(Invoke([](bufferlist *bl) {
encode(cls::rbd::MIRROR_MODE_POOL, *bl);
})),