]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: fix typo in variable name and cleanups 22069/head
authorKefu Chai <kchai@redhat.com>
Thu, 17 May 2018 16:36:41 +0000 (00:36 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 17 May 2018 16:36:43 +0000 (00:36 +0800)
* s/sercive/service/
* also fix the logging message. before this change, we have

send_report send_report osd,2.0x557ea1c16550 sent me an unknown health
metric:

after this change,

send_report send_report osd.2 sent me an unknown health metric: 0x01

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/mgr/DaemonServer.cc

index bacb485a210944adb99a2182e9ffd49a688fefa4..156c431cd1675b592c389920d81ee1249c04fe73 100644 (file)
@@ -1826,26 +1826,26 @@ void DaemonServer::send_report()
     });
 
   map<daemon_metric, unique_ptr<DaemonHealthMetricCollector>> accumulated;
-  for (auto sercive : {"osd", "mon"} ) {
-    auto daemons = daemon_state.get_by_service(sercive);
-    for (const auto& daemon : daemons) {
-      Mutex::Locker l(daemon.second->lock);
-      for (const auto& metric : daemon.second->daemon_health_metrics) {
+  for (auto service : {"osd", "mon"} ) {
+    auto daemons = daemon_state.get_by_service(service);
+    for (const auto& [key,state] : daemons) {
+      Mutex::Locker l{state->lock};
+      for (const auto& metric : state->daemon_health_metrics) {
         auto acc = accumulated.find(metric.get_type());
         if (acc == accumulated.end()) {
           auto collector = DaemonHealthMetricCollector::create(metric.get_type());
           if (!collector) {
-            derr << __func__ << " " << daemon.first << "." << daemon.second
-              << " sent me an unknown health metric: "
-              << static_cast<uint8_t>(metric.get_type()) << dendl;
+            derr << __func__ << " " << key.first << "." << key.second
+                << " sent me an unknown health metric: "
+                << hex << static_cast<uint8_t>(metric.get_type()) << dendl;
             continue;
           }
-         dout(20) << " + " << daemon.second->key << " "
+         dout(20) << " + " << state->key << " "
                   << metric << dendl;
           tie(acc, std::ignore) = accumulated.emplace(metric.get_type(),
               std::move(collector));
         }
-        acc->second->update(daemon.first, metric);
+        acc->second->update(key, metric);
       }
     }
   }