From: Sage Weil Date: Wed, 23 Nov 2011 00:22:07 +0000 (-0800) Subject: mon: set default port if not specified... X-Git-Tag: v0.39~17^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=036ad4c73ce6fcfcf1216a421fa5ad2d2f92e98c;p=ceph-ci.git mon: set default port if not specified... ...when looking for self in monmap during mkfs. Signed-off-by: Sage Weil --- diff --git a/src/ceph_mon.cc b/src/ceph_mon.cc index 3560c540b8e..9da2d44fa09 100644 --- a/src/ceph_mon.cc +++ b/src/ceph_mon.cc @@ -126,20 +126,24 @@ int main(int argc, const char **argv) usage(); exit(1); } - + + // resolve public_network -> public_addr pick_addresses(g_ceph_context); - + // am i part of the initial quorum? if (monmap.contains(g_conf->name.get_id())) { // hmm, make sure the ip listed exists on the current host? // maybe later. } else if (!g_conf->public_addr.is_blank_ip()) { - if (monmap.contains(g_conf->public_addr)) { + entity_addr_t a = g_conf->public_addr; + if (a.get_port() == 0) + a.set_port(CEPH_MON_PORT); + if (monmap.contains(a)) { string name; - monmap.get_addr_name(g_conf->public_addr, name); + monmap.get_addr_name(a, name); monmap.rename(name, g_conf->name.get_id()); - cout << argv[0] << ": renaming mon." << name << " " << g_conf->public_addr - << " to mon." << g_conf->name << std::endl; + cout << argv[0] << ": renaming mon." << name << " " << a + << " to mon." << g_conf->name.get_id() << std::endl; } } else { // is a local address listed without a name? if so, name myself.