]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/mon/ConfigMonitor.cc
import quincy beta 17.1.0
[ceph.git] / ceph / src / mon / ConfigMonitor.cc
index 7f0ee21e67155f723c6f28f479581c10897d636e..39aa9f9b17737fea8ef9690b90f9238e5683b5a0 100644 (file)
@@ -168,17 +168,6 @@ bool ConfigMonitor::preprocess_query(MonOpRequestRef op)
   return false;
 }
 
-static string indent_who(const string& who)
-{
-  if (who == "global") {
-    return who;
-  }
-  if (who.find('.') == string::npos) {
-    return "  " + who;
-  }
-  return "    " + who;
-}
-
 bool ConfigMonitor::preprocess_command(MonOpRequestRef op)
 {
   auto m = op->get_req<MMonCommand>();
@@ -191,8 +180,7 @@ bool ConfigMonitor::preprocess_command(MonOpRequestRef op)
     mon.reply_command(op, -EINVAL, rs, get_last_committed());
     return true;
   }
-  string format;
-  cmd_getval(cmdmap, "format", format, string("plain"));
+  string format = cmd_getval_or<string>(cmdmap, "format", "plain");
   boost::scoped_ptr<Formatter> f(Formatter::create(format));
 
   string prefix;
@@ -278,7 +266,7 @@ bool ConfigMonitor::preprocess_command(MonOpRequestRef op)
     for (auto s : sections) {
       for (auto& i : s.second->options) {
        if (!f) {
-         tbl << indent_who(s.first);
+         tbl << s.first;
          tbl << i.second.mask.to_str();
          tbl << Option::level_to_str(i.second.opt->level);
           tbl << i.first;
@@ -360,7 +348,7 @@ bool ConfigMonitor::preprocess_command(MonOpRequestRef op)
        goto reply;
       }
       if (!entity.is_client() &&
-         !boost::get<boost::blank>(&opt->daemon_value)) {
+         opt->daemon_value != Option::value_t{}) {
        odata.append(Option::to_str(opt->daemon_value));
       } else {
        odata.append(Option::to_str(opt->value));
@@ -599,7 +587,7 @@ bool ConfigMonitor::prepare_command(MonOpRequestRef op)
       bl.append(value);
       pending[key] = bl;
     } else {
-      pending[key] = boost::none;
+      pending[key].reset();
     }
     goto update;
   } else if (prefix == "config reset") {
@@ -626,7 +614,7 @@ bool ConfigMonitor::prepare_command(MonOpRequestRef op)
          bl.append(*i.second.first);
          pending[i.first] = bl;
        } else if (i.second.second) {
-         pending[i.first] = boost::none;
+         pending[i.first].reset();
        }
       }
     }
@@ -810,7 +798,7 @@ void ConfigMonitor::load_config()
       if (p != renamed_pacific.end()) {
        if (mon.monmap->min_mon_release >= ceph_release_t::pacific) {
          // schedule a cleanup
-         pending_cleanup[key] = boost::none;
+         pending_cleanup[key].reset();
          pending_cleanup[who + "/" + p->second] = it->value();
        }
        // continue loading under the new name
@@ -843,18 +831,18 @@ void ConfigMonitor::load_config()
     if (who.size() &&
        !ConfigMap::parse_mask(who, &section_name, &mopt.mask)) {
       derr << __func__ << " invalid mask for key " << key << dendl;
-      pending_cleanup[key] = boost::none;
+      pending_cleanup[key].reset();
     } else if (opt->has_flag(Option::FLAG_NO_MON_UPDATE)) {
       dout(10) << __func__ << " NO_MON_UPDATE option '"
               << name << "' = '" << value << "' for " << name
               << dendl;
-      pending_cleanup[key] = boost::none;
+      pending_cleanup[key].reset();
     } else {
       if (section_name.empty()) {
        // we prefer global/$option instead of just $option
        derr << __func__ << " adding global/ prefix to key '" << key << "'"
             << dendl;
-       pending_cleanup[key] = boost::none;
+       pending_cleanup[key].reset();
        pending_cleanup["global/"s + key] = it->value();
       }
       Section *section = &config_map.global;;