From: Sage Weil Date: Sun, 22 Dec 2019 01:53:14 +0000 (-0600) Subject: mon/ConfigMonitor: make legacy mon addr/port parseable by legacy code X-Git-Tag: v15.1.0~390^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4ad4118a1d8b573f9111d19ac906d46bbf0161ab;p=ceph-ci.git mon/ConfigMonitor: make legacy mon addr/port parseable by legacy code If it's a v1 addr on the old default 6789 port, print it as a legacy-style addr (no v1: prefix) so that legacy code can parse it. Signed-off-by: Sage Weil --- diff --git a/src/mon/ConfigMonitor.cc b/src/mon/ConfigMonitor.cc index a8ca0c66892..96332c0059c 100644 --- a/src/mon/ConfigMonitor.cc +++ b/src/mon/ConfigMonitor.cc @@ -388,7 +388,17 @@ bool ConfigMonitor::preprocess_command(MonOpRequestRef op) if (i != mon->monmap->mon_info.begin()) { conf << " "; } - conf << i->second.public_addrs; + if (i->second.public_addrs.size() == 1 && + i->second.public_addrs.front().is_legacy() && + i->second.public_addrs.front().get_port() == CEPH_MON_PORT_LEGACY) { + // if this is a legacy addr on the legacy default port, then + // use the legacy-compatible formatting so that old clients + // can use this config. new code will see the :6789 and correctly + // interpret this as a v1 address. + conf << i->second.public_addrs.get_legacy_str(); + } else { + conf << i->second.public_addrs; + } } conf << "\n"; conf << config_map.global.get_minimal_conf();