]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: add operator<< to OSDState
authorKefu Chai <kchai@redhat.com>
Wed, 23 Jan 2019 09:54:24 +0000 (17:54 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 29 Jan 2019 11:32:59 +0000 (19:32 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/osd.cc
src/crimson/osd/state.h

index a0e8a2cb7734e9b0e1e689982a178d354ddc993d..d5619f87a519e5d332d40097a6b5731050a0421a 100644 (file)
@@ -437,7 +437,7 @@ seastar::future<> OSD::committed_osd_maps(version_t first,
         return start_boot();
       }
     } else {
-      logger().info("osd.{}: now ???", whoami);
+      logger().info("osd.{}: now {}", whoami, state);
       // XXX
       return seastar::now();
     }
index 2afd7b00060808aa878a15dd889d60b9414ced74..4c445348d301216962dcd5350a96868a040dd181 100644 (file)
@@ -3,6 +3,9 @@
 
 #pragma once
 
+#include <string_view>
+#include <ostream>
+
 class OSDMap;
 
 class OSDState {
@@ -49,7 +52,7 @@ public:
   void set_stopping() {
     state = State::STOPPING;
   }
-  const char* print() {
+  std::string_view to_string() const {
     switch (state) {
     case State::INITIALIZING: return "initializing";
     case State::PREBOOT: return "preboot";
@@ -61,3 +64,8 @@ public:
     }
   }
 };
+
+inline std::ostream&
+operator<<(std::ostream& os, const OSDState& s) {
+  return os << s.to_string();
+}