]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: add generic --help output
authorTim Serong <tserong@suse.com>
Fri, 19 May 2017 12:10:03 +0000 (22:10 +1000)
committerTim Serong <tserong@suse.com>
Fri, 19 May 2017 12:19:58 +0000 (22:19 +1000)
Creating an MgrStandby in order to call its usage() method has
two problems:

1) MgrStandby wants to connect to a running cluster; if the
   cluster isn't up, you'll be left staring at a blinking cursor.
2) MgrStandby::usage() doesn't print anything anyway.

This commit takes pretty much the same approach to printing
usage information as ceph_mon.cc, ceph_osd.cc and ceph_mds.cc.

Signed-off-by: Tim Serong <tserong@suse.com>
src/ceph_mgr.cc
src/mgr/MgrStandby.h

index c3fcc276c79a824e8548f4acc9d3e241d3ca66e3..ae5feb3751acd15039bd9c711020275a8c725021 100644 (file)
 
 #include "mgr/MgrStandby.h"
 
+static void usage()
+{
+  cout << "usage: ceph-mgr -i <ID> [flags]\n"
+       << std::endl;
+  generic_server_usage();
+}
 
 /**
  * A short main() which just instantiates a MgrStandby and
@@ -43,9 +49,7 @@ int main(int argc, const char **argv)
 
   // Handle --help
   if ((args.size() == 1 && (std::string(args[0]) == "--help" || std::string(args[0]) == "-h"))) {
-    MgrStandby mgr;
-    mgr.usage();
-    return 0;
+    usage();
   }
 
   global_init_daemonize(g_ceph_context);
index d33c633dc424ebf4569f7286f3372de9579163a8..9d160a1064291a50f408b5f30de80f4cf503aa18 100644 (file)
@@ -73,7 +73,6 @@ public:
 
   int init();
   void shutdown();
-  void usage() {}
   int main(vector<const char *> args);
   void handle_signal(int signum);
   void send_beacon();