mirror of
https://github.com/ceph/ceph
synced 2025-01-20 01:51:34 +00:00
mgr/pybind: expose erasure code profiles
handles the insights cases that had been using Ceph CLI `erasure-code-profile ls/get` to access the same data. Signed-off-by: Noah Watkins <nwatkins@redhat.com>
This commit is contained in:
parent
3e8ddaf301
commit
b5487abb8b
@ -362,6 +362,13 @@ PyObject *ActivePyModules::get_python(const std::string &what)
|
||||
mgr_map.dump(&f);
|
||||
});
|
||||
return f.get();
|
||||
} else if (what == "ec_profiles") {
|
||||
PyFormatter f;
|
||||
cluster_state.with_osdmap([&f, &what](const OSDMap &osdmap){
|
||||
const auto &profiles = osdmap.get_erasure_code_profiles();
|
||||
osdmap.dump_erasure_code_profiles(profiles, &f);
|
||||
});
|
||||
return f.get();
|
||||
} else {
|
||||
derr << "Python module requested unknown data '" << what << "'" << dendl;
|
||||
Py_RETURN_NONE;
|
||||
|
@ -1128,7 +1128,9 @@ void OSDMap::Incremental::dump(Formatter *f) const
|
||||
}
|
||||
f->close_section();
|
||||
|
||||
f->open_object_section("erasure_code_profiles");
|
||||
OSDMap::dump_erasure_code_profiles(new_erasure_code_profiles, f);
|
||||
f->close_section();
|
||||
f->open_array_section("old_erasure_code_profiles");
|
||||
for (const auto &erasure_code_profile : old_erasure_code_profiles) {
|
||||
f->dump_string("old", erasure_code_profile.c_str());
|
||||
@ -3116,7 +3118,6 @@ void OSDMap::dump_erasure_code_profiles(
|
||||
const mempool::osdmap::map<string,map<string,string>>& profiles,
|
||||
Formatter *f)
|
||||
{
|
||||
f->open_object_section("erasure_code_profiles");
|
||||
for (const auto &profile : profiles) {
|
||||
f->open_object_section(profile.first.c_str());
|
||||
for (const auto &profm : profile.second) {
|
||||
@ -3124,7 +3125,6 @@ void OSDMap::dump_erasure_code_profiles(
|
||||
}
|
||||
f->close_section();
|
||||
}
|
||||
f->close_section();
|
||||
}
|
||||
|
||||
void OSDMap::dump(Formatter *f) const
|
||||
@ -3256,7 +3256,9 @@ void OSDMap::dump(Formatter *f) const
|
||||
}
|
||||
f->close_section();
|
||||
|
||||
f->open_object_section("erasure_code_profiles");
|
||||
dump_erasure_code_profiles(erasure_code_profiles, f);
|
||||
f->close_section();
|
||||
|
||||
f->open_array_section("removed_snaps_queue");
|
||||
for (auto& p : removed_snaps_queue) {
|
||||
|
@ -345,7 +345,7 @@ class MgrModule(ceph_module.BaseMgrModule):
|
||||
:param str data_name: Valid things to fetch are osd_crush_map_text,
|
||||
osd_map, osd_map_tree, osd_map_crush, config, mon_map, fs_map,
|
||||
osd_metadata, pg_summary, io_rate, pg_dump, df, osd_stats,
|
||||
health, mon_status, devices, device <devid>.
|
||||
health, mon_status, devices, device <devid>, ec_profiles.
|
||||
|
||||
Note:
|
||||
All these structures have their own JSON representations: experiment
|
||||
|
@ -131,7 +131,8 @@ class Module(MgrModule):
|
||||
"osd_stats",
|
||||
"health",
|
||||
"mon_status",
|
||||
"mgr_map"
|
||||
"mgr_map",
|
||||
"ec_profiles"
|
||||
]
|
||||
for obj in objects:
|
||||
self.get(obj)
|
||||
|
Loading…
Reference in New Issue
Block a user