From ed3782e60afa0da2f523fc6df7b593fe7a57646a Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Wed, 16 Sep 2020 12:28:55 -0700 Subject: [PATCH] mon: allow overriding the initial mon_host This overrides what the CephContext believes to be the current quorum of monitors (retrieved from other instances of the MonClient), introduced by [1]. Tests need to be able to target a specific monitor for exercising forwarding and other things. [1] 731e2db9fb4611f767446a3c8e778a097ce70d35 Fixes: https://tracker.ceph.com/issues/47180 Signed-off-by: Patrick Donnelly --- PendingReleaseNotes | 6 ++++++ doc/rados/configuration/ceph-conf.rst | 5 +++++ qa/standalone/mon/mon-handle-forward.sh | 6 +++--- src/common/options.cc | 6 ++++++ src/mon/MonMap.cc | 15 +++++++++++++++ 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/PendingReleaseNotes b/PendingReleaseNotes index a2d176c3319..b97703f73ed 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -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 `` 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 ...`` diff --git a/doc/rados/configuration/ceph-conf.rst b/doc/rados/configuration/ceph-conf.rst index afa306d7123..6a8d47723d4 100644 --- a/doc/rados/configuration/ceph-conf.rst +++ b/doc/rados/configuration/ceph-conf.rst @@ -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 diff --git a/qa/standalone/mon/mon-handle-forward.sh b/qa/standalone/mon/mon-handle-forward.sh index f067f46d9d7..8633959d5f2 100755 --- a/qa/standalone/mon/mon-handle-forward.sh +++ b/qa/standalone/mon/mon-handle-forward.sh @@ -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 diff --git a/src/common/options.cc b/src/common/options.cc index 7d0e70b3bdd..6298962e9da 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -429,6 +429,12 @@ std::vector