]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: add default to rados_conf_read_file
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Tue, 15 Mar 2011 17:43:35 +0000 (10:43 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Tue, 15 Mar 2011 18:15:06 +0000 (11:15 -0700)
In rados_conf_read_file, read from the default configuration file
locations if the library user passes NULL as the location of the
configuration file.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/common/ceph_argparse.cc
src/common/config.cc
src/common/config.h
src/librados.cc

index ee454e8af25e4849d5057507c25d579332723229..1838bab5919abc5a3a67265524c465f156cb215d 100644 (file)
@@ -163,7 +163,7 @@ void parse_config_option_string(std::string& s)
 
 // The defaults for CephInitParameters
 CephInitParameters::CephInitParameters(uint32_t module_type)
-  : conf_file("/etc/ceph/ceph.conf, ~/.ceph/config, ceph.conf")
+  : conf_file(CEPH_CONF_FILE_DEFAULT)
 {
   const char *conf_file_ = getenv("CEPH_CONF");
   if (conf_file_)
index dea95891e1ed18581b9ac020d85c5638c2c339d2..4a33d3d44922126088824c1ec714db6063a1b523 100644 (file)
@@ -47,6 +47,8 @@
 #undef generic_dout
 #undef dendl
 
+const char *CEPH_CONF_FILE_DEFAULT = "/etc/ceph/ceph.conf, ~/.ceph/config, ceph.conf";
+
 /* The Ceph configuration. */
 md_config_t g_conf __attribute__((init_priority(103)));
 
index e2a4c5f8c987127c8eb136d10a874cd9f66a8ddd..6df6c5bb6f95fd176b3cda50034cd3bb733cb941 100644 (file)
@@ -41,6 +41,8 @@ enum log_to_stderr_t {
 
 struct ConfFile;
 
+extern const char *CEPH_CONF_FILE_DEFAULT;
+
 struct md_config_t
 {
   md_config_t();
index dc509adf5a11af1867707a0f98f10bb08bf7d749..132124493e4277daee31b7297bb08c276791d236 100644 (file)
@@ -23,6 +23,7 @@
 using namespace std;
 
 #include "common/config.h"
+#include "include/str_list.h"
 
 #include "mon/MonMap.h"
 #include "mds/MDS.h"
@@ -2636,8 +2637,11 @@ extern "C" void rados_version(int *major, int *minor, int *extra)
 // -- config --
 extern "C" int rados_conf_read_file(rados_t cluster, const char *path)
 {
+  if (!path)
+    path = CEPH_CONF_FILE_DEFAULT;
+
   std::list<std::string> conf_files;
-  conf_files.push_back(path);
+  get_str_list(path, conf_files);
   int ret = g_conf.parse_config_files(conf_files);
   if (ret)
     return ret;