From 05a262d5aa9af8bb89cd91eb79c7fbd0ff532df1 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 23 Jan 2019 17:54:24 +0800 Subject: [PATCH] crimson/osd: add operator<< to OSDState Signed-off-by: Kefu Chai --- src/crimson/osd/osd.cc | 2 +- src/crimson/osd/state.h | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/crimson/osd/osd.cc b/src/crimson/osd/osd.cc index a0e8a2cb7734..d5619f87a519 100644 --- a/src/crimson/osd/osd.cc +++ b/src/crimson/osd/osd.cc @@ -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(); } diff --git a/src/crimson/osd/state.h b/src/crimson/osd/state.h index 2afd7b000608..4c445348d301 100644 --- a/src/crimson/osd/state.h +++ b/src/crimson/osd/state.h @@ -3,6 +3,9 @@ #pragma once +#include +#include + 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(); +} -- 2.47.3