From d447a80815e5fe72ef96c2506d4f78e507204047 Mon Sep 17 00:00:00 2001 From: Bassam Tabbara Date: Fri, 4 Nov 2016 18:10:08 -0700 Subject: embedded: Add RADOS classes to embedded cephd library RADOS classes can now be statically compiled and added to the embedded cephd library. The RADOS ClassHandler now has an option to skip calling dlclose just like PluginRegistry. All RADOS classes where changed to use a CLS_INIT macro that will either use __cls_init or classname_cls_init. this enables the static compiling of all RADOS classes in a single library. Also global method definitions where moved to inside cls_init. Also added a few aconfig defines including WITH_EMBEDDED, WITH_CEPHFS, WITH_RBD, and WITH_KVS. Note that WITH_RBD was not defined before and the ceph-dencoder was broken when it was turned on. Signed-off-by: Bassam Tabbara --- src/libcephd/CMakeLists.txt | 5 ++-- src/libcephd/libcephd.cc | 71 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 3 deletions(-) (limited to 'src/libcephd') diff --git a/src/libcephd/CMakeLists.txt b/src/libcephd/CMakeLists.txt index 9ba77fd9527..25d90c2dee3 100644 --- a/src/libcephd/CMakeLists.txt +++ b/src/libcephd/CMakeLists.txt @@ -11,11 +11,10 @@ set(merge_libs cephd_base cephd_compressor cephd_ec + cephd_cls + cephd_cls_kvs cephd_rados cephd_rbd - cls_journal_client - cls_lock_client - cls_rbd_client common common_utf8 erasure_code diff --git a/src/libcephd/libcephd.cc b/src/libcephd/libcephd.cc index 4a75e433c4d..6adf4d3fa8e 100644 --- a/src/libcephd/libcephd.cc +++ b/src/libcephd/libcephd.cc @@ -18,6 +18,27 @@ #include "include/cephd/libcephd.h" #include "global/global_context.h" #include "global/global_init.h" +#include "objclass/objclass.h" +#include "osd/OSD.h" +#include "osd/ClassHandler.h" + +// forward declarations of RADOS class init functions +CLS_INIT(cephfs); +CLS_INIT(hello); +CLS_INIT(journal); +CLS_INIT(kvs); +CLS_INIT(lock); +CLS_INIT(log); +CLS_INIT(lua); +CLS_INIT(numops); +CLS_INIT(rbd); +CLS_INIT(refcount); +CLS_INIT(replica_log); +CLS_INIT(rgw); +CLS_INIT(statelog); +CLS_INIT(timeindex); +CLS_INIT(user); +CLS_INIT(version); extern "C" void cephd_version(int *pmajor, int *pminor, int *ppatch) { @@ -150,6 +171,56 @@ void cephd_preload_embedded_plugins() } } +void cephd_preload_rados_classes(OSD *osd) +{ + // intialize RADOS classes + { + ClassHandler *class_handler = osd->class_handler; + Mutex::Locker l(class_handler->mutex); + +#ifdef WITH_CEPHFS + class_handler->add_embedded_class("cephfs"); + cephfs_cls_init(); +#endif + class_handler->add_embedded_class("hello"); + hello_cls_init(); + class_handler->add_embedded_class("journal"); + journal_cls_init(); +#ifdef WITH_KVS + class_handler->add_embedded_class("kvs"); + kvs_cls_init(); +#endif + class_handler->add_embedded_class("lock"); + lock_cls_init(); + class_handler->add_embedded_class("log"); + log_cls_init(); + class_handler->add_embedded_class("lua"); + lua_cls_init(); + class_handler->add_embedded_class("numops"); + numops_cls_init(); +#ifdef WITH_RBD + class_handler->add_embedded_class("rbd"); + rbd_cls_init(); +#endif + class_handler->add_embedded_class("refcount"); + refcount_cls_init(); + class_handler->add_embedded_class("replica_log"); + replica_log_cls_init(); +#ifdef WITH_RADOSGW + class_handler->add_embedded_class("rgw"); + rgw_cls_init(); +#endif + class_handler->add_embedded_class("statelog"); + statelog_cls_init(); + class_handler->add_embedded_class("timeindex"); + timeindex_cls_init(); + class_handler->add_embedded_class("user"); + user_cls_init(); + class_handler->add_embedded_class("version"); + version_cls_init(); + } +} + extern "C" int cephd_mon(int argc, const char **argv); extern "C" int cephd_osd(int argc, const char **argv); -- cgit v1.2.3