Skip to content

Commit

Permalink
Merge PR ceph#37202 into master
Browse files Browse the repository at this point in the history
* refs/pull/37202/head:
	mon: allow overriding the initial mon_host

Reviewed-by: Neha Ojha <[email protected]>
  • Loading branch information
batrick committed Sep 19, 2020
2 parents a251ea0 + ed3782e commit 7eceaf4
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 3 deletions.
6 changes: 6 additions & 0 deletions PendingReleaseNotes
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@
contain alphanumeric and ``-``, ``_`` and ``.`` characters. Some commands
or CephX credentials may not work with old FSs with non-conformant names.

* It is now possible to specify the initial monitor to contact for Ceph tools
and daemons using the ``mon_host_override`` config option or
``--mon-host-override <ip>`` command-line switch. This generally should only
be used for debugging and only affects initial communication with Ceph's
monitor cluster.

* `blacklist` has been replaced with `blocklist` throughout. The following commands have changed:

- ``ceph osd blacklist ...`` are now ``ceph osd blocklist ...``
Expand Down
5 changes: 5 additions & 0 deletions doc/rados/configuration/ceph-conf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ configuration, they may need to be stored locally on the node and set
in a local configuration file. These options include:

- ``mon_host``, the list of monitors for the cluster
- ``mon_host_override``, the list of monitors for the cluster to
**initially** contact when beginning a new instance of communication with the
Ceph cluster. This overrides the known monitor list derived from MonMap
updates sent to older Ceph instances (like librados cluster handles). It is
expected this option is primarily useful for debugging.
- ``mon_dns_serv_name`` (default: `ceph-mon`), the name of the DNS
SRV record to check to identify the cluster monitors via DNS
- ``mon_data``, ``osd_data``, ``mds_data``, ``mgr_data``, and
Expand Down
6 changes: 3 additions & 3 deletions qa/standalone/mon/mon-handle-forward.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ function run() {
run_mon $dir b --public-addr $MONB || return 1
)

timeout 360 ceph --mon-host $MONA mon stat || return 1
timeout 360 ceph --mon-host-override $MONA mon stat || return 1
# check that MONB is indeed a peon
ceph --admin-daemon $(get_asok_path mon.b) mon_status |
grep '"peon"' || return 1
# when the leader ( MONA ) is used, there is no message forwarding
ceph --mon-host $MONA osd pool create POOL1 12
ceph --mon-host-override $MONA osd pool create POOL1 12
CEPH_ARGS='' ceph --admin-daemon $(get_asok_path mon.a) log flush || return 1
grep 'mon_command(.*"POOL1"' $dir/mon.a.log || return 1
CEPH_ARGS='' ceph --admin-daemon $(get_asok_path mon.b) log flush || return 1
grep 'mon_command(.*"POOL1"' $dir/mon.b.log && return 1
# when the peon ( MONB ) is used, the message is forwarded to the leader
ceph --mon-host $MONB osd pool create POOL2 12
ceph --mon-host-override $MONB osd pool create POOL2 12
CEPH_ARGS='' ceph --admin-daemon $(get_asok_path mon.b) log flush || return 1
grep 'forward_request.*mon_command(.*"POOL2"' $dir/mon.b.log || return 1
CEPH_ARGS='' ceph --admin-daemon $(get_asok_path mon.a) log flush || return 1
Expand Down
6 changes: 6 additions & 0 deletions src/common/options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,12 @@ std::vector<Option> get_global_options() {
.set_flag(Option::FLAG_STARTUP)
.add_service("common"),

Option("mon_host_override", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_description("monitor(s) to use overriding the MonMap")
.set_flag(Option::FLAG_NO_MON_UPDATE)
.set_flag(Option::FLAG_STARTUP)
.add_service("common"),

Option("mon_dns_srv_name", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("ceph-mon")
.set_description("name of DNS SRV record to check for monitor addresses")
Expand Down
15 changes: 15 additions & 0 deletions src/mon/MonMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,21 @@ int MonMap::build_initial(CephContext *cct, bool for_mkfs, ostream& errout)
{
const auto& conf = cct->_conf;

// mon_host_override?
auto mon_host_override = conf.get_val<std::string>("mon_host_override");
if (!mon_host_override.empty()) {
lgeneric_dout(cct, 1) << "Using mon_host_override " << mon_host_override << dendl;
auto ret = init_with_ips(mon_host_override, for_mkfs, "noname-");
if (ret == -EINVAL) {
ret = init_with_hosts(mon_host_override, for_mkfs, "noname-");
}
if (ret < 0) {
errout << "unable to parse addrs in '" << mon_host_override << "'"
<< std::endl;
}
return ret;
}

// cct?
auto addrs = cct->get_mon_addrs();
if (addrs != nullptr && (addrs->size() > 0)) {
Expand Down

0 comments on commit 7eceaf4

Please sign in to comment.