mirror of
https://github.com/ceph/ceph
synced 2024-12-18 17:37:38 +00:00
monmap: calc_ranks() on rename()
This is simpler than ensuring we track all the right invariants. Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
d93410c799
commit
d7a8084b4c
@ -103,6 +103,14 @@ class MonMap {
|
||||
calc_ranks();
|
||||
}
|
||||
|
||||
void rename(string oldname, string newname) {
|
||||
assert(contains(oldname));
|
||||
assert(!contains(newname));
|
||||
mon_addr[newname] = mon_addr[oldname];
|
||||
mon_addr.erase(oldname);
|
||||
calc_ranks();
|
||||
}
|
||||
|
||||
bool contains(const string& name) {
|
||||
return mon_addr.count(name);
|
||||
}
|
||||
@ -147,14 +155,6 @@ class MonMap {
|
||||
return true;
|
||||
}
|
||||
|
||||
void rename(string oldname, string newname) {
|
||||
assert(contains(oldname));
|
||||
assert(!contains(newname));
|
||||
mon_addr[newname] = mon_addr[oldname];
|
||||
mon_addr.erase(oldname);
|
||||
addr_name[mon_addr[newname]] = newname;
|
||||
}
|
||||
|
||||
const entity_addr_t& get_addr(const string& n) {
|
||||
assert(mon_addr.count(n));
|
||||
return mon_addr[n];
|
||||
|
Loading…
Reference in New Issue
Block a user