]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson: add set_val and rm_val to global conf. 54870/head
authorRongqi Sun <sunrongqi@huawei.com>
Tue, 12 Dec 2023 02:33:19 +0000 (10:33 +0800)
committerRongqi Sun <sunrongqi@huawei.com>
Tue, 12 Dec 2023 02:33:19 +0000 (10:33 +0800)
Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
src/crimson/common/config_proxy.h
src/global/global_context.cc

index 822db34f61a4fd626a56ffaff8bd3ab9268bf0e4..b04fbee2e8a7506fda3b882e1e66668086ab9a98 100644 (file)
@@ -14,6 +14,11 @@ namespace ceph {
 class Formatter;
 }
 
+namespace ceph::global {
+int g_conf_set_val(const std::string& key, const std::string& s);
+int g_conf_rm_val(const std::string& key);
+}
+
 namespace crimson::common {
 
 // a facade for managing config. each shard has its own copy of ConfigProxy.
@@ -128,6 +133,7 @@ public:
     obs_mgr.remove_observer(obs);
   }
   seastar::future<> rm_val(const std::string& key) {
+    ceph::global::g_conf_rm_val(key);
     return do_change([key, this](ConfigValues& values) {
       auto ret = get_config().rm_val(values, key);
       if (ret < 0) {
@@ -137,6 +143,7 @@ public:
   }
   seastar::future<> set_val(const std::string& key,
                            const std::string& val) {
+    ceph::global::g_conf_set_val(key, val);
     return do_change([key, val, this](ConfigValues& values) {
       std::stringstream err;
       auto ret = get_config().set_val(values, obs_mgr, key, val, &err);
index b1e37bfbe595e06893cff8ccb2046a0d027d3000..0fea21d558aea3da3ad1468ce71549b176de5572 100644 (file)
 #include "crimson/common/config_proxy.h"
 #endif
 
+#if defined(WITH_SEASTAR) && !defined(WITH_ALIEN)
+namespace ceph::global {
+int __attribute__((weak)) g_conf_set_val(const std::string& key, const std::string& s) {
+  return 0;
+}
+
+int __attribute__((weak)) g_conf_rm_val(const std::string& key) {
+  return 0;
+}
+}
+#endif
 
 /*
  * Global variables for use from process context.
@@ -34,6 +45,24 @@ ConfigProxy& g_conf() {
 #endif
 }
 
+#ifdef WITH_ALIEN
+int g_conf_set_val(const std::string& key, const std::string& s)
+{
+  if (g_ceph_context != NULL)
+    return g_ceph_context->_conf.set_val(key, s);
+
+  return 0;
+}
+
+int g_conf_rm_val(const std::string& key)
+{
+  if (g_ceph_context != NULL)
+    return g_ceph_context->_conf.rm_val(key);
+
+  return 0;
+}
+#endif
+
 const char *g_assert_file = 0;
 int g_assert_line = 0;
 const char *g_assert_func = 0;