| 49 | #endif |
| 50 | |
| 51 | void mon_info_t::encode(ceph::buffer::list& bl, uint64_t features) const |
| 52 | { |
| 53 | uint8_t v = 6; |
| 54 | uint8_t min_v = 1; |
| 55 | if (!crush_loc.empty()) { |
| 56 | // we added crush_loc in version 5, but need to let old clients decode it |
| 57 | // so just leave the min_v at version 1. Monitors are protected |
| 58 | // from misunderstandings about location because setting it is blocked |
| 59 | // on FEATURE_PINGING |
| 60 | min_v = 1; |
| 61 | } |
| 62 | if (!HAVE_FEATURE(features, SERVER_NAUTILUS)) { |
| 63 | v = 2; |
| 64 | } |
| 65 | ENCODE_START(v, min_v, bl); |
| 66 | encode(name, bl); |
| 67 | if (v < 3) { |
| 68 | ceph_assert(min_v == 1); |
| 69 | auto a = public_addrs.legacy_addr(); |
| 70 | if (a != entity_addr_t()) { |
| 71 | encode(a, bl, features); |
| 72 | } else { |
| 73 | // note: we don't have a legacy addr here, so lie so that it looks |
| 74 | // like one, just so that old clients get a valid-looking map. |
| 75 | // they won't be able to talk to the v2 mons, but that's better |
| 76 | // than nothing. |
| 77 | encode(public_addrs.as_legacy_addr(), bl, features); |
| 78 | } |
| 79 | } else { |
| 80 | encode(public_addrs, bl, features); |
| 81 | } |
| 82 | encode(priority, bl); |
| 83 | encode(weight, bl); |
| 84 | encode(crush_loc, bl); |
| 85 | encode(time_added, bl); |
| 86 | ENCODE_FINISH(bl); |
| 87 | } |
| 88 | |
| 89 | void mon_info_t::decode(ceph::buffer::list::const_iterator& p) |
| 90 | { |
nothing calls this directly
no test coverage detected