Fixes a bug triggered by using the ceph tool to 'mon add' with a port set
to zero. We now default to the monitor's default port (6789) instead, and
we will fail if that port is already assigned to some other monitor.
Fixes: bug #2661
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
ss << "addr " << m->cmd[3] << "does not parse";
goto out;
}
+
+ if (addr.get_port() == 0) {
+ ss << "port defaulted to " << CEPH_MON_PORT;
+ addr.set_port(CEPH_MON_PORT);
+ }
+
if (pending_map.contains(addr) ||
pending_map.contains(name)) {
err = -EEXIST;
+ if (!ss.str().empty())
+ ss << "; ";
ss << "mon " << name << " " << addr << " already exists";
goto out;
}