]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/MgrClient: add mgr_optional mode
authorJohn Spray <john.spray@redhat.com>
Mon, 30 Apr 2018 13:32:43 +0000 (09:32 -0400)
committerKefu Chai <kchai@redhat.com>
Sat, 5 May 2018 11:04:20 +0000 (19:04 +0800)
This is for use when talking to pre-luminous
clusters, where we should not block waiting
for MgrMap because it might never come.

Fixes: https://tracker.ceph.com/issues/23627
Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit bae47183c2621577ba564d29c82a0517ab8a7f54)

src/mgr/MgrClient.cc
src/mgr/MgrClient.h

index 6e1e5391d8def6a8ef5f6b2807fc5e45ac16db16..804c9d639e712cabaecb03b60be539057e93884d 100644 (file)
@@ -413,7 +413,7 @@ int MgrClient::start_command(const vector<string>& cmd, const bufferlist& inbl,
 
   ldout(cct, 20) << "cmd: " << cmd << dendl;
 
-  if (map.epoch == 0) {
+  if (map.epoch == 0 && mgr_optional) {
     ldout(cct,20) << " no MgrMap, assuming EACCES" << dendl;
     return -EACCES;
   }
@@ -429,6 +429,8 @@ int MgrClient::start_command(const vector<string>& cmd, const bufferlist& inbl,
     // Leaving fsid argument null because it isn't used.
     MCommand *m = op.get_message({});
     session->con->send_message(m);
+  } else {
+    ldout(cct, 4) << "start_command: no mgr session, waiting" << dendl;
   }
   return 0;
 }
index 4a044b5d5e3c98b9f5482c3a8f1b8cbbe2aa8e87..8f490fc537ba1b12fb990a0bc1276ae63792cef4 100644 (file)
@@ -88,6 +88,10 @@ protected:
   void reconnect();
   void _send_open();
 
+  // In pre-luminous clusters, the ceph-mgr service is absent or optional,
+  // so we must not block in start_command waiting for it.
+  bool mgr_optional = false;
+
 public:
   MgrClient(CephContext *cct_, Messenger *msgr_);
 
@@ -96,6 +100,8 @@ public:
   void init();
   void shutdown();
 
+  void set_mgr_optional(bool optional_) {mgr_optional = optional_;}
+
   bool ms_dispatch(Message *m) override;
   bool ms_handle_reset(Connection *con) override;
   void ms_handle_remote_reset(Connection *con) override {}