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

Method prepare_command_pool_set

src/mon/OSDMonitor.cc:8595–9466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8593}
8594
8595int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
8596 stringstream& ss)
8597{
8598 string poolstr;
8599 cmd_getval(cmdmap, "pool", poolstr);
8600 int64_t pool = osdmap.lookup_pg_pool_name(poolstr.c_str());
8601 if (pool < 0) {
8602 ss << "unrecognized pool '" << poolstr << "'";
8603 return -ENOENT;
8604 }
8605 string var;
8606 cmd_getval(cmdmap, "var", var);
8607
8608 pg_pool_t p = *osdmap.get_pg_pool(pool);
8609 if (pending_inc.new_pools.count(pool))
8610 p = pending_inc.new_pools[pool];
8611
8612 // accept val as a json string in the normal case (current
8613 // generation monitor). parse out int or float values from the
8614 // string as needed. however, if it is not a string, try to pull
8615 // out an int, in case an older monitor with an older json schema is
8616 // forwarding a request.
8617 string val;
8618 string interr, floaterr;
8619 int64_t n = 0;
8620 double f = 0;
8621 int64_t uf = 0; // micro-f
8622 cmd_getval(cmdmap, "val", val);
8623
8624 auto si_options = {
8625 "target_max_objects"
8626 };
8627 auto iec_options = {
8628 "target_max_bytes",
8629 "target_size_bytes",
8630 "compression_max_blob_size",
8631 "compression_min_blob_size",
8632 "csum_max_block",
8633 "csum_min_block",
8634 };
8635 if (count(begin(si_options), end(si_options), var)) {
8636 n = strict_si_cast<int64_t>(val, &interr);
8637 } else if (count(begin(iec_options), end(iec_options), var)) {
8638 n = strict_iec_cast<int64_t>(val, &interr);
8639 } else {
8640 // parse string as both int and float; different fields use different types.
8641 n = strict_strtoll(val.c_str(), 10, &interr);
8642 f = strict_strtod(val.c_str(), &floaterr);
8643 uf = llrintl(f * (double)1000000.0);
8644 }
8645
8646 if (!p.is_tier() &&
8647 (var == "hit_set_type" || var == "hit_set_period" ||
8648 var == "hit_set_count" || var == "hit_set_fpp" ||
8649 var == "target_max_objects" || var == "target_max_bytes" ||
8650 var == "cache_target_full_ratio" || var == "cache_target_dirty_ratio" ||
8651 var == "cache_target_dirty_high_ratio" || var == "use_gmt_hitset" ||
8652 var == "cache_min_flush_age" || var == "cache_min_evict_age" ||

Callers

nothing calls this directly

Calls 15

strict_strtollFunction · 0.85
strict_strtodFunction · 0.85
cpp_strerrorFunction · 0.85
lookup_pg_pool_nameMethod · 0.80
get_pg_poolMethod · 0.80
is_tierMethod · 0.80
is_replicatedMethod · 0.80
get_pg_num_pendingMethod · 0.80
set_pg_numMethod · 0.80
get_pgp_numMethod · 0.80
set_pg_num_pendingMethod · 0.80

Tested by

no test coverage detected