| 15254 | } |
| 15255 | |
| 15256 | int 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 | |
| 15296 | void Client::_setxattr_maybe_wait_for_osdmap(const char *name, const void *value, size_t size) |
| 15297 | { |
nothing calls this directly
no test coverage detected