stringtable g_stab;
#include "include/atomic.h"
+#include "include/str_list.h"
#include "osd/osd_types.h"
OPTION(log_sym_dir, 0, OPT_STR, 0),
OPTION(log_to_stdout, 0, OPT_BOOL, true),
OPTION(pid_file, 0, OPT_STR, "/var/run/ceph/$type.$id.pid"),
- OPTION(conf, 'c', OPT_STR, "/etc/ceph/ceph.conf"),
+ OPTION(conf, 'c', OPT_STR, "/etc/ceph/ceph.conf, ~/ceph/config, ceph.conf"),
OPTION(chdir, 0, OPT_STR, "/"),
OPTION(fake_clock, 0, OPT_BOOL, false),
OPTION(fakemessenger_serialize, 0, OPT_BOOL, true),
if (cf)
delete cf;
- cf = new ConfFile(g_conf.conf);
-
- int ret = parse_config_file(cf, true);
+ // open new conf
+ string fn = g_conf.conf;
+ list<string> ls;
+ get_str_list(fn, ls);
+ bool read_conf = false;
+ for (list<string>::iterator p = ls.begin(); p != ls.end(); p++) {
+ cf = new ConfFile(p->c_str());
+ read_conf = parse_config_file(cf, true);
+ if (read_conf)
+ break;
+ delete cf;
+ }
- if (conf_specified && !ret) {
- cerr << "error reading config file " << g_conf.conf << std::endl;
+ if (conf_specified && !read_conf) {
+ cerr << "error reading config file(s) " << g_conf.conf << std::endl;
exit(1);
}
}
// config file?
- ConfFile a(g_conf.conf);
- ConfFile b("ceph.conf");
- ConfFile *c = 0;
-
- if (a.parse())
- c = &a;
- else if (b.parse())
- c = &b;
- if (c) {
- static string monstr;
- for (int i=0; i<15; i++) {
- char monname[20];
- char *val = 0;
- sprintf(monname, "mon%d", i);
- c->read(monname, "mon addr", &val, 0);
- if (!val || !val[0])
+ string conf = g_conf.conf;
+ list<string> ls;
+ get_str_list(conf, ls);
+ if (!ls.empty()) {
+ for (list<string>::iterator p = ls.begin(); p != ls.end(); p++) {
+ ConfFile c(p->c_str());
+ if (c.parse()) {
+ static string monstr;
+ for (int i=0; i<15; i++) {
+ char monname[20];
+ char *val = 0;
+ sprintf(monname, "mon%d", i);
+ c.read(monname, "mon addr", &val, 0);
+ if (!val || !val[0])
+ break;
+
+ entity_inst_t inst;
+ if (!parse_ip_port(val, inst.addr)) {
+ cerr << "unable to parse conf's addr for " << monname << " (" << val << ")" << std::endl;
+ continue;
+ }
+ inst.name = entity_name_t::MON(monmap.mon_inst.size());
+ monmap.add_mon(inst);
+ }
break;
-
- entity_inst_t inst;
- if (!parse_ip_port(val, inst.addr)) {
- cerr << "unable to parse conf's addr for " << monname << " (" << val << ")" << std::endl;
- continue;
}
- inst.name = entity_name_t::MON(monmap.mon_inst.size());
- monmap.add_mon(inst);
}
if (monmap.size())
return 0;