]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/options: separate "service" from "tags"
authorJohn Spray <john.spray@redhat.com>
Wed, 12 Jul 2017 23:22:25 +0000 (19:22 -0400)
committerJohn Spray <john.spray@redhat.com>
Fri, 21 Jul 2017 10:27:27 +0000 (06:27 -0400)
Signed-off-by: John Spray <john.spray@redhat.com>
src/common/options.cc
src/common/options.h

index 5255a66a8ed40489e1711c2915333caf5dda9ace..a930f362cd3ef016eb2b25e1ccc073068dc3da13 100644 (file)
@@ -55,6 +55,12 @@ void Option::dump(Formatter *f) const
   }
   f->close_section();
 
+  f->open_array_section("services");
+  for (const auto s : services) {
+    f->dump_string("service", s);
+  }
+  f->close_section();
+
   f->open_array_section("see_also");
   for (const auto sa : see_also) {
     f->dump_string("see_also", sa);
@@ -82,33 +88,41 @@ const std::vector<Option> ceph_options = {
   Option("host", Option::TYPE_STR, Option::LEVEL_BASIC)
   .set_description("local hostname")
   .set_long_description("if blank, ceph assumes the short hostname (hostname -s)")
-  .add_tag("common"),
+  .add_service("common")
+  .add_tag("network"),
 
   Option("fsid", Option::TYPE_UUID, Option::LEVEL_BASIC)
   .set_description("cluster fsid (uuid)")
-  .add_tag("common"),
+  .add_service("common")
+  .add_tag("service"),
 
   Option("public_addr", Option::TYPE_ADDR, Option::LEVEL_BASIC)
   .set_description("public-facing address to bind to")
-  .add_tag("mon mds osd mgr"),
+  .add_service("mon mds osd mgr"),
 
   Option("cluster_addr", Option::TYPE_ADDR, Option::LEVEL_BASIC)
   .set_description("cluster-facing address to bind to")
-  .add_tag("osd"),
+  .add_service("osd")
+  .add_tag("network"),
 
   Option("public_network", Option::TYPE_ADDR, Option::LEVEL_ADVANCED)
   .set_default("")
+  .add_service("mon mds osd mgr")
+  .add_tag("network")
   .set_description(""),
 
   Option("cluster_network", Option::TYPE_STR, Option::LEVEL_ADVANCED)
   .set_default("")
+  .add_service("osd")
+  .add_tag("network")
   .set_description(""),
 
   Option("monmap", Option::TYPE_STR, Option::LEVEL_ADVANCED)
   .set_description("path to MonMap file")
   .set_long_description("This option is normally used during mkfs, but can also "
                        "be used to identify which monitors to connect to.")
-  .add_tag("mon").add_tag("mkfs"),
+  .add_service("mon")
+  .add_tag("mkfs"),
 
   Option("mon_host", Option::TYPE_STR, Option::LEVEL_BASIC)
   .set_description("list of hosts or addresses to search for a monitor")
@@ -116,83 +130,91 @@ const std::vector<Option> ceph_options = {
                        "list of IP addresses or hostnames. Hostnames are "
                        "resolved via DNS and all A or AAAA records are "
                        "included in the search list.")
-  .add_tag("common"),
+  .add_service("common"),
 
   Option("mon_dns_srv_name", Option::TYPE_STR, Option::LEVEL_ADVANCED)
   .set_description("name of DNS SRV record to check for monitor addresses")
-  .add_tag("common")
+  .add_service("common")
+  .add_tag("network")
   .add_see_also("mon_host"),
 
   // lockdep
   Option("lockdep", Option::TYPE_BOOL, Option::LEVEL_DEV)
   .set_description("enable lockdep lock dependency analyzer")
-  .add_tag("common"),
+  .add_service("common"),
 
   Option("lockdep_force_backtrace", Option::TYPE_BOOL, Option::LEVEL_DEV)
   .set_description("always gather current backtrace at every lock")
-  .add_tag("common")
+  .add_service("common")
   .add_see_also("lockdep"),
 
   Option("run_dir", Option::TYPE_STR, Option::LEVEL_ADVANCED)
   .set_daemon_default("/var/run/ceph")
   .set_description("path for the 'run' directory for storing pid and socket files")
-  .add_tag("common")
+  .add_service("common")
   .add_see_also("admin_socket"),
 
   Option("admin_socket", Option::TYPE_STR, Option::LEVEL_ADVANCED)
   .set_daemon_default("$run_dir/$cluster-$name.asok")
   .set_description("path for the runtime control socket file, used by the 'ceph daemon' command")
-  .add_tag("common"),
+  .add_service("common"),
 
   Option("admin_socket_mode", Option::TYPE_STR, Option::LEVEL_ADVANCED)
   .set_description("file mode to set for the admin socket file, e.g, '0755'")
-  .add_tag("common")
+  .add_service("common")
   .add_see_also("admin_socket"),
 
   Option("crushtool", Option::TYPE_STR, Option::LEVEL_ADVANCED)
   .set_description("name of the 'crushtool' utility")
-  .add_tag("mon"),
+  .add_service("mon"),
 
   // daemon
   Option("daemonize", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
   .set_default(false)
   .set_daemon_default(true)
   .set_description("whether to daemonize (background) after startup")
-  .add_tag("daemon")
+  .add_service("mon mgr osd mds")
+  .add_tag("service")
   .add_see_also("pid_file").add_see_also("chdir"),
 
   Option("setuser", Option::TYPE_STR, Option::LEVEL_ADVANCED)
   .set_description("uid or user name to switch to on startup")
   .set_long_description("This is normally specified by the systemd unit file.")
-  .add_tag("daemon")
+  .add_service("mon mgr osd mds")
+  .add_tag("service")
   .add_see_also("setgroup"),
 
   Option("setgroup", Option::TYPE_STR, Option::LEVEL_ADVANCED)
   .set_description("gid or group name to switch to on startup")
   .set_long_description("This is normally specified by the systemd unit file.")
-  .add_tag("daemon")
+  .add_service("mon mgr osd mds")
+  .add_tag("service")
   .add_see_also("setuser"),
 
   Option("setuser_match_path", Option::TYPE_STR, Option::LEVEL_ADVANCED)
   .set_description("if set, setuser/setgroup is condition on this path matching ownership")
   .set_long_description("If setuser or setgroup are specified, and this option is non-empty, then the uid/gid of the daemon will only be changed if the file or directory specified by this option has a matching uid and/or gid.  This exists primarily to allow switching to user ceph for OSDs to be conditional on whether the osd data contents have also been chowned after an upgrade.  This is normally specified by the systemd unit file.")
-  .add_tag("daemon").add_tag("osd")
+  .add_service("mon mgr osd mds")
+  .add_tag("service")
   .add_see_also("setuser").add_see_also("setgroup"),
 
   Option("pid_file", Option::TYPE_STR, Option::LEVEL_ADVANCED)
   .set_description("path to write a pid file (if any)")
-  .add_tag("daemon"),
+  .add_service("mon mgr osd mds")
+  .add_tag("service"),
 
   Option("chdir", Option::TYPE_STR, Option::LEVEL_ADVANCED)
   .set_description("path to chdir(2) to after daemonizing")
-  .add_tag("daemon")
+  .add_service("mon mgr osd mds")
+  .add_tag("service")
   .add_see_also("daemonize"),
 
   Option("fatal_signal_handlers", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
   .set_default(true)
   .set_description("whether to register signal handlers for SIGABRT etc that dump a stack trace")
   .set_long_description("This is normally true for daemons and values for libraries.")
-  .add_tag("daemon"),
+  .add_service("mon mgr osd mds")
+  .add_tag("service"),
 
   // restapi
   Option("restapi_log_level", Option::TYPE_STR, Option::LEVEL_ADVANCED)
@@ -206,8 +228,7 @@ const std::vector<Option> ceph_options = {
   Option("erasure_code_dir", Option::TYPE_STR, Option::LEVEL_ADVANCED)
   .set_default(CEPH_PKGLIBDIR"/erasure-code")
   .set_description("directory where erasure-code plugins can be found")
-  .add_tag("mon").add_tag("osd"),
-
+  .add_service("mon osd"),
 
   // logging
   Option("log_file", Option::TYPE_STR, Option::LEVEL_BASIC)
index 95fc2ad94cf89557587c1a942d4bed3272cdb285..b3f9b331218fc5563492e45f4bac957246133115 100644 (file)
@@ -6,6 +6,7 @@
 #include <string>
 #include <list>
 #include <boost/variant.hpp>
+#include "include/str_list.h"
 #include "msg/msg_types.h"
 #include "include/uuid.h"
 
@@ -33,6 +34,11 @@ struct Option {
     }
   }
 
+  /**
+   * Basic: for users, configures some externally visible functional aspect
+   * Advanced: for users, configures some internal behaviour
+   * Development: not for users.  May be dangerous, may not be documented.
+   */
   enum level_t {
     LEVEL_BASIC,
     LEVEL_ADVANCED,
@@ -67,7 +73,21 @@ struct Option {
   value_t value;
   value_t daemon_value;
 
+  // Items like mon, osd, rgw, rbd, ceph-fuse.  This is advisory metadata
+  // for presentation layers (like web dashboards, or generated docs), so that
+  // they know which options to display where.
+  // Additionally: "common" for settings that exist in any Ceph code.  Do
+  // not use common for settings that are just shared some places: for those
+  // places, list them.
+  std::list<std::string> services;
+
+  // Topics like:
+  // "service": a catchall for the boring stuff like log/asok paths.
+  // "network"
+  // "performance": a setting that may need adjustment depending on
+  //                environment/workload to get best performance.
   std::list<std::string> tags;
+
   std::list<std::string> see_also;
 
   value_t min, max;
@@ -161,8 +181,16 @@ struct Option {
   Option& set_daemon_default(const T& v) {
     return set_value(daemon_value, v);
   }
-  Option& add_tag(const char* t) {
-    tags.push_back(t);
+  Option& add_tag(const char* tags_str) {
+    for (const auto t: get_str_vec(tags_str)) {
+      tags.push_back(t);
+    }
+    return *this;
+  }
+  Option& add_service(const char* services_str) {
+    for (const auto s: get_str_vec(services_str)) {
+      services.push_back(s);
+    }
     return *this;
   }
   Option& add_see_also(const char* t) {