]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
objclass, crimson: initialize the ClassHandler.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 25 Jul 2019 11:51:44 +0000 (13:51 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Fri, 23 Aug 2019 23:21:59 +0000 (01:21 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/CMakeLists.txt
src/crimson/osd/osd.cc
src/osd/ClassHandler.cc

index 6e92f97661750c59be26b6fde8c8dc7b476ba605..8ee99bbfbfccc08c46dc94257142457ce5c24068 100644 (file)
@@ -18,6 +18,7 @@ add_executable(crimson-osd
   osd_operations/replicated_request.cc
   osdmap_gate.cc
   pg_map.cc
+  ${PROJECT_SOURCE_DIR}/src/osd/ClassHandler.cc
   ${PROJECT_SOURCE_DIR}/src/osd/PeeringState.cc
   ${PROJECT_SOURCE_DIR}/src/osd/PGPeeringEvent.cc
   ${PROJECT_SOURCE_DIR}/src/osd/PGStateUtils.cc
index 6cf7e9e04a67a4123026392487ffba9a0f6599f1..e38bb9defd4a07aff2aaf1c7586adf6837682c03 100644 (file)
@@ -20,6 +20,7 @@
 #include "messages/MPGStats.h"
 
 #include "os/Transaction.h"
+#include "osd/ClassHandler.h"
 #include "osd/PGPeeringEvent.h"
 #include "osd/PeeringState.h"
 
@@ -78,6 +79,14 @@ OSD::OSD(int id, uint32_t nonce,
     msgr.get().set_auth_server(monc.get());
     msgr.get().set_auth_client(monc.get());
   }
+
+  if (local_conf()->osd_open_classes_on_start) {
+    const int r = ClassHandler::get_instance().open_all_classes();
+    if (r) {
+      logger().warn("{} warning: got an error loading one or more classes: {}",
+                    __func__, cpp_strerror(r));
+    }
+  }
 }
 
 OSD::~OSD() = default;
index 4f11e51f1116d289f9463e7e81b2b642b41a0c55..e96198ee881243085208fe7d07d24a17ce7bc19e 100644 (file)
@@ -329,6 +329,15 @@ int ClassHandler::ClassMethod::exec(cls_method_context_t ctx, bufferlist& indata
 
 ClassHandler& ClassHandler::get_instance()
 {
+#ifdef WITH_SEASTAR
+  // the context is being used solely for:
+  //   1. random number generation (cls_gen_random_bytes)
+  //   2. accessing the configuration
+  //   3. logging
+  static CephContext cct;
+  static ClassHandler single(&cct);
+#else
   static ClassHandler single(g_ceph_context);
+#endif // WITH_SEASTAR
   return single;
 }