From: Li Wang Date: Wed, 6 Sep 2017 14:35:48 +0000 (+0000) Subject: ceph_mon: use default port when not specified X-Git-Tag: v13.0.1~676^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3892d1beeb77f3ccbe720e4458246f515d974cbf;p=ceph.git ceph_mon: use default port when not specified If the monitor port is not specified in ceph.conf, it will use 0. However, monmaptool will use default port in creating monitor map in such case. The inconsistent behavior is not graceful, and every time monitor loading, it warns 'mon addr config option does not match monmap file', which is confusing. Signed-off-by: Li Wang --- diff --git a/src/ceph_mon.cc b/src/ceph_mon.cc index 3663bb04e4b3..edf262753ca0 100644 --- a/src/ceph_mon.cc +++ b/src/ceph_mon.cc @@ -627,10 +627,14 @@ int main(int argc, const char **argv) std::string mon_addr_str; if (g_conf->get_val_from_conf_file(my_sections, "mon addr", mon_addr_str, true) == 0) { - if (conf_addr.parse(mon_addr_str.c_str()) && (ipaddr != conf_addr)) { - derr << "WARNING: 'mon addr' config option " << conf_addr - << " does not match monmap file" << std::endl - << " continuing with monmap configuration" << dendl; + if (conf_addr.parse(mon_addr_str.c_str())) { + if (conf_addr.get_port() == 0) + conf_addr.set_port(CEPH_MON_PORT); + if (ipaddr != conf_addr) { + derr << "WARNING: 'mon addr' config option " << conf_addr + << " does not match monmap file" << std::endl + << " continuing with monmap configuration" << dendl; + } } } } else {