From: Rubab-Syed Date: Mon, 22 Jan 2018 02:54:11 +0000 (+0500) Subject: mgr/dashboard: add configuration setting browser X-Git-Tag: v12.2.8~18^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=148f6b0445ade0a771a8ffbecf72dba345a70f3d;p=ceph.git mgr/dashboard: add configuration setting browser Signed-off-by: Rubab Syed (cherry picked from commit 14bb815060a4d156bb5f7cc5d66e77466cba4351) Signed-off-by: Ernesto Puerta Conflicts: src/pybind/mgr/dashboard/base.html src/pybind/mgr/dashboard/monitors.html src/pybind/mgr/dashboard/osd_perf.html src/pybind/mgr/dashboard/rgw_detail.html Conflict resolution: - Keep config references while removing references to new monitor and rgw endpoints and pages. --- diff --git a/src/common/config.cc b/src/common/config.cc index 3cbb27e3484c..88e3da9b50aa 100644 --- a/src/common/config.cc +++ b/src/common/config.cc @@ -391,6 +391,17 @@ void md_config_t::show_config(Formatter *f) _show_config(NULL, f); } +void md_config_t::config_options(Formatter *f) +{ + Mutex::Locker l(lock); + f->open_array_section("options"); + for (const auto& i: schema) { + const Option &opt = i.second; + opt.dump(f); + } + f->close_section(); +} + void md_config_t::_show_config(std::ostream *out, Formatter *f) { if (out) { diff --git a/src/common/config.h b/src/common/config.h index 1e573f5e11b2..612f083d89cf 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -180,6 +180,9 @@ public: void show_config(std::ostream& out); /// dump all config values to a formatter void show_config(Formatter *f); + + /// dump all config settings to a formatter + void config_options(Formatter *f); /// obtain a diff between our config values and another md_config_t values void diff(const md_config_t *other, diff --git a/src/mgr/ActivePyModules.cc b/src/mgr/ActivePyModules.cc index 0694d23082e4..a7f5839ba857 100644 --- a/src/mgr/ActivePyModules.cc +++ b/src/mgr/ActivePyModules.cc @@ -187,9 +187,13 @@ PyObject *ActivePyModules::get_python(const std::string &what) } }); return f.get(); - } else if (what == "config") { + } else if (what.substr(0, 6) == "config") { PyFormatter f; - g_conf->show_config(&f); + if (what == "config_options") { + g_conf->config_options(&f); + } else if (what == "config") { + g_conf->show_config(&f); + } return f.get(); } else if (what == "mon_map") { PyFormatter f; diff --git a/src/pybind/mgr/dashboard/base.html b/src/pybind/mgr/dashboard/base.html index 9936eaeca379..6debffa5ce74 100644 --- a/src/pybind/mgr/dashboard/base.html +++ b/src/pybind/mgr/dashboard/base.html @@ -347,7 +347,7 @@ Cluster health -
  • +
  • Cluster @@ -360,6 +360,9 @@
  • OSDs
  • +
  • + Configuration +
  • diff --git a/src/pybind/mgr/dashboard/config_options.html b/src/pybind/mgr/dashboard/config_options.html new file mode 100644 index 000000000000..e8367a0722dc --- /dev/null +++ b/src/pybind/mgr/dashboard/config_options.html @@ -0,0 +1,120 @@ + +{% extends "base.html" %} + +{% block content %} + + + + + +
    +

    + Configuration Options +
    + + + + +
    +

    +
    + + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameDescriptionLong descriptionTypeLevelDefaultDaemon defaultTagsServicesSee_alsoMaxMin
    {opt.name}
    {opt.desc}
    {opt.long_desc}
    {opt.type}
    {opt.level}
    {opt.default}
    {opt.daemon_default}
    + + {opt.max}{opt.min}
    +
    +
    +
    + + +{% endblock %} diff --git a/src/pybind/mgr/dashboard/module.py b/src/pybind/mgr/dashboard/module.py index 3d5e3191aa65..abe8f19450ef 100644 --- a/src/pybind/mgr/dashboard/module.py +++ b/src/pybind/mgr/dashboard/module.py @@ -750,6 +750,28 @@ class Module(MgrModule): toplevel_data=json.dumps(self._toplevel_data(), indent=2), content_data=json.dumps(self._servers(), indent=2) ) + + @cherrypy.expose + def config_options(self, service="any"): + template = env.get_template("config_options.html") + return template.render( + url_prefix = global_instance().url_prefix, + ceph_version=global_instance().version, + path_info=cherrypy.request.path_info, + toplevel_data=json.dumps(self._toplevel_data(), indent=2), + content_data=json.dumps(self.config_options_data(service), indent=2) + ) + + @cherrypy.expose + @cherrypy.tools.json_out() + def config_options_data(self, service): + options = {} + options = global_instance().get("config_options") + + return { + 'options': options, + 'service': service, + } def _servers(self): return { diff --git a/src/pybind/mgr/dashboard/osd_perf.html b/src/pybind/mgr/dashboard/osd_perf.html index b13ad17e1fd7..0ebe3d089438 100644 --- a/src/pybind/mgr/dashboard/osd_perf.html +++ b/src/pybind/mgr/dashboard/osd_perf.html @@ -116,6 +116,7 @@

    osd.{osd.osd} +