From: Rongqi Sun Date: Tue, 12 Dec 2023 02:33:19 +0000 (+0800) Subject: crimson: add set_val and rm_val to global conf. X-Git-Tag: v19.3.0~264^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4d8c6519b374d14c8c367cebb9228387cbdeaa80;p=ceph.git crimson: add set_val and rm_val to global conf. Signed-off-by: Rongqi Sun --- diff --git a/src/crimson/common/config_proxy.h b/src/crimson/common/config_proxy.h index 822db34f61a4..b04fbee2e8a7 100644 --- a/src/crimson/common/config_proxy.h +++ b/src/crimson/common/config_proxy.h @@ -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); diff --git a/src/global/global_context.cc b/src/global/global_context.cc index b1e37bfbe595..0fea21d558ae 100644 --- a/src/global/global_context.cc +++ b/src/global/global_context.cc @@ -20,6 +20,17 @@ #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;