From 1342eac34657815d893fd0cfba2f8a8af36593e2 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Fri, 25 Sep 2009 12:33:40 -0700 Subject: [PATCH] auth: monitor reads initial auth state --- src/config.cc | 2 -- src/mon/AuthMonitor.cc | 60 ++++++++++++++++++++++-------------------- src/mon/MonClient.cc | 4 --- src/vstart.sh | 3 +-- 4 files changed, 32 insertions(+), 37 deletions(-) diff --git a/src/config.cc b/src/config.cc index 7e965b22dd534..71362b33ec10d 100644 --- a/src/config.cc +++ b/src/config.cc @@ -966,8 +966,6 @@ void parse_startup_config_options(std::vector& args, bool isdaemon, assert(g_conf.entity_name); g_conf.entity_name->from_type_id(g_conf.type, g_conf.id); - dout(0) << "entity name: " << g_conf.entity_name->to_str() << dendl; - if (cf) delete cf; diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc index 5a4f3459a1a50..5bce10d5f128e 100644 --- a/src/mon/AuthMonitor.cc +++ b/src/mon/AuthMonitor.cc @@ -40,7 +40,7 @@ static ostream& _prefix(Monitor *mon, version_t v) { return *_dout << dbeginl << "mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) - << ".class v" << v << " "; + << ".auth v" << v << " "; } ostream& operator<<(ostream& out, AuthMonitor& pm) @@ -95,11 +95,7 @@ void AuthMonitor::on_active() void AuthMonitor::create_initial(bufferlist& bl) { dout(0) << "create_initial -- creating initial map" << dendl; - AuthLibEntry l; AuthLibIncremental inc; - ::encode(l, inc.info); - inc.op = AUTH_INC_NOP; - pending_auth.push_back(inc); if (g_conf.keys_file) { map keys_map; @@ -136,6 +132,11 @@ void AuthMonitor::create_initial(bufferlist& bl) } } + + AuthLibEntry l; + ::encode(l, inc.info); + inc.op = AUTH_INC_NOP; + pending_auth.push_back(inc); } bool AuthMonitor::store_entry(AuthLibEntry& entry) @@ -180,32 +181,33 @@ bool AuthMonitor::update_from_paxos() bufferlist::iterator p = bl.begin(); AuthLibIncremental inc; - ::decode(inc, p); - AuthLibEntry entry; - inc.decode_entry(entry); - switch (inc.op) { - case AUTH_INC_ADD: - if (!entry.rotating) { - mon->keys_server.add_secret(entry.name, entry.secret); - } else { - derr(0) << "got AUTH_INC_ADD with entry.rotating" << dendl; - } - break; - case AUTH_INC_DEL: - mon->keys_server.remove_secret(entry.name); - break; - case AUTH_INC_SET_ROTATING: - { - dout(0) << "AuthMonitor::update_from_paxos: decode_rotating" << dendl; - mon->keys_server.decode_rotating(entry.rotating_bl); + while (!p.end()) { + ::decode(inc, p); + AuthLibEntry entry; + inc.decode_entry(entry); + switch (inc.op) { + case AUTH_INC_ADD: + if (!entry.rotating) { + mon->keys_server.add_secret(entry.name, entry.secret); + } else { + derr(0) << "got AUTH_INC_ADD with entry.rotating" << dendl; + } + break; + case AUTH_INC_DEL: + mon->keys_server.remove_secret(entry.name); + break; + case AUTH_INC_SET_ROTATING: + { + dout(0) << "AuthMonitor::update_from_paxos: decode_rotating" << dendl; + mon->keys_server.decode_rotating(entry.rotating_bl); + } + break; + case AUTH_INC_NOP: + break; + default: + assert(0); } - break; - case AUTH_INC_NOP: - break; - default: - assert(0); } - keys_ver++; mon->keys_server.set_ver(keys_ver); } diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 068485f340386..fbed75a5e4c59 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -183,13 +183,9 @@ bool MonClient::ms_dispatch(Message *m) if (my_addr == entity_addr_t()) my_addr = messenger->get_myaddr(); - dout(0) << "dispatch type=" << m->get_type() << dendl; - switch (m->get_type()) { case CEPH_MSG_MON_MAP: - dout(0) << "CEPH_MSG_MON_MAP begin" << dendl; handle_monmap((MMonMap*)m); - dout(0) << "CEPH_MSG_MON_MAP end" << dendl; return true; case CEPH_MSG_CLIENT_MOUNT_ACK: diff --git a/src/vstart.sh b/src/vstart.sh index 933a072acafd5..ad24d160a3ce4 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -239,8 +239,7 @@ EOF for f in `seq 0 $((CEPH_NUM_MON-1))` do echo $CEPH_BIN/mkmonfs --clobber --mon-data dev/mon$f -i $f --monmap .ceph_monmap --osdmap .ceph_osdmap - cp monkeys.bin dev/mon$f/ - $CEPH_BIN/mkmonfs -c $conf --clobber --mon-data dev/mon$f -i $f --monmap .ceph_monmap --osdmap .ceph_osdmap + $CEPH_BIN/mkmonfs -c $conf --clobber --mon-data=dev/mon$f -i $f --monmap=.ceph_monmap --osdmap=.ceph_osdmap --keys-file=monkeys.bin done fi -- 2.39.5