From: Ma Jianpeng Date: Thu, 17 Jul 2014 00:48:34 +0000 (-0700) Subject: mon: OSDMonitor: add "osd pool get erasure_code_profile" command X-Git-Tag: v0.84~98 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e8ebcb79a462de29bcbabe40ac855634753bb2be;p=ceph.git mon: OSDMonitor: add "osd pool get erasure_code_profile" command Enable us to obtain the erasure-code-profile for a given erasure-pool. Signed-off-by: Ma Jianpeng Signed-off-by: Sage Weil --- diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index f429e0ff59ef..627546b4f050 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -571,7 +571,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_full_ratio|cache_min_flush_age|cache_min_evict_age", \ + "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_full_ratio|cache_min_flush_age|cache_min_evict_age|erasure_code_profile", \ "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 c60d74411050..136e71906a6b 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -2483,6 +2483,13 @@ bool OSDMonitor::preprocess_command(MMonCommand *m) goto reply; } + if (!p->is_erasure() && var == "erasure_code_profile") { + ss << "pool '" << poolstr + << "' is not a erasure pool: variable not applicable"; + r = -EACCES; + goto reply; + } + if (f) { f->open_object_section("pool"); f->dump_string("pool", poolstr); @@ -2536,6 +2543,8 @@ bool OSDMonitor::preprocess_command(MMonCommand *m) f->dump_unsigned("cache_min_flush_age", p->cache_min_flush_age); } else if (var == "cache_min_evict_age") { f->dump_unsigned("cache_min_evict_age", p->cache_min_evict_age); + } else if (var == "erasure_code_profile") { + f->dump_string("erasure_code_profile", p->erasure_code_profile); } f->close_section(); @@ -2583,6 +2592,8 @@ bool OSDMonitor::preprocess_command(MMonCommand *m) ss << "cache_min_flush_age: " << p->cache_min_flush_age; } else if (var == "cache_min_evict_age") { ss << "cache_min_evict_age: " << p->cache_min_evict_age; + } else if (var == "erasure_code_profile") { + ss << "erasure_code_profile: " << p->erasure_code_profile; } rdata.append(ss);