From eef9cfaadad66058b39ef4854a4d86dd8444f8d9 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 16 May 2016 05:37:56 -0400 Subject: [PATCH] objclass: add cls_get_features Expose cls methods to the current OSDMap features set. Signed-off-by: Sage Weil --- src/objclass/class_api.cc | 6 ++++++ src/objclass/objclass.h | 1 + src/test/librados_test_stub/LibradosTestStub.cc | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/src/objclass/class_api.cc b/src/objclass/class_api.cc index ea5caa577dd..0e32e3fb12e 100644 --- a/src/objclass/class_api.cc +++ b/src/objclass/class_api.cc @@ -677,6 +677,12 @@ int cls_current_subop_num(cls_method_context_t hctx) return ctx->current_osd_subop_num; } +uint64_t cls_get_features(cls_method_context_t hctx) +{ + ReplicatedPG::OpContext *ctx = *(ReplicatedPG::OpContext **)hctx; + return ctx->pg->get_osdmap()->get_up_osd_features(); +} + void cls_cxx_subop_version(cls_method_context_t hctx, string *s) { if (!s) diff --git a/src/objclass/objclass.h b/src/objclass/objclass.h index 49a97ddd8ef..17db742e8d0 100644 --- a/src/objclass/objclass.h +++ b/src/objclass/objclass.h @@ -193,6 +193,7 @@ extern int cls_gen_rand_base64(char *dest, int size); /* size should be the requ /* environment */ extern uint64_t cls_current_version(cls_method_context_t hctx); extern int cls_current_subop_num(cls_method_context_t hctx); +extern uint64_t cls_get_features(cls_method_context_t hctx); /* helpers */ extern void cls_cxx_subop_version(cls_method_context_t hctx, string *s); diff --git a/src/test/librados_test_stub/LibradosTestStub.cc b/src/test/librados_test_stub/LibradosTestStub.cc index dac71e948e9..64088805fbb 100644 --- a/src/test/librados_test_stub/LibradosTestStub.cc +++ b/src/test/librados_test_stub/LibradosTestStub.cc @@ -1183,6 +1183,10 @@ int cls_cxx_list_watchers(cls_method_context_t hctx, return 0; } +uint64_t cls_get_features(cls_method_context_t hctx) { + return CEPH_FEATURES_DEFAULT_SUPPORTED; +} + int cls_log(int level, const char *format, ...) { int size = 256; va_list ap;