Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luminous: ceph mgr versions shows active mgr as Unknown #17635

Merged
merged 2 commits into from Sep 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions qa/tasks/mgr/test_failover.py
@@ -1,5 +1,6 @@

import logging
import json

from tasks.mgr.mgr_test_case import MgrTestCase

Expand Down Expand Up @@ -92,6 +93,15 @@ def test_explicit_fail(self):
timeout=10
)

# Both daemons should have fully populated metadata
# (regression test for http://tracker.ceph.com/issues/21260)
meta = json.loads(self.mgr_cluster.mon_manager.raw_cluster_cmd(
"mgr", "metadata"))
id_to_meta = dict([(i['id'], i) for i in meta])
for i in [original_active] + original_standbys:
self.assertIn(i, id_to_meta)
self.assertIn('ceph_version', id_to_meta[i])

# We should be able to fail back over again: the exercises
# our re-initialization of the python runtime within
# a single process lifetime.
Expand Down
13 changes: 8 additions & 5 deletions src/mon/MgrMonitor.cc
Expand Up @@ -332,7 +332,7 @@ bool MgrMonitor::prepare_beacon(MonOpRequestRef op)
} else if (pending_map.active_gid == 0) {
// There is no currently active daemon, select this one.
if (pending_map.standbys.count(m->get_gid())) {
drop_standby(m->get_gid());
drop_standby(m->get_gid(), false);
}
dout(4) << "selecting new active " << m->get_gid()
<< " " << m->get_name()
Expand Down Expand Up @@ -599,7 +599,8 @@ bool MgrMonitor::promote_standby()
pending_map.available = false;
pending_map.active_addr = entity_addr_t();

drop_standby(replacement_gid);
drop_standby(replacement_gid, false);

return true;
} else {
return false;
Expand All @@ -624,10 +625,12 @@ void MgrMonitor::drop_active()
cancel_timer();
}

void MgrMonitor::drop_standby(uint64_t gid)
void MgrMonitor::drop_standby(uint64_t gid, bool drop_meta)
{
pending_metadata_rm.insert(pending_map.standbys[gid].name);
pending_metadata.erase(pending_map.standbys[gid].name);
if (drop_meta) {
pending_metadata_rm.insert(pending_map.standbys[gid].name);
pending_metadata.erase(pending_map.standbys[gid].name);
}
pending_map.standbys.erase(gid);
if (last_beacon.count(gid) > 0) {
last_beacon.erase(gid);
Expand Down
11 changes: 10 additions & 1 deletion src/mon/MgrMonitor.h
Expand Up @@ -43,7 +43,16 @@ class MgrMonitor: public PaxosService
*/
bool promote_standby();
void drop_active();
void drop_standby(uint64_t gid);

/**
* Remove this gid from the list of standbys. By default,
* also remove metadata (i.e. forget the daemon entirely).
*
* Set `drop_meta` to false if you would like to keep
* the daemon's metadata, for example if you're dropping
* it as a standby before reinstating it as the active daemon.
*/
void drop_standby(uint64_t gid, bool drop_meta=true);

Context *digest_event = nullptr;
void cancel_timer();
Expand Down