]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
global: add -C or --cluster early args to specify cluster name
authorSage Weil <sage.weil@dreamhost.com>
Thu, 5 Apr 2012 05:11:47 +0000 (22:11 -0700)
committerSage Weil <sage@newdream.net>
Thu, 5 Apr 2012 20:32:38 +0000 (13:32 -0700)
This will let you specify which cluster to talk to on the command line
(e.g., 'ceph -C foo ...' or when starting a daemon).

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/common/ceph_argparse.cc
src/common/ceph_argparse.h
src/global/global_init.cc

index 4b3194a8f9f6cbf09fac09822b8b6df74e475850..3b142b40b0b6fcb9db14599283cab2883f9556f6 100644 (file)
@@ -339,7 +339,7 @@ bool ceph_argparse_withlonglong(std::vector<const char*> &args,
 
 CephInitParameters ceph_argparse_early_args
          (std::vector<const char*>& args, uint32_t module_type, int flags,
-          std::string *conf_file_list)
+          std::string *cluster, std::string *conf_file_list)
 {
   CephInitParameters iparams(module_type);
   std::string val;
@@ -357,6 +357,9 @@ CephInitParameters ceph_argparse_early_args
     else if (ceph_argparse_witharg(args, i, &val, "--conf", "-c", (char*)NULL)) {
       *conf_file_list = val;
     }
+    else if (ceph_argparse_witharg(args, i, &val, "--cluster", "-C", (char*)NULL)) {
+      *cluster = val;
+    }
     else if ((module_type != CEPH_ENTITY_TYPE_CLIENT) &&
             (ceph_argparse_witharg(args, i, &val, "-i", (char*)NULL))) {
       iparams.name.set_id(val);
index 0c9630d5beeabae2945b02e7204f827773f686a5..d3dbee8b4d6d2259c566eedc591c90e14ba82228 100644 (file)
@@ -61,7 +61,7 @@ bool ceph_argparse_binary_flag(std::vector<const char*> &args,
        std::ostream *oss, ...);
 extern CephInitParameters ceph_argparse_early_args
            (std::vector<const char*>& args, uint32_t module_type, int flags,
-            std::string *conf_file_list);
+            std::string *cluster, std::string *conf_file_list);
 extern bool ceph_argparse_withint(std::vector<const char*> &args,
        std::vector<const char*>::iterator &i, int *ret,
        std::ostream *oss, ...);
index 9f2dbf3b77184110753ebdaa9a9e26c6b8463f95..44db4c1481019182c8a603442090e69bac04fc21 100644 (file)
@@ -62,13 +62,14 @@ void global_init(std::vector < const char * > *alt_def_args, std::vector < const
   // You can only call global_init once.
   assert(!g_ceph_context);
   std::string conf_file_list;
+  std::string cluster = "ceph";
   CephInitParameters iparams = ceph_argparse_early_args(args, module_type, flags,
-                                                       &conf_file_list);
+                                                       &cluster, &conf_file_list);
   CephContext *cct = common_preinit(iparams, code_env, flags);
+  cct->_conf->cluster = cluster;
   global_init_set_globals(cct);
   md_config_t *conf = cct->_conf;
 
-
   if (alt_def_args)
     conf->parse_argv(*alt_def_args);  // alternative default args