From c9c3f2660ecbd9589ad14478af3c054d6db620cb Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 23 Oct 2009 15:37:04 -0700 Subject: [PATCH] monc: fix rotating keys --- src/messages/MAuthRotating.h | 5 ++++- src/mon/MonClient.cc | 16 +++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/messages/MAuthRotating.h b/src/messages/MAuthRotating.h index 1223fd79f2875..6600188701372 100644 --- a/src/messages/MAuthRotating.h +++ b/src/messages/MAuthRotating.h @@ -26,7 +26,10 @@ public: MAuthRotating() : PaxosServiceMessage(MSG_AUTH_ROTATING, 0) { } - const char *get_type_name() { return "get auth_rotating_secret request/response"; } + const char *get_type_name() { return "auth_rotating"; } + void print(ostream& out) { + out << "auth_rotating(" << status << " " << entity_name << " " << response_bl.length() << " bytes)"; + } void decode_payload() { bufferlist::iterator p = payload.begin(); diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index ee95b79bec011..d98f9082b3f71 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -242,6 +242,8 @@ void MonClient::init() dout(10) << "init" << dendl; messenger->add_dispatcher_head(this); + entity_name = *g_conf.entity_name; + Mutex::Locker l(monc_lock); timer.add_event_after(10.0, new C_Tick(this)); } @@ -312,7 +314,7 @@ void MonClient::handle_auth(MAuthReply *m) return; } auth->set_want_keys(want_keys); - auth->init(*g_conf.entity_name); + auth->init(entity_name); } else { auth->reset(); } @@ -542,18 +544,14 @@ int MonClient::wait_authenticate(double timeout) int MonClient::_start_auth_rotating() { - if (!auth_principal_needs_rotating_keys(entity_name)) + if (!auth_principal_needs_rotating_keys(entity_name)) { + dout(0) << "_start_auth_rotating not needed by " << entity_name << dendl; return 0; + } - MAuthRotating *m = new MAuthRotating(); - if (!m) - return -ENOMEM; - + MAuthRotating *m = new MAuthRotating; m->entity_name = entity_name; - - dout(0) << "MonClient::_start_auth_rotating sending message" << dendl; _send_mon_message(m); - return 0; } -- 2.39.5