conf(cct_->_conf),
state(DISCONNECTED),
monclient(cct_),
- mgrclient(cct_, nullptr),
+ mgrclient(cct_, nullptr, &monclient.monmap),
messenger(NULL),
instance_id(0),
objecter(NULL),
name(n),
messenger(m),
monc(mc),
- mgrc(m->cct, m),
+ mgrc(m->cct, m, &mc->monmap),
log_client(m->cct, messenger, &mc->monmap, LogClient::NO_FLAGS),
mds_rank(NULL),
asok_hook(NULL),
class MMonCommand : public PaxosServiceMessage {
public:
+ // weird note: prior to octopus, MgrClient would leave fsid blank when
+ // sending commands to the mgr. Starting with octopus, this is either
+ // populated with a valid fsid (tell command) or an MMgrCommand is sent
+ // instead.
uuid_d fsid;
std::vector<std::string> cmd;
bool DaemonServer::handle_command(const ref_t<MCommand>& m)
{
std::lock_guard l(lock);
- if (HAVE_FEATURE(m->get_connection()->get_features(), SERVER_OCTOPUS)) {
+ // a blank fsid in MCommand signals a legacy client sending a "mon-mgr" CLI
+ // command.
+ if (m->fsid != uuid_d()) {
cct->get_admin_socket()->queue_tell_command(m);
return true;
} else {
#include "MgrClient.h"
#include "mgr/MgrContext.h"
+#include "mon/MonMap.h"
#include "msg/Messenger.h"
#include "messages/MMgrMap.h"
#undef dout_prefix
#define dout_prefix *_dout << "mgrc " << __func__ << " "
-MgrClient::MgrClient(CephContext *cct_, Messenger *msgr_)
- : Dispatcher(cct_), cct(cct_), msgr(msgr_),
- timer(cct_, lock)
+MgrClient::MgrClient(CephContext *cct_, Messenger *msgr_, MonMap *monmap_)
+ : Dispatcher(cct_),
+ cct(cct_),
+ msgr(msgr_),
+ monmap(monmap_),
+ timer(cct_, lock)
{
ceph_assert(cct != nullptr);
}
op.on_finish = onfinish;
if (session && session->con) {
- // Leaving fsid argument null because it isn't used.
+ // Leaving fsid argument null because it isn't used historically, and
+ // we can use it as a signal that we are sending a non-tell command.
auto m = op.get_message(
{},
HAVE_FEATURE(map.active_mgr_features, SERVER_OCTOPUS));
op.on_finish = onfinish;
if (session && session->con && (name.size() == 0 || map.active_name == name)) {
- // Leaving fsid argument null because it isn't used.
- // Note: this simply won't work we pre-octopus mgrs because they route
- // MCommand to the cluster command handler.
- auto m = op.get_message({}, false);
+ // Set fsid argument to signal that this is really a tell message (and
+ // we are not a legacy client sending a non-tell command via MCommand).
+ auto m = op.get_message(monmap->fsid, false);
session->con->send_message2(std::move(m));
} else {
ldout(cct, 5) << "no mgr session (no running mgr daemon?), or "
class Messenger;
class MCommandReply;
class MPGStats;
+class MonMap;
class MgrSessionState
{
CephContext *cct;
MgrMap map;
Messenger *msgr;
+ MonMap *monmap;
std::unique_ptr<MgrSessionState> session;
bool mgr_optional = false;
public:
- MgrClient(CephContext *cct_, Messenger *msgr_);
+ MgrClient(CephContext *cct_, Messenger *msgr_, MonMap *monmap);
void set_messenger(Messenger *msgr_) { msgr = msgr_; }
0)),
objecter{g_ceph_context, client_messenger.get(), &monc, NULL, 0, 0},
client{client_messenger.get(), &monc, &objecter},
- mgrc(g_ceph_context, client_messenger.get()),
+ mgrc(g_ceph_context, client_messenger.get(), &monc.monmap),
log_client(g_ceph_context, client_messenger.get(), &monc.monmap, LogClient::NO_FLAGS),
clog(log_client.create_channel(CLOG_CHANNEL_CLUSTER)),
audit_clog(log_client.create_channel(CLOG_CHANNEL_AUDIT)),
cct->_conf->auth_supported.empty() ?
cct->_conf->auth_service_required : cct->_conf->auth_supported),
mgr_messenger(mgr_m),
- mgr_client(cct_, mgr_m),
+ mgr_client(cct_, mgr_m, monmap),
gss_ktfile_client(cct->_conf.get_val<std::string>("gss_ktab_client_file")),
store(s),
client_messenger(external_messenger),
objecter_messenger(osdc_messenger),
monc(mc),
- mgrc(cct_, client_messenger),
+ mgrc(cct_, client_messenger, &mc->monmap),
logger(NULL),
recoverystate_perf(NULL),
store(store_),