A CephContext represents the context held by a single library user.
There can be multiple CephContexts in the same process.
For daemons and utility programs, there will be only one CephContext.
The CephContext contains the configuration, the dout object, and
anything else that you might want to pass to libcommon with every
function call.
Move some non-config things out of md_config_t and into CephContext.
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
mds/MDSMap.cc \
common/common_init.cc \
common/ceph_argparse.cc \
+ common/ceph_context.cc \
common/buffer.cc \
common/code_environment.cc \
common/signal.cc \
common/LogEntry.h\
common/WorkQueue.h\
common/ceph_argparse.h\
+ common/ceph_context.h\
common/debug.h\
common/version.h\
common/hex.h\
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY,
CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
EntityName ename(g_conf.name);
const char *me = argv[0];
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
std::string val;
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
childpid = fork();
}
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
if (childpid == 0) {
//cout << "child, mounting" << std::endl;
messenger->set_policy(entity_name_t::TYPE_CLIENT,
SimpleMessenger::Policy::stateful_server(supported, 0));
- if (shadow == MDSMap::STATE_ONESHOT_REPLAY)
- g_conf.daemonize = false;
- common_init_daemonize(&g_conf, 0);
- common_init_finish(&g_conf);
+ if (shadow != MDSMap::STATE_ONESHOT_REPLAY)
+ common_init_daemonize(&g_ceph_context, 0);
+ common_init_finish(&g_ceph_context);
messenger->start();
// start mds
// -- mkfs --
if (mkfs) {
- g_conf.daemonize = false;
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
if (g_conf.monmap.empty() || !osdmapfn)
usage();
messenger->set_default_send_priority(CEPH_MSG_PRIO_HIGH);
Monitor *mon = new Monitor(g_conf.name.get_id(), &store, messenger, &monmap);
- common_init_daemonize(&g_conf, 0);
- common_init_finish(&g_conf);
+ common_init_daemonize(&g_ceph_context, 0);
+ common_init_finish(&g_ceph_context);
messenger->start();
uint64_t supported =
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2011 New Dream Network
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+ */
+
+#include "common/DoutStreambuf.h"
+#include "common/ProfLogger.h"
+#include "common/ceph_context.h"
+#include "common/config.h"
+
+#include <iostream>
+
+// FIXME
+// These variables are here temporarily to make the transition easier.
+CephContext g_ceph_context __attribute__((init_priority(103)));
+md_config_t &g_conf(*g_ceph_context._conf);
+std::ostream *_dout(&g_ceph_context._dout);
+DoutStreambuf <char, std::basic_string<char>::traits_type> *_doss(g_ceph_context._doss);
+
+/*
+ * The dout lock protects calls to dout()
+ * TODO: needs to become part of CephContext
+ */
+pthread_mutex_t _dout_lock = PTHREAD_MUTEX_INITIALIZER;
+
+CephContext::
+CephContext()
+ : _doss(new DoutStreambuf <char, std::basic_string<char>::traits_type>()),
+ _dout(_doss),
+ _prof_logger_conf_obs(new ProfLoggerConfObs())
+{
+ _conf = new md_config_t();
+ _conf->add_observer(_doss);
+ _conf->add_observer(_prof_logger_conf_obs);
+}
+
+CephContext::
+~CephContext()
+{
+ _conf->remove_observer(_prof_logger_conf_obs);
+ _conf->remove_observer(_doss);
+
+ delete _doss;
+ _doss = NULL;
+ delete _prof_logger_conf_obs;
+ _prof_logger_conf_obs = NULL;
+
+ delete _conf;
+}
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2011 New Dream Network
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+ */
+
+#ifndef CEPH_CEPHCONTEXT_H
+#define CEPH_CEPHCONTEXT_H
+
+#include <iostream>
+
+/* Forward declarations */
+template <typename T, typename U>
+class DoutStreambuf;
+
+class md_config_t;
+class md_config_obs_t;
+
+/* A CephContext represents the context held by a single library user.
+ * There can be multiple CephContexts in the same process.
+ *
+ * For daemons and utility programs, there will be only one CephContext. The
+ * CephContext contains the configuration, the dout object, and anything else
+ * that you might want to pass to libcommon with every function call.
+ */
+class CephContext {
+public:
+ CephContext();
+ ~CephContext();
+ md_config_t *_conf;
+ DoutStreambuf <char, std::basic_string<char>::traits_type> *_doss;
+ std::ostream _dout;
+
+private:
+ md_config_obs_t *_prof_logger_conf_obs;
+};
+
+/* Globals (FIXME: remove) */
+extern CephContext g_ceph_context;
+extern md_config_t &g_conf;
+extern std::ostream *_dout;
+extern DoutStreambuf <char, std::basic_string<char>::traits_type> *_doss;
+
+
+#endif
#define _STR(x) #x
#define STRINGIFY(x) _STR(x)
-int keyring_init(md_config_t *conf)
+int keyring_init(CephContext *cct)
{
+ md_config_t *conf = cct->_conf;
+
if (!is_supported_auth(CEPH_AUTH_CEPHX))
return 0;
return ret;
}
-md_config_t *common_preinit(const CephInitParameters &iparams,
+CephContext *common_preinit(const CephInitParameters &iparams,
enum code_environment_t code_env, int flags)
{
// set code environment
// Create a configuration object
// TODO: de-globalize
- md_config_t *conf = &g_conf; //new md_config_t();
+ CephContext *cct = &g_ceph_context; //new CephContext();
+ md_config_t *conf = cct->_conf;
// add config observers here
// Set up our entity name.
conf->set_val_or_die("daemonize", "false");
break;
}
- return conf;
+ return cct;
}
void complain_about_parse_errors(std::deque<std::string> *parse_errors)
{
CephInitParameters iparams =
ceph_argparse_early_args(args, module_type, flags);
- md_config_t *conf = common_preinit(iparams, code_env, flags);
+ CephContext *cct = common_preinit(iparams, code_env, flags);
+ md_config_t *conf = cct->_conf;
std::deque<std::string> parse_errors;
int ret = conf->parse_config_files(iparams.get_conf_files(), &parse_errors);
* behavior that the file descriptor that gets assigned is the lowest
* available one.
*/
-int common_init_shutdown_stderr(const md_config_t *conf)
+int common_init_shutdown_stderr(void)
{
TEMP_FAILURE_RETRY(close(STDERR_FILENO));
if (open("/dev/null", O_RDONLY) < 0) {
<< err << dendl;
return 1;
}
- conf->_doss->handle_stderr_shutdown();
+ g_ceph_context._doss->handle_stderr_shutdown();
return 0;
}
-void common_init_daemonize(const md_config_t *conf, int flags)
+void common_init_daemonize(const CephContext *cct, int flags)
{
if (g_code_env != CODE_ENVIRONMENT_DAEMON)
return;
+ const md_config_t *conf = cct->_conf;
if (!conf->daemonize)
return;
int num_threads = Thread::get_num_threads();
exit(1);
}
if (!(flags & CINIT_FLAG_NO_DEFAULT_CONFIG_FILE)) {
- ret = common_init_shutdown_stderr(conf);
+ ret = common_init_shutdown_stderr();
if (ret) {
derr << "common_init_daemonize: common_init_shutdown_stderr failed with "
<< "error code " << ret << dendl;
}
}
pidfile_write(&g_conf);
- ret = conf->_doss->handle_pid_change(&g_conf);
+ ret = g_ceph_context._doss->handle_pid_change(&g_conf);
if (ret) {
derr << "common_init_daemonize: _doss->handle_pid_change failed with "
<< "error code " << ret << dendl;
dout(1) << "finished common_init_daemonize" << dendl;
}
-void common_init_finish(const md_config_t *conf)
+void common_init_finish(CephContext *cct)
{
ceph::crypto::init();
- keyring_init(&g_conf);
+ keyring_init(cct);
}
#include "common/code_environment.h"
-class md_config_t;
+class CephContext;
class CephInitParameters;
enum common_init_flags_t {
CINIT_FLAG_NO_CLOSE_STDERR = 0x4,
};
-int keyring_init(md_config_t *conf);
-md_config_t *common_preinit(const CephInitParameters &iparams,
+int keyring_init(CephContext *cct);
+CephContext *common_preinit(const CephInitParameters &iparams,
enum code_environment_t code_env, int flags);
void complain_about_parse_errors(std::deque<std::string> *parse_errors);
void common_init(std::vector < const char* >& args,
uint32_t module_type, code_environment_t code_env, int flags);
void output_ceph_version();
-int common_init_shutdown_stderr(const md_config_t *conf);
-void common_init_daemonize(const md_config_t *conf, int flags);
-void common_init_finish(const md_config_t *conf);
+int common_init_shutdown_stderr();
+void common_init_daemonize(const CephContext *cct, int flags);
+int common_init_shutdown_stderr(void);
+void common_init_finish(CephContext *cct);
#endif
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)));
-
// file layouts
struct ceph_file_layout g_default_file_layout = {
fl_stripe_unit: init_le32(1<<22),
md_config_t::
md_config_t()
- : _doss(new DoutStreambuf <char, std::basic_string<char>::traits_type>()),
- _dout(_doss),
- _prof_logger_conf_obs(new ProfLoggerConfObs())
{
//
// Note: because our md_config_t structure is a global, the memory used to
set_val_from_default(opt);
}
- add_observer(_doss);
- add_observer(_prof_logger_conf_obs);
}
md_config_t::
~md_config_t()
{
- remove_observer(_prof_logger_conf_obs);
- remove_observer(_doss);
-
- delete _doss;
- _doss = NULL;
- delete _prof_logger_conf_obs;
- _prof_logger_conf_obs = NULL;
}
void md_config_t::
#define LOG_TO_STDERR_SOME 1
#define LOG_TO_STDERR_ALL 2
-template <typename T, typename U>
-class DoutStreambuf;
-
-struct md_config_t {
+class md_config_t {
public:
/* Maps configuration options to the observer listening for them. */
typedef std::multimap <std::string, md_config_obs_t*> obs_map_t;
int bdev_fake_mb;
int bdev_fake_max_mb;
int rgw_log;
-
- DoutStreambuf <char, std::basic_string<char>::traits_type> *_doss;
- std::ostream _dout;
- md_config_obs_t *_prof_logger_conf_obs;
};
-extern md_config_t g_conf;
-
typedef enum {
OPT_INT, OPT_LONGLONG, OPT_STR, OPT_DOUBLE, OPT_FLOAT, OPT_BOOL,
OPT_ADDR, OPT_U32, OPT_U64
#include <iostream>
#include <sstream>
-// Originally, dout was global. Now, there is one for each md_config_t structure.
-// These variables are here temporarily to make the transition easier.
-std::ostream *_dout = &g_conf._dout;
-DoutStreambuf <char> *_doss = g_conf._doss;
-
-/*
- * The dout lock protects calls to dout()
- */
-pthread_mutex_t _dout_lock = PTHREAD_MUTEX_INITIALIZER;
-
void output_ceph_version()
{
char buf[1024];
#ifndef CEPH_DEBUG_H
#define CEPH_DEBUG_H
+#include "common/ceph_context.h"
#include "common/likely.h"
#include "common/config.h" // need for g_conf
#include "include/assert.h"
#include <streambuf>
-extern std::ostream *_dout;
-extern DoutStreambuf <char, std::basic_string<char>::traits_type> *_doss;
-class md_config_t;
extern pthread_mutex_t _dout_lock;
extern void dout_emergency(const char * const str);
void sighup_handler(int signum)
{
- g_conf._doss->request_log_reopen();
+ g_ceph_context._doss->request_log_reopen();
}
static void reraise_fatal(int signum)
}
if (dump_pg_log) {
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
bufferlist bl;
int r = bl.read_file(dump_pg_log);
if (r >= 0) {
}
if (mkfs) {
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
RotatingKeyRing rkeys(CEPH_ENTITY_TYPE_OSD, &g_keyring);
MonClient mc(&rkeys);
if (mc.build_initial_monmap() < 0)
*_dout << " for osd" << whoami << " fsid " << mc.monmap.fsid << dendl;
}
if (mkkey) {
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
EntityName ename(g_conf.name);
EntityAuth eauth;
eauth.key.create(CEPH_CRYPTO_AES);
if (mkfs || mkkey)
exit(0);
if (mkjournal) {
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
int err = OSD::mkjournal(g_conf.osd_data, g_conf.osd_journal);
if (err < 0) {
derr << TEXT_RED << " ** ERROR: error creating fresh journal " << g_conf.osd_journal
exit(0);
}
if (flushjournal) {
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
int err = OSD::flushjournal(g_conf.osd_data, g_conf.osd_journal);
if (err < 0) {
derr << TEXT_RED << " ** ERROR: error flushing journal " << g_conf.osd_journal
// Set up crypto, daemonize, etc.
// Leave stderr open in case we need to report errors.
- common_init_daemonize(&g_conf, CINIT_FLAG_NO_CLOSE_STDERR);
- common_init_finish(&g_conf);
+ common_init_daemonize(&g_ceph_context, CINIT_FLAG_NO_CLOSE_STDERR);
+ common_init_finish(&g_ceph_context);
RotatingKeyRing rkeys(CEPH_ENTITY_TYPE_OSD, &g_keyring);
MonClient mc(&rkeys);
if (mc.build_initial_monmap() < 0)
}
// Now close the standard file descriptors
- common_init_shutdown_stderr(&g_conf);
+ common_init_shutdown_stderr();
client_messenger->start();
messenger_hb->start();
argv_to_vec(argc, argv, args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
parse_syn_options(args); // for SyntheticClient
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
vec_to_argv(args, argc, argv);
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
// args
if (args.size() != 4)
struct ceph_mount_info;
struct ceph_dir_result;
+struct CephContext;
const char *ceph_version(int *major, int *minor, int *patch);
int ceph_create(struct ceph_mount_info **cmount, const char * const id);
/* initialization with an existing configuration */
-int ceph_create_with_config(struct ceph_mount_info **cmount, struct md_config_t *conf);
+int ceph_create_with_context(struct ceph_mount_info **cmount, struct CephContext *conf);
/* Activate the mount */
int ceph_mount(struct ceph_mount_info *cmount, const char *root);
extern "C" {
#endif
-struct md_config_t;
-typedef struct md_config_t* librgw_t;
+class CephContext;
+typedef CephContext* librgw_t;
int librgw_create(librgw_t *rgw, const char * const id);
int librgw_acl_bin2xml(librgw_t rgw, const char *bin, int bin_len, char **xml);
void librgw_free_xml(librgw_t rgw, char *xml);
class ceph_mount_info
{
public:
- ceph_mount_info(uint64_t msgr_nonce_, md_config_t *conf)
+ ceph_mount_info(uint64_t msgr_nonce_, CephContext *cct_)
: msgr_nonce(msgr_nonce_),
mounted(false),
client(NULL),
monclient(NULL),
messenger(NULL),
- conf(conf)
+ cct(cct_)
{
}
std::list<std::string> conf_files;
get_str_list(path, conf_files);
std::deque<std::string> parse_errors;
- int ret = conf->parse_config_files(conf_files, &parse_errors);
+ int ret = cct->_conf->parse_config_files(conf_files, &parse_errors);
if (ret)
return ret;
- conf->parse_env(); // environment variables override
+ cct->_conf->parse_env(); // environment variables override
- conf->apply_changes();
+ cct->_conf->apply_changes();
complain_about_parse_errors(&parse_errors);
return 0;
}
{
vector<const char*> args;
argv_to_vec(argc, argv, args);
- conf->parse_argv(args);
- conf->apply_changes();
+ cct->_conf->parse_argv(args);
+ cct->_conf->apply_changes();
}
int conf_set(const char *option, const char *value)
{
- int ret = conf->set_val(option, value);
+ int ret = cct->_conf->set_val(option, value);
if (ret)
return ret;
- conf->apply_changes();
+ cct->_conf->apply_changes();
return 0;
}
int conf_get(const char *option, char *buf, size_t len)
{
char *tmp = buf;
- return conf->get_val(option, &tmp, len);
+ return cct->_conf->get_val(option, &tmp, len);
}
Client *get_client()
Client *client;
MonClient *monclient;
SimpleMessenger *messenger;
- md_config_t *conf;
+ CephContext *cct;
std::string cwd;
};
return VERSION;
}
-static int ceph_create_with_config_impl(struct ceph_mount_info **cmount, md_config_t *conf)
+static int ceph_create_with_context_impl(struct ceph_mount_info **cmount, CephContext *cct)
{
// should hold libceph_init_mutex here
libceph_initialized = true;
uint64_t nonce = (uint64_t)++nonce_seed * 1000000ull + (uint64_t)getpid();
- *cmount = new struct ceph_mount_info(nonce, conf);
+ *cmount = new struct ceph_mount_info(nonce, cct);
return 0;
}
{
int ret;
libceph_init_mutex.Lock();
- md_config_t *conf = &g_conf;
+ CephContext *cct = &g_ceph_context;
if (!libceph_initialized) {
CephInitParameters iparams(CEPH_ENTITY_TYPE_CLIENT, CEPH_CONF_FILE_DEFAULT);
iparams.conf_file = "";
iparams.name.set(CEPH_ENTITY_TYPE_CLIENT, id);
}
- conf = common_preinit(iparams, CODE_ENVIRONMENT_LIBRARY, 0);
- conf->parse_env(); // environment variables override
- conf->apply_changes();
+ cct = common_preinit(iparams, CODE_ENVIRONMENT_LIBRARY, 0);
+ cct->_conf->parse_env(); // environment variables coverride
+ cct->_conf->apply_changes();
}
- ret = ceph_create_with_config_impl(cmount, conf);
+ ret = ceph_create_with_context_impl(cmount, cct);
libceph_init_mutex.Unlock();
return ret;
}
-extern "C" int ceph_create_with_config(struct ceph_mount_info **cmount, md_config_t *conf)
+extern "C" int ceph_create_with_context(struct ceph_mount_info **cmount, CephContext *cct)
{
int ret;
libceph_init_mutex.Lock();
- ret = ceph_create_with_config_impl(cmount, conf);
+ ret = ceph_create_with_context_impl(cmount, cct);
libceph_init_mutex.Unlock();
return ret;
}
{
std::string mount_root;
- keyring_init(&g_conf);
+ keyring_init(&g_ceph_context);
if (root)
mount_root = root;
}
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
FOR_EACH_ARG(args) {
usage_exit();
int librados::Rados::
connect()
{
- int ret = keyring_init(&g_conf);
+ int ret = keyring_init(&g_ceph_context);
if (ret)
return ret;
return client->connect();
// TODO: store this conf pointer in the RadosClient and use it as our
// configuration
- md_config_t *conf = common_preinit(iparams, CODE_ENVIRONMENT_LIBRARY, 0);
- conf->parse_env(); // environment variables override
- conf->apply_changes();
+ CephContext *cct = common_preinit(iparams, CODE_ENVIRONMENT_LIBRARY, 0);
+ cct->_conf->parse_env(); // environment variables override
+ cct->_conf->apply_changes();
++rados_initialized;
}
extern "C" int rados_connect(rados_t cluster)
{
- int ret = keyring_init(&g_conf);
+ int ret = keyring_init(&g_ceph_context);
if (ret)
return ret;
librados::RadosClient *radosp = (librados::RadosClient *)cluster;
snapserver->check_osd_map(false);
}
- g_conf._doss->handle_log_reopen_requests(&g_conf);
+ g_ceph_context._doss->handle_log_reopen_requests(&g_conf);
}
}
}
- g_conf._doss->handle_log_reopen_requests(&g_conf);
+ g_ceph_context._doss->handle_log_reopen_requests(&g_conf);
new_tick();
}
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY,
CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
FOR_EACH_ARG(args) {
if (CEPH_ARGPARSE_EQ("print", '\0')) {
CEPH_ARGPARSE_SET_ARG_VAL(&print, OPT_BOOL);
dispatch_cond.Signal();
}
- g_conf._doss->handle_log_reopen_requests(&g_conf);
+ g_ceph_context._doss->handle_log_reopen_requests(&g_conf);
}
// =========================================
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY,
CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
const char *me = argv[0];
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
std::map < std::string, std::string > opts;
std::vector<const char*>::iterator i;
int opt_cmd = OPT_NO_CMD;
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
const char *poolname = NULL;
uint64_t size = 0;
if (id) {
iparams.name.set(CEPH_ENTITY_TYPE_CLIENT, id);
}
- md_config_t *conf = common_preinit(iparams, CODE_ENVIRONMENT_LIBRARY, 0);
- conf->log_to_stderr = 1; // quiet by default
- conf->parse_env(); // environment variables override
- conf->apply_changes();
+ CephContext *cct = common_preinit(iparams, CODE_ENVIRONMENT_LIBRARY, 0);
+ cct->_conf->log_to_stderr = 1; // quiet by default
+ cct->_conf->parse_env(); // environment variables override
+ cct->_conf->apply_changes();
++librgw_initialized;
}
librgw_init_mutex.Unlock();
- *rgw = &g_conf;
+ *rgw = &g_ceph_context;
return 0;
}
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
const char *user_id = 0;
const char *access_key = 0;
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
if (!RGWAccess::init_storage_provider("rados", &g_conf)) {
derr << "Couldn't init storage provider (RADOS)" << dendl;
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
// args
if (args.size() < 3) return -1;
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
DoutStreambuf<char> *dos = new DoutStreambuf<char>();
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
DEFINE_CONF_VARS(usage);
FOR_EACH_ARG(args) {
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
int ret;
Mutex safe_timer_lock("safe_timer_lock");
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
string val;
string oid("test_object");
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
// args
if (args.size() < 2) return -1;
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
vec_to_argv(args, argc, argv);
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
vec_to_argv(args, argc, argv);
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(&g_conf);
+ common_init_finish(&g_ceph_context);
vec_to_argv(args, argc, argv);