]>
Commit | Line | Data |
---|---|---|
11fdf7f2 | 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
9f95a23c | 2 | // vim: ts=8 sw=2 smarttab |
11fdf7f2 TL |
3 | |
4 | #include "config_proxy.h" | |
5 | ||
9f95a23c | 6 | namespace crimson::common { |
11fdf7f2 TL |
7 | |
8 | ConfigProxy::ConfigProxy(const EntityName& name, std::string_view cluster) | |
9 | { | |
10 | if (seastar::engine().cpu_id() != 0) { | |
11 | return; | |
12 | } | |
13 | // set the initial value on CPU#0 | |
14 | values.reset(seastar::make_lw_shared<ConfigValues>()); | |
15 | values.get()->name = name; | |
16 | values.get()->cluster = cluster; | |
17 | // and the only copy of md_config_impl<> is allocated on CPU#0 | |
18 | local_config.reset(new md_config_t{*values, obs_mgr, true}); | |
19 | if (name.is_mds()) { | |
20 | local_config->set_val_default(*values, obs_mgr, | |
21 | "keyring", "$mds_data/keyring"); | |
22 | } else if (name.is_osd()) { | |
23 | local_config->set_val_default(*values, obs_mgr, | |
24 | "keyring", "$osd_data/keyring"); | |
25 | } | |
26 | } | |
27 | ||
28 | seastar::future<> ConfigProxy::start() | |
29 | { | |
30 | // populate values and config to all other shards | |
31 | if (!values) { | |
32 | return seastar::make_ready_future<>(); | |
33 | } | |
34 | return container().invoke_on_others([this](auto& proxy) { | |
35 | return values.copy().then([config=local_config.get(), | |
36 | &proxy](auto foreign_values) { | |
37 | proxy.values.reset(); | |
38 | proxy.values = std::move(foreign_values); | |
39 | proxy.remote_config = config; | |
40 | return seastar::make_ready_future<>(); | |
41 | }); | |
42 | }); | |
43 | } | |
44 | ||
9f95a23c TL |
45 | void ConfigProxy::show_config(ceph::Formatter* f) const { |
46 | get_config().show_config(*values, f); | |
47 | } | |
48 | ||
11fdf7f2 TL |
49 | ConfigProxy::ShardedConfig ConfigProxy::sharded_conf; |
50 | } |