Skip to content

Commit fb6cce2

Browse files
authored
Merge pull request ceph#54870 from Svelar/crimson_g_conf
crimson: add set_val and rm_val to global conf Reviewed-by: Samuel Just <[email protected]>
2 parents 5a5ca59 + 4d8c651 commit fb6cce2

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

src/crimson/common/config_proxy.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ namespace ceph {
1414
class Formatter;
1515
}
1616

17+
namespace ceph::global {
18+
int g_conf_set_val(const std::string& key, const std::string& s);
19+
int g_conf_rm_val(const std::string& key);
20+
}
21+
1722
namespace crimson::common {
1823

1924
// a facade for managing config. each shard has its own copy of ConfigProxy.
@@ -128,6 +133,7 @@ class ConfigProxy : public seastar::peering_sharded_service<ConfigProxy>
128133
obs_mgr.remove_observer(obs);
129134
}
130135
seastar::future<> rm_val(const std::string& key) {
136+
ceph::global::g_conf_rm_val(key);
131137
return do_change([key, this](ConfigValues& values) {
132138
auto ret = get_config().rm_val(values, key);
133139
if (ret < 0) {
@@ -137,6 +143,7 @@ class ConfigProxy : public seastar::peering_sharded_service<ConfigProxy>
137143
}
138144
seastar::future<> set_val(const std::string& key,
139145
const std::string& val) {
146+
ceph::global::g_conf_set_val(key, val);
140147
return do_change([key, val, this](ConfigValues& values) {
141148
std::stringstream err;
142149
auto ret = get_config().set_val(values, obs_mgr, key, val, &err);

src/global/global_context.cc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@
2020
#include "crimson/common/config_proxy.h"
2121
#endif
2222

23+
#if defined(WITH_SEASTAR) && !defined(WITH_ALIEN)
24+
namespace ceph::global {
25+
int __attribute__((weak)) g_conf_set_val(const std::string& key, const std::string& s) {
26+
return 0;
27+
}
28+
29+
int __attribute__((weak)) g_conf_rm_val(const std::string& key) {
30+
return 0;
31+
}
32+
}
33+
#endif
2334

2435
/*
2536
* Global variables for use from process context.
@@ -34,6 +45,24 @@ ConfigProxy& g_conf() {
3445
#endif
3546
}
3647

48+
#ifdef WITH_ALIEN
49+
int g_conf_set_val(const std::string& key, const std::string& s)
50+
{
51+
if (g_ceph_context != NULL)
52+
return g_ceph_context->_conf.set_val(key, s);
53+
54+
return 0;
55+
}
56+
57+
int g_conf_rm_val(const std::string& key)
58+
{
59+
if (g_ceph_context != NULL)
60+
return g_ceph_context->_conf.rm_val(key);
61+
62+
return 0;
63+
}
64+
#endif
65+
3766
const char *g_assert_file = 0;
3867
int g_assert_line = 0;
3968
const char *g_assert_func = 0;

0 commit comments

Comments
 (0)