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

Method _setxattr_check_data_pool

src/client/Client.cc:15256–15294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15254}
15255
15256int Client::_setxattr_check_data_pool(string& name, string& value, const OSDMap *osdmap)
15257{
15258 string tmp;
15259 if (name == "layout") {
15260 string::iterator begin = value.begin();
15261 string::iterator end = value.end();
15262 keys_and_values<string::iterator> p; // create instance of parser
15263 std::map<string, string> m; // map to receive results
15264 if (!qi::parse(begin, end, p, m)) { // returns true if successful
15265 return -EINVAL;
15266 }
15267 if (begin != end)
15268 return -EINVAL;
15269 for (map<string,string>::iterator q = m.begin(); q != m.end(); ++q) {
15270 if (q->first == "pool") {
15271 tmp = q->second;
15272 break;
15273 }
15274 }
15275 } else if (name == "layout.pool") {
15276 tmp = value;
15277 }
15278
15279 if (tmp.length()) {
15280 int64_t pool;
15281 try {
15282 pool = boost::lexical_cast<unsigned>(tmp);
15283 if (!osdmap->have_pg_pool(pool))
15284 return -ENOENT;
15285 } catch (boost::bad_lexical_cast const&) {
15286 pool = osdmap->lookup_pg_pool_name(tmp);
15287 if (pool < 0) {
15288 return -ENOENT;
15289 }
15290 }
15291 }
15292
15293 return 0;
15294}
15295
15296void Client::_setxattr_maybe_wait_for_osdmap(const char *name, const void *value, size_t size)
15297{

Callers

nothing calls this directly

Calls 6

have_pg_poolMethod · 0.80
lookup_pg_pool_nameMethod · 0.80
parseFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected