* Output:
* @return 0 on success, negative error code on failure
*/
-int image_add_group(cls_method_context_t hctx,
+int image_group_add(cls_method_context_t hctx,
bufferlist *in, bufferlist *out)
{
- CLS_LOG(20, "image_add_group");
+ CLS_LOG(20, "image_group_add");
cls::rbd::GroupSpec new_group;
try {
bufferlist::iterator iter = in->begin();
* Output:
* @return 0 on success, negative error code on failure
*/
-int image_remove_group(cls_method_context_t hctx,
+int image_group_remove(cls_method_context_t hctx,
bufferlist *in,
bufferlist *out)
{
- CLS_LOG(20, "image_remove_group");
+ CLS_LOG(20, "image_group_remove");
cls::rbd::GroupSpec spec;
try {
bufferlist::iterator iter = in->begin();
* @param GroupSpec
* @return 0 on success, negative error code on failure
*/
-int image_get_group(cls_method_context_t hctx,
+int image_group_get(cls_method_context_t hctx,
bufferlist *in, bufferlist *out)
{
- CLS_LOG(20, "image_get_group");
+ CLS_LOG(20, "image_group_get");
bufferlist refbl;
int r = cls_cxx_map_get_val(hctx, RBD_GROUP_REF, &refbl);
if (r < 0 && r != -ENOENT) {
cls_method_handle_t h_group_image_remove;
cls_method_handle_t h_group_image_list;
cls_method_handle_t h_group_image_set;
- cls_method_handle_t h_image_add_group;
- cls_method_handle_t h_image_remove_group;
- cls_method_handle_t h_image_get_group;
+ cls_method_handle_t h_image_group_add;
+ cls_method_handle_t h_image_group_remove;
+ cls_method_handle_t h_image_group_get;
cls_method_handle_t h_group_snap_set;
cls_method_handle_t h_group_snap_remove;
cls_method_handle_t h_group_snap_get_by_id;
cls_register_cxx_method(h_class, "group_image_set",
CLS_METHOD_RD | CLS_METHOD_WR,
group_image_set, &h_group_image_set);
- cls_register_cxx_method(h_class, "image_add_group",
+ cls_register_cxx_method(h_class, "image_group_add",
CLS_METHOD_RD | CLS_METHOD_WR,
- image_add_group, &h_image_add_group);
- cls_register_cxx_method(h_class, "image_remove_group",
+ image_group_add, &h_image_group_add);
+ cls_register_cxx_method(h_class, "image_group_remove",
CLS_METHOD_RD | CLS_METHOD_WR,
- image_remove_group, &h_image_remove_group);
- cls_register_cxx_method(h_class, "image_get_group",
+ image_group_remove, &h_image_group_remove);
+ cls_register_cxx_method(h_class, "image_group_get",
CLS_METHOD_RD,
- image_get_group, &h_image_get_group);
+ image_group_get, &h_image_group_get);
cls_register_cxx_method(h_class, "group_snap_set",
CLS_METHOD_RD | CLS_METHOD_WR,
group_snap_set, &h_group_snap_set);
return ioctx->exec(oid, "rbd", "group_image_set", bl, bl2);
}
- int image_add_group(librados::IoCtx *ioctx, const std::string &oid,
+ int image_group_add(librados::IoCtx *ioctx, const std::string &oid,
const cls::rbd::GroupSpec &group_spec)
{
bufferlist bl, bl2;
encode(group_spec, bl);
- return ioctx->exec(oid, "rbd", "image_add_group", bl, bl2);
+ return ioctx->exec(oid, "rbd", "image_group_add", bl, bl2);
}
- int image_remove_group(librados::IoCtx *ioctx, const std::string &oid,
+ int image_group_remove(librados::IoCtx *ioctx, const std::string &oid,
const cls::rbd::GroupSpec &group_spec)
{
bufferlist bl, bl2;
encode(group_spec, bl);
- return ioctx->exec(oid, "rbd", "image_remove_group", bl, bl2);
+ return ioctx->exec(oid, "rbd", "image_group_remove", bl, bl2);
}
- void image_get_group_start(librados::ObjectReadOperation *op)
+ void image_group_get_start(librados::ObjectReadOperation *op)
{
bufferlist in_bl;
- op->exec("rbd", "image_get_group", in_bl);
+ op->exec("rbd", "image_group_get", in_bl);
}
- int image_get_group_finish(bufferlist::iterator *iter,
+ int image_group_get_finish(bufferlist::iterator *iter,
cls::rbd::GroupSpec *group_spec)
{
try {
return 0;
}
- int image_get_group(librados::IoCtx *ioctx, const std::string &oid,
+ int image_group_get(librados::IoCtx *ioctx, const std::string &oid,
cls::rbd::GroupSpec *group_spec)
{
librados::ObjectReadOperation op;
- image_get_group_start(&op);
+ image_group_get_start(&op);
bufferlist out_bl;
int r = ioctx->operate(oid, &op, &out_bl);
}
bufferlist::iterator iter = out_bl.begin();
- return image_get_group_finish(&iter, group_spec);
+ return image_group_get_finish(&iter, group_spec);
}
int group_snap_set(librados::IoCtx *ioctx, const std::string &oid,
std::vector<cls::rbd::GroupImageStatus> *images);
int group_image_set(librados::IoCtx *ioctx, const std::string &oid,
const cls::rbd::GroupImageStatus &st);
- int image_add_group(librados::IoCtx *ioctx, const std::string &oid,
+ int image_group_add(librados::IoCtx *ioctx, const std::string &oid,
const cls::rbd::GroupSpec &group_spec);
- int image_remove_group(librados::IoCtx *ioctx, const std::string &oid,
+ int image_group_remove(librados::IoCtx *ioctx, const std::string &oid,
const cls::rbd::GroupSpec &group_spec);
- void image_get_group_start(librados::ObjectReadOperation *op);
- int image_get_group_finish(bufferlist::iterator *iter,
+ void image_group_get_start(librados::ObjectReadOperation *op);
+ int image_group_get_finish(bufferlist::iterator *iter,
cls::rbd::GroupSpec *group_spec);
- int image_get_group(librados::IoCtx *ioctx, const std::string &oid,
+ int image_group_get(librados::IoCtx *ioctx, const std::string &oid,
cls::rbd::GroupSpec *group_spec);
int group_snap_set(librados::IoCtx *ioctx, const std::string &oid,
const cls::rbd::GroupSnapshot &snapshot);
return r;
}
- r = cls_client::image_remove_group(&image_ioctx, image_header_oid,
+ r = cls_client::image_group_remove(&image_ioctx, image_header_oid,
group_spec);
if ((r < 0) && (r != -ENOENT)) {
lderr(cct) << "couldn't remove group reference from image"
return r;
}
- r = cls_client::image_add_group(&image_ioctx, image_header_oid, group_spec);
+ r = cls_client::image_group_add(&image_ioctx, image_header_oid, group_spec);
if (r < 0) {
lderr(cct) << "error adding group reference to image: "
<< cpp_strerror(-r) << dendl;
ldout(cct, 10) << this << " " << __func__ << dendl;
librados::ObjectReadOperation op;
- cls_client::image_get_group_start(&op);
+ cls_client::image_group_get_start(&op);
using klass = RefreshRequest<I>;
librados::AioCompletion *comp = create_rados_callback<
if (*result == 0) {
bufferlist::iterator it = m_out_bl.begin();
- cls_client::image_get_group_finish(&it, &m_group_spec);
+ cls_client::image_group_get_finish(&it, &m_group_spec);
}
if (*result == -EOPNOTSUPP) {
// Older OSD doesn't support RBD groups
ldout(m_cct, 20) << dendl;
librados::ObjectReadOperation op;
- librbd::cls_client::image_get_group_start(&op);
+ librbd::cls_client::image_group_get_start(&op);
using klass = RemoveRequest<I>;
librados::AioCompletion *rados_completion = create_rados_callback<
cls::rbd::GroupSpec s;
if (r == 0) {
bufferlist::iterator it = m_out_bl.begin();
- r = librbd::cls_client::image_get_group_finish(&it, &s);
+ r = librbd::cls_client::image_group_get_finish(&it, &s);
}
if (r < 0 && r != -EOPNOTSUPP) {
lderr(m_cct) << "error fetching group for image: "
ASSERT_EQ(cls::rbd::GROUP_IMAGE_LINK_STATE_ATTACHED, ref_state);
}
-TEST_F(TestClsRbd, image_add_group) {
+TEST_F(TestClsRbd, image_group_add) {
librados::IoCtx ioctx;
ASSERT_EQ(0, _rados.ioctx_create(_pool_name.c_str(), ioctx));
string group_id = "group_id";
cls::rbd::GroupSpec spec(group_id, pool_id);
- ASSERT_EQ(0, image_add_group(&ioctx, image_id, spec));
+ ASSERT_EQ(0, image_group_add(&ioctx, image_id, spec));
map<string, bufferlist> vals;
ASSERT_EQ(0, ioctx.omap_get_vals(image_id, "", RBD_GROUP_REF, 10, &vals));
ASSERT_EQ(pool_id, val_spec.pool_id);
}
-TEST_F(TestClsRbd, image_remove_group) {
+TEST_F(TestClsRbd, image_group_remove) {
librados::IoCtx ioctx;
ASSERT_EQ(0, _rados.ioctx_create(_pool_name.c_str(), ioctx));
string group_id = "group_id";
cls::rbd::GroupSpec spec(group_id, pool_id);
- ASSERT_EQ(0, image_add_group(&ioctx, image_id, spec));
- // Add reference in order to make sure that image_remove_group actually
+ ASSERT_EQ(0, image_group_add(&ioctx, image_id, spec));
+ // Add reference in order to make sure that image_group_remove actually
// does something.
- ASSERT_EQ(0, image_remove_group(&ioctx, image_id, spec));
+ ASSERT_EQ(0, image_group_remove(&ioctx, image_id, spec));
map<string, bufferlist> vals;
ASSERT_EQ(0, ioctx.omap_get_vals(image_id, "", RBD_GROUP_REF, 10, &vals));
ASSERT_EQ(0U, vals.size());
}
-TEST_F(TestClsRbd, image_get_group) {
+TEST_F(TestClsRbd, image_group_get) {
librados::IoCtx ioctx;
ASSERT_EQ(0, _rados.ioctx_create(_pool_name.c_str(), ioctx));
string group_id = "group_id_get_group_spec";
cls::rbd::GroupSpec spec_add(group_id, pool_id);
- ASSERT_EQ(0, image_add_group(&ioctx, image_id, spec_add));
+ ASSERT_EQ(0, image_group_add(&ioctx, image_id, spec_add));
cls::rbd::GroupSpec spec;
- ASSERT_EQ(0, image_get_group(&ioctx, image_id, &spec));
+ ASSERT_EQ(0, image_group_get(&ioctx, image_id, &spec));
ASSERT_EQ(group_id, spec.group_id);
ASSERT_EQ(pool_id, spec.pool_id);
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_get_group"), _, _, _));
+ StrEq("image_group_get"), _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
void expect_get_group(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("image_get_group"), _, _, _));
+ StrEq("image_group_get"), _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {