MCPcopy Create free account
hub / github.com/ceph/ceph / init

Method init

src/librbd/api/Config.cc:83–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81 }
82
83 int init() {
84 CephContext *cct = (CephContext *)m_io_ctx.cct();
85
86 for (auto& [k,v] : *this) {
87 int r = cct->_conf.get_val(k, &v.first);
88 ceph_assert(r == 0);
89 v.second = RBD_CONFIG_SOURCE_CONFIG;
90 }
91
92 std::string last_key = ImageCtx::METADATA_CONF_PREFIX;
93 bool more_results = true;
94
95 while (more_results) {
96 std::map<std::string, bufferlist> pairs;
97
98 int r = librbd::api::PoolMetadata<>::list(m_io_ctx, last_key, MAX_KEYS,
99 &pairs);
100 if (r < 0) {
101 return r;
102 }
103
104 if (pairs.empty()) {
105 break;
106 }
107
108 more_results = (pairs.size() == MAX_KEYS);
109 last_key = pairs.rbegin()->first;
110
111 for (auto kv : pairs) {
112 std::string key;
113 if (!util::is_metadata_config_override(kv.first, &key)) {
114 more_results = false;
115 break;
116 }
117 auto it = find(key);
118 if (it != end()) {
119 it->second = {{kv.second.c_str(), kv.second.length()},
120 RBD_CONFIG_SOURCE_POOL};
121 }
122 }
123 }
124 return 0;
125 }
126};
127
128} // anonymous namespace

Callers 2

listMethod · 0.45
apply_pool_overridesMethod · 0.45

Calls 11

findFunction · 0.85
listFunction · 0.50
endFunction · 0.50
cctMethod · 0.45
get_valMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
rbeginMethod · 0.45
c_strMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected