From: Mykola Golub Date: Fri, 11 Sep 2015 18:34:52 +0000 (+0300) Subject: osd: make 'ceph osd pool get' work for all settable pool flags X-Git-Tag: v9.1.0~90^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b97ae7660e9140e81278d1a37dd7e608da7fd829;p=ceph.git osd: make 'ceph osd pool get' work for all settable pool flags Signed-off-by: Mykola Golub --- diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index b515a3ccaec9..4f9a7ab6d15e 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -1357,9 +1357,13 @@ function test_mon_osd_pool_set() for flag in hashpspool nodelete nopgchange nosizechange write_fadvise_dontneed; do ceph osd pool set $TEST_POOL_GETSET $flag false + ceph osd pool get $TEST_POOL_GETSET $flag | grep "$flag: false" ceph osd pool set $TEST_POOL_GETSET $flag true + ceph osd pool get $TEST_POOL_GETSET $flag | grep "$flag: true" ceph osd pool set $TEST_POOL_GETSET $flag 1 + ceph osd pool get $TEST_POOL_GETSET $flag | grep "$flag: true" ceph osd pool set $TEST_POOL_GETSET $flag 0 + ceph osd pool get $TEST_POOL_GETSET $flag | grep "$flag: false" expect_false ceph osd pool set $TEST_POOL_GETSET $flag asdf expect_false ceph osd pool set $TEST_POOL_GETSET $flag 2 done diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 80f8c6b7e289..a87136b1201c 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -674,7 +674,7 @@ COMMAND("osd pool rename " \ "rename to ", "osd", "rw", "cli,rest") COMMAND("osd pool get " \ "name=pool,type=CephPoolname " \ - "name=var,type=CephChoices,strings=size|min_size|crash_replay_interval|pg_num|pgp_num|crush_ruleset|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|auid|target_max_objects|target_max_bytes|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|erasure_code_profile|min_read_recency_for_promote|write_fadvise_dontneed|all|min_write_recency_for_promote|fast_read", \ + "name=var,type=CephChoices,strings=size|min_size|crash_replay_interval|pg_num|pgp_num|crush_ruleset|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|auid|target_max_objects|target_max_bytes|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|erasure_code_profile|min_read_recency_for_promote|all|min_write_recency_for_promote|fast_read", \ "get pool parameter ", "osd", "r", "cli,rest") COMMAND("osd pool set " \ "name=pool,type=CephPoolname " \ diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 1a09c6ed0f00..7779ea623dd3 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -2874,15 +2874,16 @@ void OSDMonitor::dump_info(Formatter *f) namespace { enum osd_pool_get_choices { SIZE, MIN_SIZE, CRASH_REPLAY_INTERVAL, - PG_NUM, PGP_NUM, CRUSH_RULESET, HIT_SET_TYPE, + PG_NUM, PGP_NUM, CRUSH_RULESET, HASHPSPOOL, + NODELETE, NOPGCHANGE, NOSIZECHANGE, + WRITE_FADVISE_DONTNEED, HIT_SET_TYPE, HIT_SET_PERIOD, HIT_SET_COUNT, HIT_SET_FPP, USE_GMT_HITSET, AUID, TARGET_MAX_OBJECTS, TARGET_MAX_BYTES, CACHE_TARGET_DIRTY_RATIO, CACHE_TARGET_DIRTY_HIGH_RATIO, CACHE_TARGET_FULL_RATIO, CACHE_MIN_FLUSH_AGE, CACHE_MIN_EVICT_AGE, ERASURE_CODE_PROFILE, MIN_READ_RECENCY_FOR_PROMOTE, - WRITE_FADVISE_DONTNEED, MIN_WRITE_RECENCY_FOR_PROMOTE, - FAST_READ}; + MIN_WRITE_RECENCY_FOR_PROMOTE, FAST_READ}; std::set subtract_second_from_first(const std::set& first, @@ -3339,6 +3340,9 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op) ("min_size", MIN_SIZE) ("crash_replay_interval", CRASH_REPLAY_INTERVAL) ("pg_num", PG_NUM)("pgp_num", PGP_NUM)("crush_ruleset", CRUSH_RULESET) + ("hashpspool", HASHPSPOOL)("nodelete", NODELETE) + ("nopgchange", NOPGCHANGE)("nosizechange", NOSIZECHANGE) + ("write_fadvise_dontneed", WRITE_FADVISE_DONTNEED) ("hit_set_type", HIT_SET_TYPE)("hit_set_period", HIT_SET_PERIOD) ("hit_set_count", HIT_SET_COUNT)("hit_set_fpp", HIT_SET_FPP) ("use_gmt_hitset", USE_GMT_HITSET) @@ -3351,7 +3355,6 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op) ("cache_min_evict_age", CACHE_MIN_EVICT_AGE) ("erasure_code_profile", ERASURE_CODE_PROFILE) ("min_read_recency_for_promote", MIN_READ_RECENCY_FOR_PROMOTE) - ("write_fadvise_dontneed", WRITE_FADVISE_DONTNEED) ("min_write_recency_for_promote", MIN_WRITE_RECENCY_FOR_PROMOTE) ("fast_read", FAST_READ); @@ -3409,6 +3412,7 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op) if (f) { for(choices_set_t::const_iterator it = selected_choices.begin(); it != selected_choices.end(); ++it) { + choices_map_t::const_iterator i; f->open_object_section("pool"); f->dump_string("pool", poolstr); f->dump_int("pool_id", pool); @@ -3435,6 +3439,20 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op) case CRUSH_RULESET: f->dump_int("crush_ruleset", p->get_crush_ruleset()); break; + case HASHPSPOOL: + case NODELETE: + case NOPGCHANGE: + case NOSIZECHANGE: + case WRITE_FADVISE_DONTNEED: + for (i = ALL_CHOICES.begin(); i != ALL_CHOICES.end(); ++i) { + if (i->second == *it) + break; + } + assert(i != ALL_CHOICES.end()); + f->dump_string(i->first.c_str(), + p->has_flag(pg_pool_t::get_flag_by_name(i->first)) ? + "true" : "false"); + break; case HIT_SET_PERIOD: f->dump_int("hit_set_period", p->hit_set_period); break; @@ -3500,11 +3518,6 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op) f->dump_int("min_read_recency_for_promote", p->min_read_recency_for_promote); break; - case WRITE_FADVISE_DONTNEED: - f->dump_string("write_fadvise_dontneed", - p->has_flag(pg_pool_t::FLAG_WRITE_FADVISE_DONTNEED) ? - "true" : "false"); - break; case MIN_WRITE_RECENCY_FOR_PROMOTE: f->dump_int("min_write_recency_for_promote", p->min_write_recency_for_promote); @@ -3520,6 +3533,7 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op) } else /* !f */ { for(choices_set_t::const_iterator it = selected_choices.begin(); it != selected_choices.end(); ++it) { + choices_map_t::const_iterator i; switch(*it) { case PG_NUM: ss << "pg_num: " << p->get_pg_num() << "\n"; @@ -3601,9 +3615,18 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op) ss << "min_read_recency_for_promote: " << p->min_read_recency_for_promote << "\n"; break; + case HASHPSPOOL: + case NODELETE: + case NOPGCHANGE: + case NOSIZECHANGE: case WRITE_FADVISE_DONTNEED: - ss << "write_fadvise_dontneed: " << - (p->has_flag(pg_pool_t::FLAG_WRITE_FADVISE_DONTNEED) ? + for (i = ALL_CHOICES.begin(); i != ALL_CHOICES.end(); ++i) { + if (i->second == *it) + break; + } + assert(i != ALL_CHOICES.end()); + ss << i->first << ": " << + (p->has_flag(pg_pool_t::get_flag_by_name(i->first)) ? "true" : "false") << "\n"; break; case MIN_WRITE_RECENCY_FOR_PROMOTE: