return old_snapshot_list_finish(&it, names, sizes, snapc);
}
+ void get_all_features_start(librados::ObjectReadOperation *op) {
+ bufferlist in;
+ op->exec("rbd", "get_all_features", in);
+ }
+
+ int get_all_features_finish(bufferlist::iterator *it,
+ uint64_t *all_features) {
+ try {
+ ::decode(*all_features, *it);
+ } catch (const buffer::error &err) {
+ return -EBADMSG;
+ }
+ return 0;
+ }
+
+ int get_all_features(librados::IoCtx *ioctx, const std::string &oid,
+ uint64_t *all_features) {
+ librados::ObjectReadOperation op;
+ get_all_features_start(&op);
+
+ bufferlist out_bl;
+ int r = ioctx->operate(oid, &op, &out_bl);
+ if (r < 0) {
+ return r;
+ }
+
+ bufferlist::iterator it = out_bl.begin();
+ return get_all_features_finish(&it, all_features);
+ }
+
int copyup(librados::IoCtx *ioctx, const std::string &oid,
bufferlist data) {
bufferlist out;
std::vector<parent_info> *parents,
std::vector<uint8_t> *protection_statuses);
+ void get_all_features_start(librados::ObjectReadOperation *op);
+ int get_all_features_finish(bufferlist::iterator *it,
+ uint64_t *all_features);
+ int get_all_features(librados::IoCtx *ioctx, const std::string &oid,
+ uint64_t *all_features);
+
int copyup(librados::IoCtx *ioctx, const std::string &oid,
bufferlist data);
int get_protection_status(librados::IoCtx *ioctx, const std::string &oid,
librados::Rados TestClsRbd::_rados;
uint64_t TestClsRbd::_image_number = 0;
+TEST_F(TestClsRbd, get_all_features)
+{
+ librados::IoCtx ioctx;
+ ASSERT_EQ(0, _rados.ioctx_create(_pool_name.c_str(), ioctx));
+
+ string oid = get_temp_image_name();
+ ASSERT_EQ(0, ioctx.create(oid, false));
+
+ uint64_t all_features = 0;
+ ASSERT_EQ(0, get_all_features(&ioctx, oid, &all_features));
+ ASSERT_EQ(RBD_FEATURES_ALL, all_features);
+
+ ioctx.close();
+}
+
TEST_F(TestClsRbd, copyup)
{
librados::IoCtx ioctx;