]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: move ConfigValues out of md_config_t 22908/head
authorKefu Chai <kchai@redhat.com>
Fri, 6 Jul 2018 15:08:00 +0000 (23:08 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 10 Jul 2018 15:42:59 +0000 (23:42 +0800)
by moving ConfigValues out of md_config_t, we are able to point
md_config_t to a new ConfigValues instance at runtime, without
destroying the old one.

also remove ConfigReader, because all md_config_obs_t will be updated
with ConfigProxy now. as md_config_t is not able to offer the *data*
anymore.

Signed-off-by: Kefu Chai <kchai@redhat.com>
143 files changed:
doc/dev/config.rst
src/ceph_fuse.cc
src/ceph_mds.cc
src/ceph_mon.cc
src/client/Client.cc
src/client/Client.h
src/client/fuse_ll.cc
src/common/TracepointProvider.cc
src/common/TracepointProvider.h
src/common/WorkQueue.cc
src/common/WorkQueue.h
src/common/ceph_context.cc
src/common/common_init.h
src/common/config.cc
src/common/config.h
src/common/config_cacher.h
src/common/config_obs.h
src/common/config_proxy.h
src/common/pick_address.cc
src/global/global_init.cc
src/global/signal_handler.cc
src/librbd/ImageCtx.cc
src/librbd/Operations.cc
src/mds/CInode.h
src/mds/MDCache.cc
src/mds/MDSCacheObject.h
src/mds/MDSDaemon.cc
src/mds/MDSDaemon.h
src/mds/MDSRank.h
src/mds/Migrator.cc
src/mds/Migrator.h
src/mds/PurgeQueue.cc
src/mds/PurgeQueue.h
src/mgr/DaemonServer.cc
src/mgr/DaemonServer.h
src/mgr/MgrStandby.cc
src/mgr/MgrStandby.h
src/mon/LogMonitor.cc
src/mon/LogMonitor.h
src/mon/Monitor.cc
src/mon/Monitor.h
src/msg/async/dpdk/DPDKStack.cc
src/msg/async/dpdk/dpdk_rte.cc
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h
src/os/bluestore/PMEMDevice.cc
src/os/filestore/FDCache.h
src/os/filestore/FileJournal.h
src/os/filestore/FileStore.cc
src/os/filestore/FileStore.h
src/os/filestore/WBThrottle.cc
src/os/filestore/WBThrottle.h
src/osd/OSD.cc
src/osd/OSD.h
src/osdc/Objecter.cc
src/osdc/Objecter.h
src/rgw/librgw.cc
src/rgw/librgw_admin_user.cc
src/rgw/rgw_admin.cc
src/rgw/rgw_auth_keystone.cc
src/rgw/rgw_civetweb_frontend.cc
src/rgw/rgw_fcgi_process.cc
src/rgw/rgw_frontend.h
src/rgw/rgw_main.cc
src/rgw/rgw_object_expirer.cc
src/rgw/rgw_process.cc
src/rgw/rgw_process.h
src/rgw/rgw_rest_swift.cc
src/rgw/rgw_rest_swift.h
src/rgw/rgw_swift_auth.cc
src/test/common/test_config.cc
src/test/common/test_context.cc
src/test/compressor/test_compression.cc
src/test/confutils.cc
src/test/crimson/test_alien_echo.cc
src/test/daemon_config.cc
src/test/erasure-code/TestErasureCodeLrc.cc
src/test/erasure-code/TestErasureCodePlugin.cc
src/test/erasure-code/TestErasureCodePluginIsa.cc
src/test/erasure-code/TestErasureCodePluginJerasure.cc
src/test/erasure-code/TestErasureCodePluginLrc.cc
src/test/erasure-code/TestErasureCodePluginShec.cc
src/test/erasure-code/ceph_erasure_code.cc
src/test/erasure-code/ceph_erasure_code_benchmark.cc
src/test/erasure-code/ceph_erasure_code_non_regression.cc
src/test/filestore/TestFileStore.cc
src/test/fio/fio_ceph_objectstore.cc
src/test/journal/test_main.cc
src/test/librados/misc.cc
src/test/librados/service.cc
src/test/librbd/managed_lock/test_mock_AcquireRequest.cc
src/test/messenger/simple_client.cc
src/test/messenger/simple_server.cc
src/test/mon/MonMap.cc
src/test/mon/test-mon-msg.cc
src/test/mon/test_mon_workloadgen.cc
src/test/msgr/perf_msgr_client.cc
src/test/msgr/perf_msgr_server.cc
src/test/msgr/test_async_networkstack.cc
src/test/msgr/test_msgr.cc
src/test/objectstore/ObjectStoreTransactionBenchmark.cc
src/test/objectstore/chain_xattr.cc
src/test/objectstore/store_test.cc
src/test/objectstore/store_test_fixture.cc
src/test/objectstore/store_test_fixture.h
src/test/objectstore/test_bluefs.cc
src/test/objectstore/test_idempotent.cc
src/test/objectstore/test_idempotent_sequence.cc
src/test/objectstore/test_kv.cc
src/test/objectstore_bench.cc
src/test/osd/TestOSDMap.cc
src/test/osd/TestOSDScrub.cc
src/test/osd/TestPGLog.cc
src/test/osdc/object_cacher_stress.cc
src/test/rbd_mirror/test_mock_ImageMap.cc
src/test/rbd_mirror/test_mock_LeaderWatcher.cc
src/test/rgw/test_rgw_iam_policy.cc
src/test/test_filejournal.cc
src/test/test_ipaddr.cc
src/test/test_workqueue.cc
src/test/testmsgr.cc
src/tools/ceph_monstore_tool.cc
src/tools/ceph_objectstore_tool.cc
src/tools/ceph_osdomap_tool.cc
src/tools/cephfs/DataScan.cc
src/tools/cephfs/JournalScanner.cc
src/tools/cephfs/JournalTool.cc
src/tools/cephfs/MDSUtility.cc
src/tools/cephfs/Resetter.cc
src/tools/cephfs/TableTool.cc
src/tools/rbd/ArgumentTypes.cc
src/tools/rbd/Utils.cc
src/tools/rbd/action/Create.cc
src/tools/rbd/action/Export.cc
src/tools/rbd/action/Import.cc
src/tools/rbd/action/Kernel.cc
src/tools/rbd/action/List.cc
src/tools/rbd/action/MirrorPool.cc
src/tools/rbd_ggate/main.cc
src/tools/rbd_mirror/ImageSyncThrottler.cc
src/tools/rbd_mirror/ImageSyncThrottler.h
src/tools/rbd_mirror/main.cc
src/tools/rbd_nbd/rbd-nbd.cc

index 40d2d6f7a081df4c603dcd435a306bc13b89258c..50be81322f274fc3dacbba4c73a79b4b7b038e9e 100644 (file)
@@ -79,10 +79,10 @@ and not done in new code.  Do not ever alter g_conf.
 Changing configuration values
 ====================================================
 
-Configuration values can be changed by calling g_conf->set_val. After changing
-the configuration, you should call g_conf->apply_changes to re-run all the
+Configuration values can be changed by calling ``g_conf()->set_val``. After changing
+the configuration, you should call ``g_conf()->apply_changes`` to re-run all the
 affected configuration observers. For convenience, you can call
-g_conf->set_val_or_die to make a configuration change which you think should
+``g_conf()->set_val_or_die`` to make a configuration change which you think should
 never fail.
 
 Injectargs, parse_argv, and parse_env are three other functions which modify
index ca7f31ca3b40fbd1bf945e35b2afb6311b62b7a0..b959db3cebfda72a8398e123da0e4e2af1d930f3 100644 (file)
@@ -130,7 +130,7 @@ int main(int argc, const char **argv, const char *envp[]) {
 #endif
 
   Preforker forker;
-  auto daemonize = g_conf->get_val<bool>("daemonize");
+  auto daemonize = g_conf().get_val<bool>("daemonize");
   if (daemonize) {
     global_init_prefork(g_ceph_context);
     int r;
@@ -156,7 +156,7 @@ int main(int argc, const char **argv, const char *envp[]) {
   }
 
   {
-    g_ceph_context->_conf->finalize_reexpand_meta();
+    g_ceph_context->_conf.finalize_reexpand_meta();
     common_init_finish(g_ceph_context);
    
     init_async_signal_handler();
@@ -177,12 +177,12 @@ int main(int argc, const char **argv, const char *envp[]) {
 #if defined(__linux__)
        int ver = get_linux_version();
        assert(ver != 0);
-        bool client_try_dentry_invalidate = g_conf->get_val<bool>(
+        bool client_try_dentry_invalidate = g_conf().get_val<bool>(
           "client_try_dentry_invalidate");
        bool can_invalidate_dentries =
           client_try_dentry_invalidate && ver < KERNEL_VERSION(3, 18, 0);
        int tr = client->test_dentry_handling(can_invalidate_dentries);
-        bool client_die_on_failed_dentry_invalidate = g_conf->get_val<bool>(
+        bool client_die_on_failed_dentry_invalidate = g_conf().get_val<bool>(
           "client_die_on_failed_dentry_invalidate");
        if (tr != 0 && client_die_on_failed_dentry_invalidate) {
          cerr << "ceph-fuse[" << getpid()
@@ -270,10 +270,10 @@ int main(int argc, const char **argv, const char *envp[]) {
     {
       // start up fuse
       // use my argc, argv (make sure you pass a mount point!)
-      auto client_mountpoint = g_conf->get_val<std::string>(
+      auto client_mountpoint = g_conf().get_val<std::string>(
         "client_mountpoint");
       auto mountpoint = client_mountpoint.c_str();
-      auto fuse_require_active_mds = g_conf->get_val<bool>(
+      auto fuse_require_active_mds = g_conf().get_val<bool>(
         "fuse_require_active_mds");
       r = client->mount(mountpoint, perms, fuse_require_active_mds);
       if (r < 0) {
index c5d0a01d0053aa9e0a3dcc0bdf078bd4d9b13c0f..9e5d499605450e3a6c0b780f54a1dfc3436fab09 100644 (file)
@@ -119,9 +119,9 @@ int main(int argc, const char **argv)
       dout(0) << "requesting standby_replay for mds." << r << dendl;
       char rb[32];
       snprintf(rb, sizeof(rb), "%d", r);
-      g_conf->set_val("mds_standby_for_rank", rb);
-      g_conf->set_val("mds_standby_replay", "true");
-      g_conf->apply_changes(NULL);
+      g_conf().set_val("mds_standby_for_rank", rb);
+      g_conf().set_val("mds_standby_replay", "true");
+      g_conf().apply_changes(nullptr);
     }
     else {
       derr << "Error: can't understand argument: " << *i << "\n" << dendl;
@@ -135,14 +135,14 @@ int main(int argc, const char **argv)
   pick_addresses(g_ceph_context, CEPH_PICK_ADDRESS_PUBLIC, &addrs);
 
   // Normal startup
-  if (g_conf->name.has_default_id()) {
+  if (g_conf()->name.has_default_id()) {
     derr << "must specify '-i name' with the ceph-mds instance name" << dendl;
     exit(1);
   }
 
-  if (g_conf->name.get_id().empty() ||
-      (g_conf->name.get_id()[0] >= '0' && g_conf->name.get_id()[0] <= '9')) {
-    derr << "MDS id '" << g_conf->name << "' is invalid. "
+  if (g_conf()->name.get_id().empty() ||
+      (g_conf()->name.get_id()[0] >= '0' && g_conf()->name.get_id()[0] <= '9')) {
+    derr << "MDS id '" << g_conf()->name << "' is invalid. "
       "MDS names may not start with a numeric digit." << dendl;
     exit(1);
   }
@@ -167,7 +167,7 @@ int main(int argc, const char **argv)
 
   auto nonce = ceph::util::generate_random_number<uint64_t>();
 
-  std::string public_msgr_type = g_conf->ms_public_type.empty() ? g_conf->get_val<std::string>("ms_type") : g_conf->ms_public_type;
+  std::string public_msgr_type = g_conf()->ms_public_type.empty() ? g_conf().get_val<std::string>("ms_type") : g_conf()->ms_public_type;
   Messenger *msgr = Messenger::create(g_ceph_context, public_msgr_type,
                                      entity_name_t::MDS(-1), "mds",
                                      nonce, Messenger::HAS_MANY_CONNECTIONS);
@@ -175,7 +175,7 @@ int main(int argc, const char **argv)
     forker.exit(1);
   msgr->set_cluster_protocol(CEPH_MDS_PROTOCOL);
 
-  cout << "starting " << g_conf->name << " at " << msgr->get_myaddrs()
+  cout << "starting " << g_conf()->name << " at " << msgr->get_myaddrs()
        << std::endl;
   uint64_t required =
     CEPH_FEATURE_OSDREPLYMUX;
@@ -206,13 +206,13 @@ int main(int argc, const char **argv)
   msgr->start();
 
   // start mds
-  mds = new MDSDaemon(g_conf->name.get_id().c_str(), msgr, &mc);
+  mds = new MDSDaemon(g_conf()->name.get_id().c_str(), msgr, &mc);
 
   // in case we have to respawn...
   mds->orig_argc = argc;
   mds->orig_argv = argv;
 
-  if (g_conf->daemonize) {
+  if (g_conf()->daemonize) {
     global_init_postfork_finish(g_ceph_context);
     forker.daemonize();
   }
@@ -226,7 +226,7 @@ int main(int argc, const char **argv)
   register_async_signal_handler_oneshot(SIGINT, handle_mds_signal);
   register_async_signal_handler_oneshot(SIGTERM, handle_mds_signal);
 
-  if (g_conf->inject_early_sigterm)
+  if (g_conf()->inject_early_sigterm)
     kill(getpid(), SIGTERM);
 
   msgr->wait();
index efbdf3b6d2498c9b9277c0734ef9b385d094dd46..adff949480fd494a8bd3ae666091c194cccc49ce 100644 (file)
@@ -118,9 +118,9 @@ int check_mon_data_exists()
 /** Check whether **mon data** is empty.
  *
  * Being empty means mkfs has not been run and there's no monitor setup
- * at **g_conf->mon_data**.
+ * at **g_conf()->mon_data**.
  *
- * If the directory g_conf->mon_data is not empty we will return -ENOTEMPTY.
+ * If the directory g_conf()->mon_data is not empty we will return -ENOTEMPTY.
  * Otherwise we will return 0.  Any other negative returns will represent
  * a failure to be handled by the caller.
  *
index 1e351daaab89a2fbe46e47a22449503edcf97ca7..25dee63efeb9409c7fc280f9f1c26b9cc09764b5 100644 (file)
@@ -5963,7 +5963,7 @@ void Client::tick()
   if (cct->_conf->client_debug_inject_tick_delay > 0) {
     sleep(cct->_conf->client_debug_inject_tick_delay);
     assert(0 == cct->_conf.set_val("client_debug_inject_tick_delay", "0"));
-    cct->_conf.apply_changes(NULL);
+    cct->_conf.apply_changes(nullptr);
   }
 
   ldout(cct, 21) << "tick" << dendl;
@@ -13949,7 +13949,7 @@ const char** Client::get_tracked_conf_keys() const
   return keys;
 }
 
-void Client::handle_conf_change(const md_config_t *conf,
+void Client::handle_conf_change(const ConfigProxy& conf,
                                const std::set <std::string> &changed)
 {
   Mutex::Locker lock(client_lock);
index df61d07bbe28b081575f644d63a4d353077d7e0a..21f94af95c88d12d2009c6c1a30adedc0aee9dd5 100644 (file)
@@ -1250,7 +1250,7 @@ public:
   int test_dentry_handling(bool can_invalidate);
 
   const char** get_tracked_conf_keys() const override;
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                                  const std::set <std::string> &changed) override;
   uint32_t get_deleg_timeout() { return deleg_timeout; }
   int set_deleg_timeout(uint32_t timeout);
index 86f91d31b2306a5246023fa7f5ef89f26d4f4c71..cc8c964330c047b1bb40505bd7f8b2d823bf61c6 100644 (file)
@@ -131,7 +131,7 @@ static int getgroups(fuse_req_t req, gid_t **sgids)
 
 static void get_fuse_groups(UserPerm& perms, fuse_req_t req)
 {
-  if (g_conf->get_val<bool>("fuse_set_user_groups")) {
+  if (g_conf().get_val<bool>("fuse_set_user_groups")) {
     gid_t *gids = NULL;
     int count = getgroups(req, &gids);
 
@@ -411,9 +411,9 @@ static void fuse_ll_mkdir(fuse_req_t req, fuse_ino_t parent, const char *name,
   UserPerm perm(ctx->uid, ctx->gid);
   get_fuse_groups(perm, req);
 #ifdef HAVE_SYS_SYNCFS
-  auto fuse_multithreaded = cfuse->client->cct->_conf->get_val<bool>(
+  auto fuse_multithreaded = cfuse->client->cct->_conf.get_val<bool>(
     "fuse_multithreaded");
-  auto fuse_syncfs_on_mksnap = cfuse->client->cct->_conf->get_val<bool>(
+  auto fuse_syncfs_on_mksnap = cfuse->client->cct->_conf.get_val<bool>(
     "fuse_syncfs_on_mksnap");
   if (cfuse->fino_snap(parent) == CEPH_SNAPDIR &&
       fuse_multithreaded && fuse_syncfs_on_mksnap) {
@@ -576,9 +576,9 @@ static void fuse_ll_open(fuse_req_t req, fuse_ino_t ino,
   if (r == 0) {
     fi->fh = (uint64_t)fh;
 #if FUSE_VERSION >= FUSE_MAKE_VERSION(2, 8)
-    auto fuse_disable_pagecache = cfuse->client->cct->_conf->get_val<bool>(
+    auto fuse_disable_pagecache = cfuse->client->cct->_conf.get_val<bool>(
       "fuse_disable_pagecache");
-    auto fuse_use_invalidate_cb = cfuse->client->cct->_conf->get_val<bool>(
+    auto fuse_use_invalidate_cb = cfuse->client->cct->_conf.get_val<bool>(
       "fuse_use_invalidate_cb");
     if (fuse_disable_pagecache)
       fi->direct_io = 1;
@@ -797,9 +797,9 @@ static void fuse_ll_create(fuse_req_t req, fuse_ino_t parent, const char *name,
     fi->fh = (uint64_t)fh;
     fe.ino = cfuse->make_fake_ino(fe.attr.st_ino, fe.attr.st_dev);
 #if FUSE_VERSION >= FUSE_MAKE_VERSION(2, 8)
-    auto fuse_disable_pagecache = cfuse->client->cct->_conf->get_val<bool>(
+    auto fuse_disable_pagecache = cfuse->client->cct->_conf.get_val<bool>(
       "fuse_disable_pagecache");
-    auto fuse_use_invalidate_cb = cfuse->client->cct->_conf->get_val<bool>(
+    auto fuse_use_invalidate_cb = cfuse->client->cct->_conf.get_val<bool>(
       "fuse_use_invalidate_cb");
     if (fuse_disable_pagecache)
       fi->direct_io = 1;
@@ -852,7 +852,7 @@ static void fuse_ll_setlk(fuse_req_t req, fuse_ino_t ino,
   Fh *fh = reinterpret_cast<Fh*>(fi->fh);
 
   // must use multithread if operation may block
-  auto fuse_multithreaded = cfuse->client->cct->_conf->get_val<bool>(
+  auto fuse_multithreaded = cfuse->client->cct->_conf.get_val<bool>(
     "fuse_multithreaded");
   if (!fuse_multithreaded && sleep && lock->l_type != F_UNLCK) {
     fuse_reply_err(req, EDEADLK);
@@ -888,7 +888,7 @@ static void fuse_ll_flock(fuse_req_t req, fuse_ino_t ino,
   Fh *fh = (Fh*)fi->fh;
 
   // must use multithread if operation may block
-  auto fuse_multithreaded = cfuse->client->cct->_conf->get_val<bool>(
+  auto fuse_multithreaded = cfuse->client->cct->_conf.get_val<bool>(
     "fuse_multithreaded");
   if (!fuse_multithreaded && !(cmd & (LOCK_NB | LOCK_UN))) {
     fuse_reply_err(req, EDEADLK);
@@ -956,7 +956,7 @@ static void do_init(void *data, fuse_conn_info *conn)
   Client *client = cfuse->client;
 
 #if !defined(__APPLE__)
-  auto fuse_default_permissions = client->cct->_conf->get_val<bool>(
+  auto fuse_default_permissions = client->cct->_conf.get_val<bool>(
     "fuse_default_permissions");
   if (!fuse_default_permissions && client->ll_handle_umask()) {
     // apply umask in userspace if posix acl is enabled
@@ -1093,17 +1093,17 @@ int CephFuse::Handle::init(int argc, const char *argv[])
   newargv[newargc++] = argv[0];
   newargv[newargc++] = "-f";  // stay in foreground
 
-  auto fuse_allow_other = client->cct->_conf->get_val<bool>(
+  auto fuse_allow_other = client->cct->_conf.get_val<bool>(
     "fuse_allow_other");
-  auto fuse_default_permissions = client->cct->_conf->get_val<bool>(
+  auto fuse_default_permissions = client->cct->_conf.get_val<bool>(
     "fuse_default_permissions");
-  auto fuse_big_writes = client->cct->_conf->get_val<bool>(
+  auto fuse_big_writes = client->cct->_conf.get_val<bool>(
     "fuse_big_writes");
-  auto fuse_atomic_o_trunc = client->cct->_conf->get_val<bool>(
+  auto fuse_atomic_o_trunc = client->cct->_conf.get_val<bool>(
     "fuse_atomic_o_trunc");
-  auto fuse_debug = client->cct->_conf->get_val<bool>(
+  auto fuse_debug = client->cct->_conf.get_val<bool>(
     "fuse_debug");
-  auto fuse_max_write = client->cct->_conf->get_val<uint64_t>(
+  auto fuse_max_write = client->cct->_conf.get_val<uint64_t>(
     "fuse_max_write");
 
   if (fuse_allow_other) {
@@ -1179,7 +1179,7 @@ int CephFuse::Handle::start()
 
   struct client_callback_args args = {
     handle: this,
-    ino_cb: client->cct->_conf->get_val<bool>("fuse_use_invalidate_cb") ?
+    ino_cb: client->cct->_conf.get_val<bool>("fuse_use_invalidate_cb") ?
       ino_invalidate_cb : NULL,
     dentry_cb: dentry_invalidate_cb,
     switch_intr_cb: switch_interrupt_cb,
@@ -1197,7 +1197,7 @@ int CephFuse::Handle::start()
 
 int CephFuse::Handle::loop()
 {
-  auto fuse_multithreaded = client->cct->_conf->get_val<bool>(
+  auto fuse_multithreaded = client->cct->_conf.get_val<bool>(
     "fuse_multithreaded");
   if (fuse_multithreaded) {
     return fuse_session_loop_mt(se);
index fbc7b22a4713c3e9e09c1b2f659d192c512ccbff..be982b0bc2a6cf6e34bfc29c319e5a3c50eaafc2 100644 (file)
@@ -20,9 +20,9 @@ TracepointProvider::~TracepointProvider() {
 }
 
 void TracepointProvider::handle_conf_change(
-    const md_config_t *conf, const std::set<std::string> &changed) {
+    const ConfigProxy& conf, const std::set<std::string> &changed) {
   if (changed.count(m_config_keys[0])) {
-    verify_config(ConfigProxy{conf});
+    verify_config(conf);
   }
 }
 
index d0ff8c949710beffbba5b05bf1ad473eae8aa2ff..644a05b540cab1dc96ec28ee8557b004e0e9bc92 100644 (file)
@@ -65,8 +65,8 @@ protected:
   const char** get_tracked_conf_keys() const override {
     return m_config_keys;
   }
-  void handle_conf_change(const md_config_t *conf,
-                                  const std::set <std::string> &changed) override;
+  void handle_conf_change(const ConfigProxy& conf,
+                         const std::set <std::string> &changed) override;
 
 private:
   CephContext *m_cct;
index 24cb697b83ef48db65a17d6ff9b1b45020752739..d4154c3afef32dd606dd3e5c9af815c0b2c81944 100644 (file)
@@ -62,12 +62,12 @@ ThreadPool::~ThreadPool()
   delete[] _conf_keys;
 }
 
-void ThreadPool::handle_conf_change(const md_config_t *conf,
+void ThreadPool::handle_conf_change(const ConfigProxy& conf,
                                    const std::set <std::string> &changed)
 {
   if (changed.count(_thread_num_option)) {
     char *buf;
-    int r = conf->get_val(_thread_num_option.c_str(), &buf, -1);
+    int r = conf.get_val(_thread_num_option.c_str(), &buf, -1);
     assert(r >= 0);
     int v = atoi(buf);
     free(buf);
index 61f5f481c10c402f7e55090c484e4ce93271ef12..9fbb9507275234c8931d30456eb9079a424cd264 100644 (file)
@@ -90,7 +90,7 @@ private:
   const char **get_tracked_conf_keys() const override {
     return _conf_keys;
   }
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                          const std::set <std::string> &changed) override;
 
 public:
index 5461e54991cbabf047c20cf93ab9f987201cfe99..513d92ee0113f5f7183b8d8c0a575c35cecd77ec 100644 (file)
@@ -61,12 +61,12 @@ public:
     return KEYS;
   }
 
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                           const std::set <std::string> &changed) override {
-    if (conf->values.lockdep && !m_registered) {
+    if (conf->lockdep && !m_registered) {
       lockdep_register_ceph_context(m_cct);
       m_registered = true;
-    } else if (!conf->values.lockdep && m_registered) {
+    } else if (!conf->lockdep && m_registered) {
       lockdep_unregister_ceph_context(m_cct);
       m_registered = false;
     }
@@ -104,7 +104,7 @@ public:
     return KEYS;
   }
 
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                           const std::set <std::string> &changed) override {
     if (changed.count("mempool_debug")) {
       mempool::set_debug_mode(cct->_conf->mempool_debug);
@@ -224,9 +224,8 @@ public:
     return KEYS;
   }
 
-  void handle_conf_change(const md_config_t *mconf,
+  void handle_conf_change(const ConfigProxy& conf,
                           const std::set <std::string> &changed) override {
-    ConfigReader conf{mconf};
     // stderr
     if (changed.count("log_to_stderr") || changed.count("err_to_stderr")) {
       int l = conf->log_to_stderr ? 99 : (conf->err_to_stderr ? -1 : -2);
@@ -306,11 +305,10 @@ public:
     return KEYS;
   }
 
-  void handle_conf_change(const md_config_t *mconf,
+  void handle_conf_change(const ConfigProxy& conf,
                           const std::set <std::string> &changed) override {
     if (changed.count(
          "enable_experimental_unrecoverable_data_corrupting_features")) {
-      ConfigReader conf{mconf};
       std::lock_guard<ceph::spinlock> lg(cct->_feature_lock);
       get_str_set(
        conf->enable_experimental_unrecoverable_data_corrupting_features,
index bd004b0e60eb7bec545ebeaa4fb1a2a0d952e126..1a4207b0ec7fba50225f2236b50c35b52b797d87 100644 (file)
@@ -54,8 +54,8 @@ enum common_init_flags_t {
  * the user asked for.
  *
  * This is usually done by something like this:
- * cct->_conf->parse_env();
- * cct->_conf->apply_changes();
+ * cct->_conf.parse_env();
+ * cct->_conf.apply_changes();
  *
  * Your library may also supply functions to read a configuration file.
  */
index ec0690682f490dca271ebae26cae683af3e3a370..1c8d47592ba5358a6deba5682a6af550950619ee 100644 (file)
@@ -100,7 +100,8 @@ static int conf_stringify(const Option::value_t& v, string *out)
 namespace ceph::internal {
 
 template<LockPolicy lp>
-md_config_impl<lp>::md_config_impl(bool is_daemon)
+md_config_impl<lp>::md_config_impl(ConfigValues& values,
+                                  bool is_daemon)
   : is_daemon(is_daemon),
     lock("md_config_t", true, false)
 {
@@ -205,13 +206,13 @@ md_config_impl<lp>::md_config_impl(bool is_daemon)
       if (val != *def_str) {
        // if the validator normalizes the string into a different form than
        // what was compiled in, use that.
-       set_val_default(opt.name, val);
+       set_val_default(values, opt.name, val);
       }
     }
   }
 
   // Copy out values (defaults) into any legacy (C struct member) fields
-  update_legacy_vals();
+  update_legacy_vals(values);
 }
 
 template<LockPolicy lp>
@@ -257,18 +258,21 @@ const Option *md_config_impl<lp>::find_option(const string& name) const
 }
 
 template<LockPolicy lp>
-void md_config_impl<lp>::set_val_default(const string& name, const std::string& val)
+void md_config_impl<lp>::set_val_default(ConfigValues& values,
+                                        const string& name, const std::string& val)
 {
   auto locker = lock();
   const Option *o = find_option(name);
   assert(o);
   string err;
-  int r = _set_val(val, *o, CONF_DEFAULT, &err);
+  int r = _set_val(values, val, *o, CONF_DEFAULT, &err);
   assert(r >= 0);
 }
 
 template<LockPolicy lp>
 int md_config_impl<lp>::set_mon_vals(CephContext *cct,
+    ConfigValues& values,
+    const ConfigProxy& proxy,
     const map<string,string>& kv,
     config_callback config_cb)
 {
@@ -297,7 +301,7 @@ int md_config_impl<lp>::set_mon_vals(CephContext *cct,
       continue;
     }
     std::string err;
-    int r = _set_val(i.second, *o, CONF_MON, &err);
+    int r = _set_val(values, i.second, *o, CONF_MON, &err);
     if (r < 0) {
       lderr(cct) << __func__ << " failed to set " << i.first << " = "
                 << i.second << ": " << err << dendl;
@@ -325,7 +329,7 @@ int md_config_impl<lp>::set_mon_vals(CephContext *cct,
     values.rm_val(name, CONF_MON);
   });
   values_bl.clear();
-  _apply_changes(nullptr);
+  _apply_changes(values, proxy, nullptr);
   return 0;
 }
 
@@ -357,7 +361,8 @@ void md_config_impl<lp>::remove_observer(md_config_obs_impl<lp>* observer_)
 }
 
 template<LockPolicy lp>
-int md_config_impl<lp>::parse_config_files(const char *conf_files_str,
+int md_config_impl<lp>::parse_config_files(ConfigValues& values,
+                                   const char *conf_files_str,
                                    std::ostream *warnings,
                                    int flags)
 {
@@ -396,7 +401,7 @@ int md_config_impl<lp>::parse_config_files(const char *conf_files_str,
       // useless $data_dir item, skip
       p = conf_files.erase(p);
     } else {
-      early_expand_meta(s, warnings);
+      early_expand_meta(values, s, warnings);
       ++p;
     }
   }
@@ -437,14 +442,14 @@ int md_config_impl<lp>::parse_config_files(const char *conf_files_str,
   }
 
   std::vector <std::string> my_sections;
-  _get_my_sections(my_sections);
+  _get_my_sections(values, my_sections);
   for (const auto &i : schema) {
     const auto &opt = i.second;
     std::string val;
     int ret = _get_val_from_conf_file(my_sections, opt.name, val);
     if (ret == 0) {
       std::string error_message;
-      int r = _set_val(val, opt, CONF_FILE, &error_message);
+      int r = _set_val(values, val, opt, CONF_FILE, &error_message);
       if (warnings != nullptr && (r < 0 || !error_message.empty())) {
         *warnings << "parse error setting '" << opt.name << "' to '" << val
                   << "'";
@@ -478,13 +483,13 @@ int md_config_impl<lp>::parse_config_files(const char *conf_files_str,
     cerr << ". Please use the new style section names that include a period.";
   }
 
-  update_legacy_vals();
+  update_legacy_vals(values);
 
   return 0;
 }
 
 template<LockPolicy lp>
-void md_config_impl<lp>::parse_env(const char *args_var)
+void md_config_impl<lp>::parse_env(ConfigValues& values, const char *args_var)
 {
   if (safe_to_start_threads)
     return;
@@ -493,7 +498,7 @@ void md_config_impl<lp>::parse_env(const char *args_var)
   }
   if (getenv("CEPH_KEYRING")) {
     auto locker = lock();
-    _set_val(getenv("CEPH_KEYRING"), *find_option("keyring"),
+    _set_val(values, getenv("CEPH_KEYRING"), *find_option("keyring"),
             CONF_ENV, nullptr);
   }
   if (const char *dir = getenv("CEPH_LIB")) {
@@ -502,28 +507,28 @@ void md_config_impl<lp>::parse_env(const char *args_var)
     std::string err;
       const Option *o = find_option(name);
       assert(o);
-      _set_val(dir, *o, CONF_ENV, &err);
+      _set_val(values, dir, *o, CONF_ENV, &err);
     }
   }
   if (getenv(args_var)) {
     vector<const char *> env_args;
     env_to_vec(env_args, args_var);
-    parse_argv(env_args, CONF_ENV);
+    parse_argv(values, env_args, CONF_ENV);
   }
 }
 
 template<LockPolicy lp>
-void md_config_impl<lp>::show_config(std::ostream& out)
+void md_config_impl<lp>::show_config(const ConfigValues& values, std::ostream& out)
 {
   auto locker = lock();
-  _show_config(&out, NULL);
+  _show_config(values, &out, nullptr);
 }
 
 template<LockPolicy lp>
-void md_config_impl<lp>::show_config(Formatter *f)
+void md_config_impl<lp>::show_config(const ConfigValues& values, Formatter *f)
 {
   auto locker = lock();
-  _show_config(NULL, f);
+  _show_config(values, nullptr, f);
 }
 
 template<LockPolicy lp>
@@ -538,7 +543,8 @@ void md_config_impl<lp>::config_options(Formatter *f)
 }
 
 template<LockPolicy lp>
-void md_config_impl<lp>::_show_config(std::ostream *out, Formatter *f)
+void md_config_impl<lp>::_show_config(const ConfigValues& values,
+                                     std::ostream *out, Formatter *f)
 {
   if (out) {
     *out << "name = " << values.name << std::endl;
@@ -551,7 +557,7 @@ void md_config_impl<lp>::_show_config(std::ostream *out, Formatter *f)
   for (const auto& i: schema) {
     const Option &opt = i.second;
     string val;
-    conf_stringify(_get_val(opt), &val);
+    conf_stringify(_get_val(values, opt), &val);
     if (out) {
       *out << opt.name << " = " << val << std::endl;
     }
@@ -562,7 +568,8 @@ void md_config_impl<lp>::_show_config(std::ostream *out, Formatter *f)
 }
 
 template<LockPolicy lp>
-int md_config_impl<lp>::parse_argv(std::vector<const char*>& args, int level)
+int md_config_impl<lp>::parse_argv(ConfigValues& values,
+                                  std::vector<const char*>& args, int level)
 {
   auto locker = lock();
   if (safe_to_start_threads) {
@@ -597,26 +604,26 @@ int md_config_impl<lp>::parse_argv(std::vector<const char*>& args, int level)
       values.no_mon_config = false;
     }
     else if (ceph_argparse_flag(args, i, "--foreground", "-f", (char*)NULL)) {
-      set_val_or_die("daemonize", "false");
+      set_val_or_die(values, "daemonize", "false");
     }
     else if (ceph_argparse_flag(args, i, "-d", (char*)NULL)) {
-      set_val_or_die("daemonize", "false");
-      set_val_or_die("log_file", "");
-      set_val_or_die("log_to_stderr", "true");
-      set_val_or_die("err_to_stderr", "true");
-      set_val_or_die("log_to_syslog", "false");
+      set_val_or_die(values, "daemonize", "false");
+      set_val_or_die(values, "log_file", "");
+      set_val_or_die(values, "log_to_stderr", "true");
+      set_val_or_die(values, "err_to_stderr", "true");
+      set_val_or_die(values, "log_to_syslog", "false");
     }
     // Some stuff that we wanted to give universal single-character options for
     // Careful: you can burn through the alphabet pretty quickly by adding
     // to this list.
     else if (ceph_argparse_witharg(args, i, &val, "--monmap", "-M", (char*)NULL)) {
-      set_val_or_die("monmap", val.c_str());
+      set_val_or_die(values, "monmap", val.c_str());
     }
     else if (ceph_argparse_witharg(args, i, &val, "--mon_host", "-m", (char*)NULL)) {
-      set_val_or_die("mon_host", val.c_str());
+      set_val_or_die(values, "mon_host", val.c_str());
     }
     else if (ceph_argparse_witharg(args, i, &val, "--bind", (char*)NULL)) {
-      set_val_or_die("public_addr", val.c_str());
+      set_val_or_die(values, "public_addr", val.c_str());
     }
     else if (ceph_argparse_witharg(args, i, &val, "--keyfile", "-K", (char*)NULL)) {
       bufferlist bl;
@@ -629,17 +636,17 @@ int md_config_impl<lp>::parse_argv(std::vector<const char*>& args, int level)
       }
       if (r >= 0) {
        string k(bl.c_str(), bl.length());
-       set_val_or_die("key", k.c_str());
+       set_val_or_die(values, "key", k.c_str());
       }
     }
     else if (ceph_argparse_witharg(args, i, &val, "--keyring", "-k", (char*)NULL)) {
-      set_val_or_die("keyring", val.c_str());
+      set_val_or_die(values, "keyring", val.c_str());
     }
     else if (ceph_argparse_witharg(args, i, &val, "--client_mountpoint", "-r", (char*)NULL)) {
-      set_val_or_die("client_mountpoint", val.c_str());
+      set_val_or_die(values, "client_mountpoint", val.c_str());
     }
     else {
-      int r = parse_option(args, i, NULL, level);
+      int r = parse_option(values, args, i, NULL, level);
       if (r < 0) {
         return r;
       }
@@ -649,18 +656,19 @@ int md_config_impl<lp>::parse_argv(std::vector<const char*>& args, int level)
 }
 
 template<LockPolicy lp>
-void md_config_impl<lp>::do_argv_commands()
+void md_config_impl<lp>::do_argv_commands(const ConfigValues& values)
 {
   auto locker = lock();
 
   if (do_show_config) {
-    _show_config(&cout, NULL);
+    _show_config(values, &cout, NULL);
     _exit(0);
   }
 
   if (do_show_config_value.size()) {
     string val;
-    int r = conf_stringify(_get_val(do_show_config_value, 0, &cerr), &val);
+    int r = conf_stringify(_get_val(values, do_show_config_value, 0, &cerr),
+                          &val);
     if (r < 0) {
       if (r == -ENOENT)
        std::cerr << "failed to get config option '"
@@ -677,10 +685,11 @@ void md_config_impl<lp>::do_argv_commands()
 }
 
 template<LockPolicy lp>
-int md_config_impl<lp>::parse_option(std::vector<const char*>& args,
-                             std::vector<const char*>::iterator& i,
-                             ostream *oss,
-                             int level)
+int md_config_impl<lp>::parse_option(ConfigValues& values,
+                                    std::vector<const char*>& args,
+                                    std::vector<const char*>::iterator& i,
+                                    ostream *oss,
+                                    int level)
 {
   int ret = 0;
   size_t o = 0;
@@ -700,9 +709,9 @@ int md_config_impl<lp>::parse_option(std::vector<const char*>& args,
       if (ceph_argparse_binary_flag(args, i, &res, oss, as_option.c_str(),
                                    (char*)NULL)) {
        if (res == 0)
-         ret = _set_val("false", opt, level, &error_message);
+         ret = _set_val(values, "false", opt, level, &error_message);
        else if (res == 1)
-         ret = _set_val("true", opt, level, &error_message);
+         ret = _set_val(values, "true", opt, level, &error_message);
        else
          ret = res;
        break;
@@ -710,7 +719,7 @@ int md_config_impl<lp>::parse_option(std::vector<const char*>& args,
        std::string no("--no-");
        no += opt.name;
        if (ceph_argparse_flag(args, i, no.c_str(), (char*)NULL)) {
-         ret = _set_val("false", opt, level, &error_message);
+         ret = _set_val(values, "false", opt, level, &error_message);
          break;
        }
       }
@@ -721,7 +730,7 @@ int md_config_impl<lp>::parse_option(std::vector<const char*>& args,
        ret = -EINVAL;
        break;
       }
-      ret = _set_val(val, opt, level, &error_message);
+      ret = _set_val(values, val, opt, level, &error_message);
       break;
     }
     ++o;
@@ -754,13 +763,13 @@ int md_config_impl<lp>::parse_option(std::vector<const char*>& args,
 }
 
 template<LockPolicy lp>
-int md_config_impl<lp>::parse_injectargs(std::vector<const char*>& args,
+int md_config_impl<lp>::parse_injectargs(ConfigValues& values,
+                                 std::vector<const char*>& args,
                                  std::ostream *oss)
 {
-  assert(lock.is_locked());
   int ret = 0;
   for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
-    int r = parse_option(args, i, oss, CONF_OVERRIDE);
+    int r = parse_option(values, args, i, oss, CONF_OVERRIDE);
     if (r < 0)
       ret = r;
   }
@@ -768,25 +777,29 @@ int md_config_impl<lp>::parse_injectargs(std::vector<const char*>& args,
 }
 
 template<LockPolicy lp>
-void md_config_impl<lp>::apply_changes(std::ostream *oss)
+void md_config_impl<lp>::apply_changes(ConfigValues& values,
+                                      const ConfigProxy& proxy,
+                                      std::ostream *oss)
 {
   auto locker = lock();
   /*
    * apply changes until the cluster name is assigned
    */
   if (values.cluster.size())
-    _apply_changes(oss);
+    _apply_changes(values, proxy, oss);
 }
 
 template<LockPolicy lp>
-void md_config_impl<lp>::_apply_changes(std::ostream *oss)
+void md_config_impl<lp>::_apply_changes(ConfigValues& values,
+                                       const ConfigProxy& proxy,
+                                       std::ostream *oss)
 {
   /* Maps observers to the configuration options that they care about which
    * have changed. */
   typedef std::map < md_config_obs_t*, std::set <std::string> > rev_obs_map_t;
 
   // meta expands could have modified anything.  Copy it all out again.
-  update_legacy_vals();
+  update_legacy_vals(values);
 
   // create the reverse observer mapping, mapping observers to the set of
   // changed keys that they'll get.
@@ -797,7 +810,7 @@ void md_config_impl<lp>::_apply_changes(std::ostream *oss)
        c != changed.end(); ++c) {
     const std::string &key(*c);
     auto [first, last] = observers.equal_range(key);
-    if ((oss) && !conf_stringify(_get_val(key), &val)) {
+    if ((oss) && !conf_stringify(_get_val(values, key), &val)) {
       (*oss) << key << " = '" << val << "' ";
       if (first == last) {
        (*oss) << "(not observed, change may require restart) ";
@@ -816,13 +829,12 @@ void md_config_impl<lp>::_apply_changes(std::ostream *oss)
   // Make any pending observer callbacks
   for (rev_obs_map_t::const_iterator r = robs.begin(); r != robs.end(); ++r) {
     md_config_obs_t *obs = r->first;
-    obs->handle_conf_change(this, r->second);
+    obs->handle_conf_change(proxy, r->second);
   }
-
 }
 
 template<LockPolicy lp>
-void md_config_impl<lp>::call_all_observers()
+void md_config_impl<lp>::call_all_observers(const ConfigProxy& proxy)
 {
   std::map<md_config_obs_t*,std::set<std::string> > obs;
   // Have the scope of the lock extend to the scope of
@@ -842,7 +854,7 @@ void md_config_impl<lp>::call_all_observers()
   for (auto p = obs.begin();
        p != obs.end();
        ++p) {
-    p->first->handle_conf_change(this, p->second);
+    p->first->handle_conf_change(proxy, p->second);
   }
 }
 
@@ -859,7 +871,9 @@ void md_config_impl<lp>::_clear_safe_to_start_threads()
 }
 
 template<LockPolicy lp>
-int md_config_impl<lp>::injectargs(const std::string& s, std::ostream *oss)
+int md_config_impl<lp>::injectargs(ConfigValues& values,
+                                  const ConfigProxy& proxy,
+                                  const std::string& s, std::ostream *oss)
 {
   int ret;
   auto locker = lock();
@@ -875,7 +889,7 @@ int md_config_impl<lp>::injectargs(const std::string& s, std::ostream *oss)
     *p++ = 0;
     while (*p && *p == ' ') p++;
   }
-  ret = parse_injectargs(nargs, oss);
+  ret = parse_injectargs(values, nargs, oss);
   if (!nargs.empty()) {
     *oss << " failed to parse arguments: ";
     std::string prefix;
@@ -887,16 +901,17 @@ int md_config_impl<lp>::injectargs(const std::string& s, std::ostream *oss)
     *oss << "\n";
     ret = -EINVAL;
   }
-  _apply_changes(oss);
+  _apply_changes(values, proxy, oss);
   return ret;
 }
 
 template<LockPolicy lp>
-void md_config_impl<lp>::set_val_or_die(const std::string &key,
-                                 const std::string &val)
+void md_config_impl<lp>::set_val_or_die(ConfigValues& values,
+                                       const std::string &key,
+                                       const std::string &val)
 {
   std::stringstream err;
-  int ret = set_val(key, val, &err);
+  int ret = set_val(values, key, val, &err);
   if (ret != 0) {
     std::cerr << "set_val_or_die(" << key << "): " << err.str();
   }
@@ -904,8 +919,9 @@ void md_config_impl<lp>::set_val_or_die(const std::string &key,
 }
 
 template<LockPolicy lp>
-int md_config_impl<lp>::set_val(const std::string &key, const char *val,
-                        std::stringstream *err_ss)
+int md_config_impl<lp>::set_val(ConfigValues& values,
+                               const std::string &key, const char *val,
+                               std::stringstream *err_ss)
 {
   auto locker = lock();
   if (key.empty()) {
@@ -924,7 +940,7 @@ int md_config_impl<lp>::set_val(const std::string &key, const char *val,
   if (opt_iter != schema.end()) {
     const Option &opt = opt_iter->second;
     std::string error_message;
-    int r = _set_val(v, opt, CONF_OVERRIDE, &error_message);
+    int r = _set_val(values, v, opt, CONF_OVERRIDE, &error_message);
     if (r >= 0) {
       if (err_ss) *err_ss << "Set " << opt.name << " to " << v;
       r = 0;
@@ -939,14 +955,15 @@ int md_config_impl<lp>::set_val(const std::string &key, const char *val,
 }
 
 template<LockPolicy lp>
-int md_config_impl<lp>::rm_val(const std::string& key)
+int md_config_impl<lp>::rm_val(ConfigValues& values, const std::string& key)
 {
   auto locker = lock();
-  return _rm_val(key, CONF_OVERRIDE);
+  return _rm_val(values, key, CONF_OVERRIDE);
 }
 
 template<LockPolicy lp>
-void md_config_impl<lp>::get_defaults_bl(bufferlist *bl)
+void md_config_impl<lp>::get_defaults_bl(const ConfigValues& values,
+                                        bufferlist *bl)
 {
   auto locker = lock();
   if (defaults_bl.length() == 0) {
@@ -972,6 +989,7 @@ void md_config_impl<lp>::get_defaults_bl(bufferlist *bl)
 
 template<LockPolicy lp>
 void md_config_impl<lp>::get_config_bl(
+  const ConfigValues& values,
   uint64_t have_version,
   bufferlist *bl,
   uint64_t *got_version)
@@ -1026,31 +1044,36 @@ void md_config_impl<lp>::get_config_bl(
 }
 
 template<LockPolicy lp>
-int md_config_impl<lp>::get_val(const std::string &key, char **buf, int len) const
+int md_config_impl<lp>::get_val(const ConfigValues& values,
+                               const std::string &key, char **buf, int len) const
 {
   auto locker = lock();
   string k(ConfFile::normalize_key_name(key));
-  return _get_val_cstr(k, buf, len);
+  return _get_val_cstr(values, k, buf, len);
 }
 
 template<LockPolicy lp>
 int md_config_impl<lp>::get_val(
+  const ConfigValues& values,
   const std::string &key,
   std::string *val) const
 {
-  return conf_stringify(get_val_generic(key), val);
+  return conf_stringify(get_val_generic(values, key), val);
 }
 
 template<LockPolicy lp>
-Option::value_t md_config_impl<lp>::get_val_generic(const std::string &key) const
+Option::value_t md_config_impl<lp>::get_val_generic(
+  const ConfigValues& values,
+  const std::string &key) const
 {
   auto locker = lock();
   string k(ConfFile::normalize_key_name(key));
-  return _get_val(k);
+  return _get_val(values, k);
 }
 
 template<LockPolicy lp>
 Option::value_t md_config_impl<lp>::_get_val(
+  const ConfigValues& values,
   const std::string &key,
   expand_stack_t *stack,
   std::ostream *err) const
@@ -1069,11 +1092,12 @@ Option::value_t md_config_impl<lp>::_get_val(
     return Option::value_t(boost::blank());
   }
 
-  return _get_val(*o, stack, err);
+  return _get_val(values, *o, stack, err);
 }
 
 template<LockPolicy lp>
 Option::value_t md_config_impl<lp>::_get_val(
+  const ConfigValues& values,
   const Option& o,
   expand_stack_t *stack,
   std::ostream *err) const
@@ -1082,11 +1106,14 @@ Option::value_t md_config_impl<lp>::_get_val(
   if (!stack) {
     stack = &a_stack;
   }
-  return _expand_meta(_get_val_nometa(o), &o, stack, err);
+  return _expand_meta(values,
+                     _get_val_nometa(values, o),
+                     &o, stack, err);
 }
 
 template<LockPolicy lp>
-Option::value_t md_config_impl<lp>::_get_val_nometa(const Option& o) const
+Option::value_t md_config_impl<lp>::_get_val_nometa(const ConfigValues& values,
+                                                   const Option& o) const
 {
   if (auto [value, found] = values.get_value(o.name, -1); found) {
     return value;
@@ -1108,29 +1135,33 @@ const Option::value_t& md_config_impl<lp>::_get_val_default(const Option& o) con
 
 template<LockPolicy lp>
 void md_config_impl<lp>::early_expand_meta(
+  const ConfigValues& values,
   std::string &val,
   std::ostream *err) const
 {
   auto locker = lock();
   expand_stack_t stack;
-  Option::value_t v = _expand_meta(Option::value_t(val), nullptr, &stack, err);
+  Option::value_t v = _expand_meta(values,
+                                  Option::value_t(val),
+                                  nullptr, &stack, err);
   conf_stringify(v, &val);
 }
 
 template<LockPolicy lp>
-void md_config_impl<lp>::finalize_reexpand_meta()
+void md_config_impl<lp>::finalize_reexpand_meta(ConfigValues& values,
+                                               const ConfigProxy& proxy)
 {
-  auto locker = lock();
   for (auto &i : may_reexpand_meta) {
-    set_val(i.first, i.second);
+    set_val(values, i.first, i.second);
   }
   
   if (may_reexpand_meta.size())
-    _apply_changes(NULL);
+    _apply_changes(values, proxy, NULL);
 }
 
 template<LockPolicy lp>
 Option::value_t md_config_impl<lp>::_expand_meta(
+  const ConfigValues& values,
   const Option::value_t& in,
   const Option *o,
   expand_stack_t *stack,
@@ -1245,7 +1276,7 @@ Option::value_t md_config_impl<lp>::_expand_meta(
          } else {
            // recursively evaluate!
            string n;
-           conf_stringify(_get_val(*o, stack, err), &n);
+           conf_stringify(_get_val(values, *o, stack, err), &n);
            out += n;
          }
        }
@@ -1265,6 +1296,7 @@ Option::value_t md_config_impl<lp>::_expand_meta(
 
 template<LockPolicy lp>
 int md_config_impl<lp>::_get_val_cstr(
+  const ConfigValues& values,
   const std::string &key, char **buf, int len) const
 {
   assert(lock.is_locked());
@@ -1273,7 +1305,7 @@ int md_config_impl<lp>::_get_val_cstr(
     return -EINVAL;
 
   string val;
-  if (conf_stringify(_get_val(key), &val) == 0) {
+  if (conf_stringify(_get_val(values, key), &val) == 0) {
     int l = val.length() + 1;
     if (len == -1) {
       *buf = (char*)malloc(l);
@@ -1313,14 +1345,16 @@ void md_config_impl<lp>::get_all_keys(std::vector<std::string> *keys) const {
  * others had nothing.  This should always be the global section.
  */
 template<LockPolicy lp>
-void md_config_impl<lp>::get_my_sections(std::vector <std::string> &sections) const
+void md_config_impl<lp>::get_my_sections(const ConfigValues& values,
+                                        std::vector <std::string> &sections) const
 {
   auto locker = lock();
-  _get_my_sections(sections);
+  _get_my_sections(values, sections);
 }
 
 template<LockPolicy lp>
-void md_config_impl<lp>::_get_my_sections(std::vector <std::string> &sections) const
+void md_config_impl<lp>::_get_my_sections(const ConfigValues& values,
+                                         std::vector <std::string> &sections) const
 {
   assert(lock.is_locked());
   sections.push_back(values.name.to_str());
@@ -1344,6 +1378,7 @@ int md_config_impl<lp>::get_all_sections(std::vector <std::string> &sections) co
 
 template<LockPolicy lp>
 int md_config_impl<lp>::get_val_from_conf_file(
+  const ConfigValues& values,
   const std::vector <std::string> &sections,
   const std::string &key,
   std::string &out,
@@ -1356,7 +1391,7 @@ int md_config_impl<lp>::get_val_from_conf_file(
   }
   if (emeta) {
     expand_stack_t stack;
-    auto v = _expand_meta(Option::value_t(out), nullptr, &stack, nullptr);
+    auto v = _expand_meta(values, Option::value_t(out), nullptr, &stack, nullptr);
     conf_stringify(v, &out);
   }
   return 0;
@@ -1384,6 +1419,7 @@ int md_config_impl<lp>::_get_val_from_conf_file(
 
 template<LockPolicy lp>
 int md_config_impl<lp>::_set_val(
+  ConfigValues& values,
   const std::string &raw_val,
   const Option &opt,
   int level,
@@ -1402,7 +1438,7 @@ int md_config_impl<lp>::_set_val(
       safe_to_start_threads &&
       observers.count(opt.name) == 0) {
     // accept value if it is not actually a change
-    if (new_value != _get_val_nometa(opt)) {
+    if (new_value != _get_val_nometa(values, opt)) {
       *error_message = string("Configuration option '") + opt.name +
        "' may not be modified at runtime";
       return -ENOSYS;
@@ -1421,23 +1457,23 @@ int md_config_impl<lp>::_set_val(
     // fallthrough
   default:
     values_bl.clear();
-    _refresh(opt);
+    _refresh(values, opt);
     return 1;
   }
 }
 
 template<LockPolicy lp>
-void md_config_impl<lp>::_refresh(const Option& opt)
+void md_config_impl<lp>::_refresh(ConfigValues& values, const Option& opt)
 {
   // Apply the value to its legacy field, if it has one
   auto legacy_ptr_iter = legacy_values.find(std::string(opt.name));
   if (legacy_ptr_iter != legacy_values.end()) {
-    update_legacy_val(opt, legacy_ptr_iter->second);
+    update_legacy_val(values, opt, legacy_ptr_iter->second);
   }
   // Was this a debug_* option update?
   if (opt.subsys >= 0) {
     string actual_val;
-    conf_stringify(_get_val(opt), &actual_val);
+    conf_stringify(_get_val(values, opt), &actual_val);
     values.set_logging(opt.subsys, actual_val.c_str());
   } else {
     // normal option, advertise the change.
@@ -1446,7 +1482,9 @@ void md_config_impl<lp>::_refresh(const Option& opt)
 }
 
 template<LockPolicy lp>
-int md_config_impl<lp>::_rm_val(const std::string& key, int level)
+int md_config_impl<lp>::_rm_val(ConfigValues& values,
+                               const std::string& key,
+                               int level)
 {
   if (schema.count(key) == 0) {
     return -EINVAL;
@@ -1456,7 +1494,7 @@ int md_config_impl<lp>::_rm_val(const std::string& key, int level)
     return ret;
   }
   if (ret == ConfigValues::SET_HAVE_EFFECT) {
-    _refresh(*find_option(key));
+    _refresh(values, *find_option(key));
   }
   values_bl.clear();
   return 0;
@@ -1515,21 +1553,22 @@ class assign_visitor : public boost::static_visitor<>
 } // anonymous namespace
 
 template<LockPolicy lp>
-void md_config_impl<lp>::update_legacy_vals()
+void md_config_impl<lp>::update_legacy_vals(ConfigValues& values)
 {
   for (const auto &i : legacy_values) {
     const auto &name = i.first;
     const auto &option = schema.at(name);
     auto ptr = i.second;
-    update_legacy_val(option, ptr);
+    update_legacy_val(values, option, ptr);
   }
 }
 
 template<LockPolicy lp>
-void md_config_impl<lp>::update_legacy_val(const Option &opt,
+void md_config_impl<lp>::update_legacy_val(ConfigValues& values,
+                                   const Option &opt,
                                     md_config_impl::member_ptr_t member_ptr)
 {
-  Option::value_t v = _get_val(opt);
+  Option::value_t v = _get_val(values, opt);
   boost::apply_visitor(assign_visitor(&values, v), member_ptr);
 }
 
@@ -1550,11 +1589,12 @@ static void dump(Formatter *f, int level, Option::value_t in)
 
 template<LockPolicy lp>
 void md_config_impl<lp>::diff(
+  const ConfigValues& values,
   Formatter *f,
   string name) const
 {
   auto locker = lock();
-  values.for_each([this, f] (auto& name, auto& configs) {
+  values.for_each([this, f, &values] (auto& name, auto& configs) {
     if (configs.size() == 1 &&
        configs.begin()->first == CONF_DEFAULT) {
       // we only have a default value; exclude from diff
@@ -1566,7 +1606,7 @@ void md_config_impl<lp>::diff(
     for (auto& j : configs) {
       dump(f, j.first, j.second);
     }
-    dump(f, CONF_FINAL, _get_val(*o));
+    dump(f, CONF_FINAL, _get_val(values, *o));
     f->close_section();
   });
 }
index d6bef2b81f2fa5c575f5b3b331631e5e1e334734..94500ce1ecdf7956e749716d95faf96a5a6fcaff 100644 (file)
@@ -109,11 +109,6 @@ public:
    */
   std::map<std::string, const Option&> schema;
 
-  /**
-   * The current values of all settings described by the schema
-   */
-  ConfigValues values;
-
   /// values from mon that we failed to set
   std::map<std::string,std::string> ignored_mon_values;
 
@@ -135,7 +130,7 @@ public:
   } opt_type_t;
 
   // Create a new md_config_t structure.
-  explicit md_config_impl(bool is_daemon=false);
+  explicit md_config_impl(ConfigValues& values, bool is_daemon=false);
   ~md_config_impl();
 
   // Adds a new observer to this configuration. You can do this at any time,
@@ -156,23 +151,26 @@ public:
   void remove_observer(md_config_obs_impl<lock_policy>* observer_);
 
   // Parse a config file
-  int parse_config_files(const char *conf_files,
+  int parse_config_files(ConfigValues& values, const char *conf_files,
                         std::ostream *warnings, int flags);
 
   // Absorb config settings from the environment
-  void parse_env(const char *env_var = "CEPH_ARGS");
+  void parse_env(ConfigValues& values, const char *env_var = "CEPH_ARGS");
 
   // Absorb config settings from argv
-  int parse_argv(std::vector<const char*>& args, int level=CONF_CMDLINE);
+  int parse_argv(ConfigValues& values,
+                std::vector<const char*>& args, int level=CONF_CMDLINE);
 
   // do any commands we got from argv (--show-config, --show-config-val)
-  void do_argv_commands();
+  void do_argv_commands(const ConfigValues& values);
 
   // Expand all metavariables. Make any pending observer callbacks.
-  void apply_changes(std::ostream *oss);
-  void _apply_changes(std::ostream *oss);
+  void apply_changes(ConfigValues& values, const ConfigProxy& proxy,
+                    std::ostream *oss);
+  void _apply_changes(ConfigValues& values, const ConfigProxy& proxy,
+                     std::ostream *oss);
   bool _internal_field(const string& k);
-  void call_all_observers();
+  void call_all_observers(const ConfigProxy& proxy);
 
   void set_safe_to_start_threads();
   void _clear_safe_to_start_threads();  // this is only used by the unit test
@@ -181,77 +179,87 @@ public:
   const Option *find_option(const string& name) const;
 
   /// Set a default value
-  void set_val_default(const std::string& key, const std::string &val);
+  void set_val_default(ConfigValues& values,
+                      const std::string& key, const std::string &val);
 
   /// Set a values from mon
   int set_mon_vals(CephContext *cct,
+      ConfigValues& values,
+      const ConfigProxy& proxy,
       const map<std::string,std::string>& kv,
       config_callback config_cb);
 
   // Called by the Ceph daemons to make configuration changes at runtime
-  int injectargs(const std::string &s, std::ostream *oss);
+  int injectargs(ConfigValues& values, const ConfigProxy& proxy,
+                const std::string &s, std::ostream *oss);
 
   // Set a configuration value, or crash
   // Metavariables will be expanded.
-  void set_val_or_die(const std::string &key, const std::string &val);
+  void set_val_or_die(ConfigValues& values, const std::string &key, const std::string &val);
 
   // Set a configuration value.
   // Metavariables will be expanded.
-  int set_val(const std::string &key, const char *val,
+  int set_val(ConfigValues& values, const std::string &key, const char *val,
               std::stringstream *err_ss=nullptr);
-  int set_val(const std::string &key, const string& s,
+  int set_val(ConfigValues& values, const std::string &key, const string& s,
               std::stringstream *err_ss=nullptr) {
-    return set_val(key, s.c_str(), err_ss);
+    return set_val(values, key, s.c_str(), err_ss);
   }
 
   /// clear override value
-  int rm_val(const std::string& key);
+  int rm_val(ConfigValues& values, const std::string& key);
 
   /// get encoded map<string,map<int32_t,string>> of entire config
-  void get_config_bl(uint64_t have_version,
+  void get_config_bl(const ConfigValues& values,
+                    uint64_t have_version,
                     bufferlist *bl,
                     uint64_t *got_version);
 
   /// get encoded map<string,string> of compiled-in defaults
-  void get_defaults_bl(bufferlist *bl);
+  void get_defaults_bl(const ConfigValues& values, bufferlist *bl);
 
   // Get a configuration value.
   // No metavariables will be returned (they will have already been expanded)
-  int get_val(const std::string &key, char **buf, int len) const;
-  int get_val(const std::string &key, std::string *val) const;
-  Option::value_t get_val_generic(const std::string &key) const;
-  template<typename T> const T get_val(const std::string &key) const;
+  int get_val(const ConfigValues& values, const std::string &key, char **buf, int len) const;
+  int get_val(const ConfigValues& values, const std::string &key, std::string *val) const;
+  Option::value_t get_val_generic(const ConfigValues& values, const std::string &key) const;
+  template<typename T> const T get_val(const ConfigValues& values, const std::string &key) const;
   template<typename T, typename Callback, typename...Args>
-  auto with_val(const string& key, Callback&& cb, Args&&... args) const ->
+  auto with_val(const ConfigValues& values, const string& key,
+               Callback&& cb, Args&&... args) const ->
     std::result_of_t<Callback(const T&, Args...)> {
     return std::forward<Callback>(cb)(
-      boost::get<T>(this->get_val_generic(key)),
+      boost::get<T>(this->get_val_generic(values, key)),
       std::forward<Args>(args)...);
   }
 
   void get_all_keys(std::vector<std::string> *keys) const;
 
   // Return a list of all the sections that the current entity is a member of.
-  void get_my_sections(std::vector <std::string> &sections) const;
+  void get_my_sections(const ConfigValues& values,
+                      std::vector <std::string> &sections) const;
 
   // Return a list of all sections
   int get_all_sections(std::vector <std::string> &sections) const;
 
   // Get a value from the configuration file that we read earlier.
   // Metavariables will be expanded if emeta is true.
-  int get_val_from_conf_file(const std::vector <std::string> &sections,
+  int get_val_from_conf_file(const ConfigValues& values,
+                  const std::vector <std::string> &sections,
                   std::string const &key, std::string &out, bool emeta) const;
 
   /// dump all config values to a stream
-  void show_config(std::ostream& out);
+  void show_config(const ConfigValues& values, std::ostream& out);
   /// dump all config values to a formatter
-  void show_config(Formatter *f);
+  void show_config(const ConfigValues& values, Formatter *f);
   
   /// dump all config settings to a formatter
   void config_options(Formatter *f);
 
   /// dump config diff from default, conf, mon, etc.
-  void diff(Formatter *f, std::string name=string{}) const;
+  void diff(const ConfigValues& values,
+           Formatter *f,
+           std::string name=string{}) const;
 
   /// print/log warnings/errors from parsing the config
   void complain_about_parse_errors(CephContext *cct);
@@ -265,35 +273,44 @@ private:
   void validate_schema();
   void validate_default_settings();
 
-  int _get_val_cstr(const std::string &key, char **buf, int len) const;
-  Option::value_t _get_val(const std::string &key,
+  int _get_val_cstr(const ConfigValues& values,
+                   const std::string &key, char **buf, int len) const;
+  Option::value_t _get_val(const ConfigValues& values,
+                          const std::string &key,
                           expand_stack_t *stack=0,
                           std::ostream *err=0) const;
-  Option::value_t _get_val(const Option& o,
+  Option::value_t _get_val(const ConfigValues& values,
+                          const Option& o,
                           expand_stack_t *stack=0,
                           std::ostream *err=0) const;
   const Option::value_t& _get_val_default(const Option& o) const;
-  Option::value_t _get_val_nometa(const Option& o) const;
+  Option::value_t _get_val_nometa(const ConfigValues& values,
+                                 const Option& o) const;
 
-  int _rm_val(const std::string& key, int level);
+  int _rm_val(ConfigValues& values, const std::string& key, int level);
 
-  void _refresh(const Option& opt);
+  void _refresh(ConfigValues& values, const Option& opt);
 
-  void _show_config(std::ostream *out, Formatter *f);
+  void _show_config(const ConfigValues& values,
+                   std::ostream *out, Formatter *f);
 
-  void _get_my_sections(std::vector <std::string> &sections) const;
+  void _get_my_sections(const ConfigValues& values,
+                       std::vector <std::string> &sections) const;
 
   int _get_val_from_conf_file(const std::vector <std::string> &sections,
                              const std::string &key, std::string &out) const;
 
-  int parse_option(std::vector<const char*>& args,
+  int parse_option(ConfigValues& values,
+                  std::vector<const char*>& args,
                   std::vector<const char*>::iterator& i,
                   std::ostream *oss,
                   int level);
-  int parse_injectargs(std::vector<const char*>& args,
-                     std::ostream *oss);
+  int parse_injectargs(ConfigValues& values,
+                      std::vector<const char*>& args,
+                      std::ostream *oss);
 
   int _set_val(
+    ConfigValues& values,
     const std::string &val,
     const Option &opt,
     int level,  // CONF_*
@@ -303,21 +320,25 @@ private:
   void assign_member(member_ptr_t ptr, const Option::value_t &val);
 
 
-  void update_legacy_vals();
-  void update_legacy_val(const Option &opt, member_ptr_t member);
+  void update_legacy_vals(ConfigValues& values);
+  void update_legacy_val(ConfigValues& values,
+                        const Option &opt,
+                        member_ptr_t member);
 
   Option::value_t _expand_meta(
+    const ConfigValues& values,
     const Option::value_t& in,
     const Option *o,
     expand_stack_t *stack,
     std::ostream *err) const;
 
 public:  // for global_init
-  void early_expand_meta(std::string &val,
+  void early_expand_meta(const ConfigValues& values,
+                        std::string &val,
                         std::ostream *oss) const;
 
   // for those want to reexpand special meta, e.g, $pid
-  void finalize_reexpand_meta();
+  void finalize_reexpand_meta(ConfigValues& values, const ConfigProxy& proxy);
 private:
 
   /// expand all metavariables in config structure.
@@ -345,9 +366,9 @@ public:
   string data_dir_option;  ///< data_dir config option, if any
 
 public:
-  unsigned get_osd_pool_default_min_size() const {
-    auto min_size = get_val<uint64_t>("osd_pool_default_min_size");
-    auto size = get_val<uint64_t>("osd_pool_default_size");
+  unsigned get_osd_pool_default_min_size(const ConfigValues& values) const {
+    auto min_size = get_val<uint64_t>(values, "osd_pool_default_min_size");
+    auto size = get_val<uint64_t>(values, "osd_pool_default_size");
     return min_size ? std::min(min_size, size) : (size - size / 2);
   }
 
@@ -362,8 +383,9 @@ public:
 
 template<LockPolicy lp>
 template<typename T>
-const T md_config_impl<lp>::get_val(const std::string &key) const {
-  return boost::get<T>(this->get_val_generic(key));
+const T md_config_impl<lp>::get_val(const ConfigValues& values,
+                                   const std::string &key) const {
+  return boost::get<T>(this->get_val_generic(values, key));
 }
 
 } // namespace ceph::internal
index cbd5746fd56e102a90c14bd4ceefed9ca4706f0d..a84bad08eee8988843f90920003e1af49ff04a0a 100644 (file)
@@ -29,10 +29,10 @@ class md_config_cacher_t : public md_config_obs_t {
     return keys;
   }
 
-  void handle_conf_change(const md_config_t* conf,
+  void handle_conf_change(const ConfigProxy& conf,
                           const std::set<std::string>& changed) override {
     if (changed.count(option_name)) {
-      value_cache.store(conf->get_val<ValueT>(option_name));
+      value_cache.store(conf.get_val<ValueT>(option_name));
     }
   }
 
index fad03b130d459d95a1ac85613c24b63f9e3e484c..c32e44692075376f9f94c314fe77ad3af5322676 100644 (file)
@@ -38,10 +38,10 @@ public:
    * Note that it is not possible to change the set of tracked keys without re-subscribing. */
   virtual const char** get_tracked_conf_keys() const = 0;
   /// React to a configuration change.
-  virtual void handle_conf_change(const md_config_impl<lp>* conf,
+  virtual void handle_conf_change(const ConfigProxy& conf,
                                  const std::set <std::string> &changed) = 0;
   /// Unused for now
-  virtual void handle_subsys_change(const md_config_impl<lp>* conf,
+  virtual void handle_subsys_change(const ConfigProxy& conf,
                                    const std::set<int>& changed) { }
 };
 }
index 71224fca69489a2ae52d3e3faf8d3bd99f66cb83..29d208280c876893abb9fcbf5c0340f1574177e4 100644 (file)
@@ -8,33 +8,36 @@
 #include "common/config.h"
 #include "common/config_fwd.h"
 
-template<bool is_const>
-class ConfigProxyBase {
-protected:
-  using config_t = std::conditional_t<is_const,
-                                     const md_config_t,
-                                     md_config_t>;
-  config_t* config;
-  ConfigProxyBase(config_t* c)
-    : config{c}
-  {}
+class ConfigProxy {
+  /**
+   * The current values of all settings described by the schema
+   */
+
+  ConfigValues values;
+  std::unique_ptr<md_config_t> config;
 public:
+  explicit ConfigProxy(bool is_daemon)
+    : config{std::make_unique<md_config_t>(values, is_daemon)}
+  {}
   const ConfigValues* operator->() const noexcept {
-    return &config->values;
+    return &values;
+  }
+  ConfigValues* operator->() noexcept {
+    return &values;
   }
   int get_val(const std::string& key, char** buf, int len) const {
-    return config->get_val(key, buf, len);
+    return config->get_val(values, key, buf, len);
   }
   int get_val(const std::string &key, std::string *val) const {
-    return config->get_val(key, val);
+    return config->get_val(values, key, val);
   }
   template<typename T>
   const T get_val(const std::string& key) const {
-    return config->template get_val<T>(key);
+    return config->template get_val<T>(values, key);
   }
   template<typename T, typename Callback, typename...Args>
   auto with_val(const string& key, Callback&& cb, Args&&... args) const {
-    return config->template with_val<T>(key, std::forward<Callback>(cb),
+    return config->template with_val<T>(values, key, std::forward<Callback>(cb),
                                        std::forward<Args>(args)...);
   }
   const Option* get_schema(const std::string& key) const {
@@ -49,10 +52,10 @@ public:
     return config->find_option(name);
   }
   void diff(Formatter *f, const std::string& name=string{}) const {
-    return config->diff(f, name);
+    return config->diff(values, f, name);
   }
   void get_my_sections(std::vector <std::string> &sections) const {
-    config->get_my_sections(sections);
+    config->get_my_sections(values, sections);
   }
   int get_all_sections(std::vector<std::string>& sections) const {
     return config->get_all_sections(sections);
@@ -60,32 +63,17 @@ public:
   int get_val_from_conf_file(const std::vector<std::string>& sections,
                             const std::string& key, std::string& out,
                             bool emeta) const {
-    return config->get_val_from_conf_file(sections, key, out, emeta);
+    return config->get_val_from_conf_file(values, sections, key, out, emeta);
   }
   unsigned get_osd_pool_default_min_size() const {
-    return config->get_osd_pool_default_min_size();
+    return config->get_osd_pool_default_min_size(values);
   }
   void early_expand_meta(std::string &val,
                         std::ostream *oss) const {
-    return config->early_expand_meta(val, oss);
+    return config->early_expand_meta(values, val, oss);
   }
-};
-
-class ConfigReader final : public ConfigProxyBase<true> {
-public:
-  explicit ConfigReader(const md_config_t* config)
-    : ConfigProxyBase<true>{config}
-  {}
-};
-
-class ConfigProxy final : public ConfigProxyBase<false> {
-  std::unique_ptr<md_config_t> conf;
-public:
-  explicit ConfigProxy(bool is_daemon)
-    : ConfigProxyBase{nullptr},
-      conf{std::make_unique<md_config_t>(is_daemon)}
-  {
-    config = conf.get();
+  void finalize_reexpand_meta() {
+    config->finalize_reexpand_meta(values, *this);
   }
   void add_observer(md_config_obs_t* obs) {
     config->add_observer(obs);
@@ -100,63 +88,66 @@ public:
     config->_clear_safe_to_start_threads();
   }
   void call_all_observers() {
-    config->call_all_observers();
+    config->call_all_observers(*this);
   }
   void show_config(std::ostream& out) {
-    config->show_config(out);
+    config->show_config(values, out);
   }
   void show_config(Formatter *f) {
-    config->show_config(f);
+    config->show_config(values, f);
   }
   void config_options(Formatter *f) {
     config->config_options(f);
   }
   int rm_val(const std::string& key) {
-    return config->rm_val(key);
+    return config->rm_val(values, key);
   }
   void apply_changes(std::ostream* oss) {
-    config->apply_changes(oss);
+    config->apply_changes(values, *this, oss);
   }
   int set_val(const std::string& key, const string& s,
               std::stringstream* err_ss=nullptr) {
-    return config->set_val(key, s, err_ss);
+    return config->set_val(values, key, s, err_ss);
   }
   void set_val_default(const std::string& key, const std::string& val) {
-    config->set_val_default(key, val);
+    config->set_val_default(values, key, val);
   }
   void set_val_or_die(const std::string& key, const std::string& val) {
-    config->set_val_or_die(key, val);
+    config->set_val_or_die(values, key, val);
   }
   int set_mon_vals(CephContext *cct,
                   const map<std::string,std::string>& kv,
                   md_config_t::config_callback config_cb) {
-    return config->set_mon_vals(cct, kv, config_cb);
+    return config->set_mon_vals(cct, values, *this, kv, config_cb);
   }
   int injectargs(const std::string &s, std::ostream *oss) {
-    return config->injectargs(s, oss);
+    return config->injectargs(values, *this, s, oss);
   }
   void parse_env(const char *env_var = "CEPH_ARGS") {
-    config->parse_env(env_var);
+    config->parse_env(values, env_var);
   }
   int parse_argv(std::vector<const char*>& args, int level=CONF_CMDLINE) {
-    return config->parse_argv(args, level);
+    return config->parse_argv(values, args, level);
   }
   int parse_config_files(const char *conf_files,
                         std::ostream *warnings, int flags) {
-    return config->parse_config_files(conf_files, warnings, flags);
+    return config->parse_config_files(values, conf_files, warnings, flags);
+  }
+  size_t num_parse_errors() const {
+    return config->parse_errors.size();
   }
   void complain_about_parse_errors(CephContext *cct) {
     return config->complain_about_parse_errors(cct);
   }
   void do_argv_commands() {
-    config->do_argv_commands();
+    config->do_argv_commands(values);
   }
   void get_config_bl(uint64_t have_version,
                     bufferlist *bl,
                     uint64_t *got_version) {
-    config->get_config_bl(have_version, bl, got_version);
+    config->get_config_bl(values, have_version, bl, got_version);
   }
   void get_defaults_bl(bufferlist *bl) {
-    config->get_defaults_bl(bl);
+    config->get_defaults_bl(values, bl);
   }
 };
index 5a5af3728d2ae3ba1f030690500da1b6d010bd66..dc3365670b84f2862da9699fe1bbdec7f8883eed 100644 (file)
@@ -123,7 +123,7 @@ struct Observer : public md_config_obs_t {
   const char** get_tracked_conf_keys() const override {
     return (const char **)keys;
   }
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                          const std::set <std::string> &changed) override {
     // do nothing.
   }
index 39989e895cdb790442be66d854f387b6a01d5802..37f5d8f9770f681d1e571f11fa7d018f9105073e 100644 (file)
@@ -305,7 +305,7 @@ global_init(const std::map<std::string,std::string> *defaults,
 #endif
 
   // Expand metavariables. Invoke configuration observers. Open log file.
-  g_conf().apply_changes(NULL);
+  g_conf().apply_changes(nullptr);
 
   if (g_conf()->run_dir.length() &&
       code_env == CODE_ENVIRONMENT_DAEMON &&
index b36d41b880d8e19fac0312a6a446c69be853767c..5af31c28df236fd7d1a7cbca0692c5873fc0056e 100644 (file)
@@ -195,7 +195,7 @@ static void handle_fatal_signal(int signum)
        jf.open_object_section("crash");
        jf.dump_string("crash_id", id);
        now.gmtime(jf.dump_stream("timestamp"));
-       jf.dump_string("entity_name", g_ceph_context->_conf.name().to_str());
+       jf.dump_string("entity_name", g_ceph_context->_conf->name.to_str());
        jf.dump_string("ceph_version", ceph_version_to_str());
 
        struct utsname u;
index 17c283559b6a9a760da363f1602663a37cf797e4..48f98b12331506d09b4118377f1a2295886642d2 100644 (file)
@@ -778,7 +778,7 @@ public:
        "rbd_qos_read_bps_limit", false)(
        "rbd_qos_write_bps_limit", false);
 
-    md_config_t local_config_t;
+    ConfigProxy local_config_t{false};
     std::map<std::string, bufferlist> res;
 
     _filter_metadata_confs(METADATA_CONF_PREFIX, configs, meta, &res);
index abd70c7063b1b35c088ce54ef9f1dc3f1967d260..7c9e29ddcd840664c0deee39123a3e83631cd0bb 100644 (file)
@@ -1414,7 +1414,7 @@ int Operations<I>::metadata_set(const std::string &key,
   bool config_override = util::is_metadata_config_override(key, &config_key);
   if (config_override) {
     // validate config setting
-    int r = md_config_t().set_val(config_key.c_str(), value);
+    int r = ConfigProxy{false}.set_val(config_key.c_str(), value);
     if (r < 0) {
       return r;
     }
index 6ca3267e3ae6481181765fff1847e22e0a1493b8..083ddfb00e2d32cd9e2a8655388df518bb6ad02b 100644 (file)
@@ -551,7 +551,7 @@ public:
   CDir* get_dirfrag(frag_t fg) {
     auto pi = dirfrags.find(fg);
     if (pi != dirfrags.end()) {
-      //assert(g_conf->debug_mds < 2 || dirfragtree.is_leaf(fg)); // performance hack FIXME
+      //assert(g_conf()->debug_mds < 2 || dirfragtree.is_leaf(fg)); // performance hack FIXME
       return pi->second;
     } 
     return NULL;
index e3bbe16c335496a89fa0b7e789344fe89fc40eba..c50ea99db247ef1a3e59f55f217db2472d5835a4 100644 (file)
@@ -7657,10 +7657,10 @@ void MDCache::shutdown_check()
   char *o = old_val;
   g_conf().get_val("debug_mds", &o, sizeof(old_val));
   g_conf().set_val("debug_mds", "10");
-  g_conf().apply_changes(NULL);
+  g_conf().apply_changes(nullptr);
   show_cache();
   g_conf().set_val("debug_mds", old_val);
-  g_conf().apply_changes(NULL);
+  g_conf().apply_changes(nullptr);
   mds->timer.add_event_after(g_conf()->mds_shutdown_check, new C_MDC_ShutdownCheck(this));
 
   // this
index 147ee133472166d108e72eb9c9c15f08274d16e1..e66fcca35c2327515d60f34445e24087fc3db83d 100644 (file)
@@ -329,7 +329,7 @@ protected:
     waiting->insert(pair<uint64_t, pair<uint64_t, MDSInternalContextBase*> >(
                            mask,
                            pair<uint64_t, MDSInternalContextBase*>(seq, c)));
-//    pdout(10,g_conf->debug_mds) << (mdsco_db_line_prefix(this)) 
+//    pdout(10,g_conf()->debug_mds) << (mdsco_db_line_prefix(this)) 
 //                            << "add_waiter " << hex << mask << dec << " " << c
 //                            << " on " << *this
 //                            << dendl;
@@ -348,14 +348,14 @@ protected:
            } else {
              ls.push_back(it->second.second);
         }
-//     pdout(10,g_conf->debug_mds) << (mdsco_db_line_prefix(this))
+//     pdout(10,g_conf()->debug_mds) << (mdsco_db_line_prefix(this))
 //                                << "take_waiting mask " << hex << mask << dec << " took " << it->second
 //                                << " tag " << hex << it->first << dec
 //                                << " on " << *this
 //                                << dendl;
         waiting->erase(it++);
       } else {
-//     pdout(10,g_conf->debug_mds) << "take_waiting mask " << hex << mask << dec << " SKIPPING " << it->second
+//     pdout(10,g_conf()->debug_mds) << "take_waiting mask " << hex << mask << dec << " SKIPPING " << it->second
 //                                << " tag " << hex << it->first << dec
 //                                << " on " << *this 
 //                                << dendl;
index a250de9e5b672aff8942a6e99735190cd421c273..30ddc93e5c43c1cc92a44d40e79bffb739e872aa 100644 (file)
@@ -365,7 +365,7 @@ const char** MDSDaemon::get_tracked_conf_keys() const
   return KEYS;
 }
 
-void MDSDaemon::handle_conf_change(const md_config_t *mconf,
+void MDSDaemon::handle_conf_change(const ConfigProxy& conf,
                             const std::set <std::string> &changed)
 {
   // We may be called within mds_lock (via `tell`) or outwith the
@@ -375,7 +375,6 @@ void MDSDaemon::handle_conf_change(const md_config_t *mconf,
     mds_lock.Lock();
   }
 
-  ConfigReader conf{mconf};
   if (changed.count("mds_op_complaint_time") ||
       changed.count("mds_op_log_threshold")) {
     if (mds_rank) {
@@ -416,7 +415,7 @@ void MDSDaemon::handle_conf_change(const md_config_t *mconf,
   }
 
   if (mds_rank) {
-    mds_rank->handle_conf_change(mconf, changed);
+    mds_rank->handle_conf_change(conf, changed);
   }
 
   if (!initially_locked) {
index be192f5dd15ca305580077b155217e0a3b436476..93d59008a18c8a32c54d92ce1851ea98675b02a7 100644 (file)
@@ -94,7 +94,7 @@ class MDSDaemon : public Dispatcher, public md_config_obs_t {
 
   // config observer bits
   const char** get_tracked_conf_keys() const override;
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                          const std::set <std::string> &changed) override;
  protected:
   // tick and other timer fun
index dca36a51384e83c3a3cee8c4dcc3a9b5b0f218f0..dab99d5b6fefc94e4ced2281a1c9174e0c315da0 100644 (file)
@@ -221,7 +221,7 @@ class MDSRank {
 
     void handle_write_error(int err);
 
-    void handle_conf_change(const md_config_t *conf,
+    void handle_conf_change(const ConfigProxy& conf,
                             const std::set <std::string> &changed)
     {
       mdcache->migrator->handle_conf_change(conf, changed, *mdsmap);
index 4e6d9dd81f2bed6eb9ca3d629bcb4dc9539a3a9c..fa79c0456d9a74c54985daa1896c6c3a7823e3ce 100644 (file)
@@ -3438,12 +3438,12 @@ void Migrator::logged_import_caps(CInode *in,
   in->auth_unpin(this);
 }
 
-void Migrator::handle_conf_change(const md_config_t* conf,
+void Migrator::handle_conf_change(const ConfigProxy& conf,
                                   const std::set <std::string> &changed,
                                   const MDSMap &mds_map)
 {
   if (changed.count("mds_inject_migrator_session_race")) {
-    inject_session_race = conf->get_val<bool>("mds_inject_migrator_session_race");
+    inject_session_race = conf.get_val<bool>("mds_inject_migrator_session_race");
     dout(0) << "mds_inject_migrator_session_race is " << inject_session_race << dendl;
   }
 }
index b0399b72b1b27ed7550b8cb170e91965faad0b58..ee2509b6e25083b8f8346cf3d3238ba21443900c 100644 (file)
@@ -106,7 +106,7 @@ public:
     inject_session_race = g_conf().get_val<bool>("mds_inject_migrator_session_race");
   }
 
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                           const std::set <std::string> &changed,
                           const MDSMap &mds_map);
 
index 60012db79c448243b02190848cc6900bbd60b29c..c71a5bc5d3360f49a5efa0fb1198c534953568aa 100644 (file)
@@ -590,7 +590,7 @@ void PurgeQueue::update_op_limit(const MDSMap &mds_map)
   }
 }
 
-void PurgeQueue::handle_conf_change(const md_config_t *mconf,
+void PurgeQueue::handle_conf_change(const ConfigProxy& conf,
                             const std::set <std::string> &changed,
                              const MDSMap &mds_map)
 {
@@ -598,7 +598,6 @@ void PurgeQueue::handle_conf_change(const md_config_t *mconf,
       || changed.count("mds_max_purge_ops_per_pg")) {
     update_op_limit(mds_map);
   } else if (changed.count("mds_max_purge_files")) {
-    ConfigReader conf{mconf};
     Mutex::Locker l(lock);
     if (in_flight.empty()) {
       // We might have gone from zero to a finite limit, so
index 4c4de89fa4344a6e2846a47aaa05ea9a3d82c44c..ae2c358745d4cff61360c12bc4dba6d32a4d4c0b 100644 (file)
@@ -176,7 +176,7 @@ public:
 
   void update_op_limit(const MDSMap &mds_map);
 
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                           const std::set <std::string> &changed,
                           const MDSMap &mds_map);
 
index 63eca2f6b6d56d4222b38b702d545d9fd83c4264..d94e663ae1e0eca3fe86bf49be44674fdce199e5 100644 (file)
@@ -2206,7 +2206,7 @@ const char** DaemonServer::get_tracked_conf_keys() const
   return KEYS;
 }
 
-void DaemonServer::handle_conf_change(const md_config_t *conf,
+void DaemonServer::handle_conf_change(const ConfigProxy& conf,
                                      const std::set <std::string> &changed)
 {
   // We may be called within lock (via MCommand `config set`) or outwith the
index c10b4708125bae86c7ef2308cfd1c625a70cac37..26554a47283c3880ad8c9682d4937164e8694116 100644 (file)
@@ -145,7 +145,7 @@ public:
   void _send_configure(ConnectionRef c);
 
   virtual const char** get_tracked_conf_keys() const override;
-  virtual void handle_conf_change(const md_config_t *conf,
+  virtual void handle_conf_change(const ConfigProxy& conf,
                           const std::set <std::string> &changed) override;
 };
 
index 57289b31f64e5d05d533c17beb3fe6e2550cf7e2..57ceaeeb8da3dc3fdb7fb49a7794b14d58104555 100644 (file)
@@ -84,7 +84,7 @@ const char** MgrStandby::get_tracked_conf_keys() const
 }
 
 void MgrStandby::handle_conf_change(
-  const md_config_t *conf,
+  const ConfigProxy& conf,
   const std::set <std::string> &changed)
 {
   if (changed.count("clog_to_monitors") ||
index bda41ffcefdd190e11147c02f76314132dd03472..9b1071117ee6fe1e461589c3c252a52f3e8794fa 100644 (file)
@@ -35,7 +35,7 @@ class MgrStandby : public Dispatcher,
 public:
   // config observer bits
   const char** get_tracked_conf_keys() const override;
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                          const std::set <std::string> &changed) override;
 
 protected:
index 4209c4aa401a67061ddc7ca4505a298de8515484..95ea2bda5aab7e85f39e6de10553327c325011e2 100644 (file)
@@ -828,7 +828,7 @@ ceph::logging::Graylog::Ref LogMonitor::log_channel_info::get_graylog(
   return graylogs[channel];
 }
 
-void LogMonitor::handle_conf_change(const md_config_t *conf,
+void LogMonitor::handle_conf_change(const ConfigProxy& conf,
                                     const std::set<std::string> &changed)
 {
   if (changed.count("mon_cluster_log_to_syslog") ||
index f7c003489c8919485395ce0de0d9a2fdbc4fb97b..964058418aa9fb6eeb089d1de948c910059c2d5e 100644 (file)
@@ -199,7 +199,7 @@ private:
     };
     return KEYS;
   }
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                           const std::set<std::string> &changed) override;
 };
 #endif
index ff31d211c5c133cd5df0913886063d180ab45e0e..c43d5faa644dbc2eaa53c6cae773a88617619a18 100644 (file)
@@ -495,7 +495,7 @@ const char** Monitor::get_tracked_conf_keys() const
   return KEYS;
 }
 
-void Monitor::handle_conf_change(const md_config_t *mconf,
+void Monitor::handle_conf_change(const ConfigProxy& conf,
                                  const std::set<std::string> &changed)
 {
   sanitize_options();
@@ -521,7 +521,6 @@ void Monitor::handle_conf_change(const md_config_t *mconf,
   }
 
   if (changed.count("mon_scrub_interval")) {
-    ConfigReader conf{mconf};
     scrub_update_interval(conf->mon_scrub_interval);
   }
 }
index e078d691082e57e6542e8f45883eb340166325cc..a7e200815fd27c169e19c8c58619fd253d8e0af4 100644 (file)
@@ -921,7 +921,7 @@ public:
 
   // config observer
   const char** get_tracked_conf_keys() const override;
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                           const std::set<std::string> &changed) override;
 
   void update_log_clients();
index a48e99d435bfc55584dbd10a4f6c1db4cad26078..bb2f807f4bb5b73250037e9db06b1273c7b14e60 100644 (file)
@@ -181,14 +181,14 @@ DPDKWorker::Impl::Impl(CephContext *cct, unsigned i, EventCenter *c, std::shared
     : id(i), _netif(cct, dev, c), _dev(dev), _inet(cct, c, &_netif)
 {
   vector<AvailableIPAddress> tuples;
-  bool parsed = parse_available_address(cct->_conf->get_val<std::string>("ms_dpdk_host_ipv4_addr"),
-                                        cct->_conf->get_val<std::string>("ms_dpdk_gateway_ipv4_addr"),
-                                        cct->_conf->get_val<std::string>("ms_dpdk_netmask_ipv4_addr"), tuples);
+  bool parsed = parse_available_address(cct->_conf.get_val<std::string>("ms_dpdk_host_ipv4_addr"),
+                                        cct->_conf.get_val<std::string>("ms_dpdk_gateway_ipv4_addr"),
+                                        cct->_conf.get_val<std::string>("ms_dpdk_netmask_ipv4_addr"), tuples);
   if (!parsed) {
     lderr(cct) << __func__ << " no available address "
-               << cct->_conf->get_val<std::string>("ms_dpdk_host_ipv4_addr") << ", "
-               << cct->_conf->get_val<std::string>("ms_dpdk_gateway_ipv4_addr") << ", "
-               << cct->_conf->get_val<std::string>("ms_dpdk_netmask_ipv4_addr") << ", "
+               << cct->_conf.get_val<std::string>("ms_dpdk_host_ipv4_addr") << ", "
+               << cct->_conf.get_val<std::string>("ms_dpdk_gateway_ipv4_addr") << ", "
+               << cct->_conf.get_val<std::string>("ms_dpdk_netmask_ipv4_addr") << ", "
                << dendl;
     ceph_abort();
   }
index 4c1cf9f023792f4fe69a2a79909f573e0d92f1f0..9f9d343b51a2d12b6df9a70552d416bbdcabc199 100644 (file)
@@ -52,7 +52,7 @@ namespace dpdk {
     }
 
     bool done = false;
-    auto num = std::stoull(c->_conf->get_val<std::string>("ms_dpdk_coremask"),
+    auto num = std::stoull(c->_conf.get_val<std::string>("ms_dpdk_coremask"),
                            nullptr, 16);
     unsigned int coremaskbit = bitcount(num);
 
@@ -62,7 +62,7 @@ namespace dpdk {
       // TODO: Inherit these from the app parameters - "opts"
       std::vector<std::vector<char>> args {
           string2vector(string("ceph")),
-          string2vector("-c"), string2vector(c->_conf->get_val<std::string>("ms_dpdk_coremask")),
+          string2vector("-c"), string2vector(c->_conf.get_val<std::string>("ms_dpdk_coremask")),
           string2vector("-n"), string2vector(c->_conf->ms_dpdk_memory_channel),
       };
 
index 45404abc2142f3e5de92041ac1a7263402aef437..79d163996ea6af7186272c76e07c1c943247d066 100644 (file)
@@ -3828,7 +3828,7 @@ const char **BlueStore::get_tracked_conf_keys() const
   return KEYS;
 }
 
-void BlueStore::handle_conf_change(const md_config_t *mconf,
+void BlueStore::handle_conf_change(const ConfigProxy& conf,
                                   const std::set<std::string> &changed)
 {
   if (changed.count("bluestore_csum_type")) {
@@ -3869,7 +3869,6 @@ void BlueStore::handle_conf_change(const md_config_t *mconf,
       _set_throttle_params();
     }
   }
-  ConfigReader conf{mconf};
   if (changed.count("bluestore_throttle_bytes")) {
     throttle_bytes.reset_max(conf->bluestore_throttle_bytes);
     throttle_deferred_bytes.reset_max(
index ecc6a9994ac1883b56c4796ce8a2996a30c8b70f..bfd2c2eef8cb3fcca6ed91ebf7517ca38689b9ca 100644 (file)
@@ -131,7 +131,7 @@ class BlueStore : public ObjectStore,
 public:
   // config observer
   const char** get_tracked_conf_keys() const override;
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                          const std::set<std::string> &changed) override;
 
   //handler for discard event
index 606691bbefbb58e214474d0eb350d9ae68d0e392..1cad25ce28fa992ee5c538e1a8f2c4f0a049e5c2 100644 (file)
@@ -95,7 +95,7 @@ int PMEMDevice::open(const string& p)
   // blksize doesn't strictly matter except that some file systems may
   // require a read/modify/write if we write something smaller than
   // it.
-  block_size = g_conf->bdev_block_size;
+  block_size = g_conf()->bdev_block_size;
   if (block_size != (unsigned)st.st_blksize) {
     dout(1) << __func__ << " backing device/file reports st_blksize "
       << st.st_blksize << ", using bdev_block_size "
@@ -219,8 +219,8 @@ int PMEMDevice::write(uint64_t off, bufferlist& bl, bool buffered)
   bl.hexdump(*_dout);
   *_dout << dendl;
 
-  if (g_conf->bdev_inject_crash &&
-      rand() % g_conf->bdev_inject_crash == 0) {
+  if (g_conf()->bdev_inject_crash &&
+      rand() % g_conf()->bdev_inject_crash == 0) {
     derr << __func__ << " bdev_inject_crash: dropping io " << off << "~" << len
       << dendl;
     ++injecting_crash;
index 6f5d4cc69c5326c0c245e85f5553c4893243cf81..db4eac55d9a6ea162f156403e16ac1028cab77c1 100644 (file)
@@ -97,9 +97,8 @@ public:
     };
     return KEYS;
   }
-  void handle_conf_change(const md_config_t *mconf,
+  void handle_conf_change(const ConfigProxy& conf,
                          const std::set<std::string> &changed) override {
-    ConfigReader conf{mconf};
     if (changed.count("filestore_fd_cache_size")) {
       for (int i = 0; i < registry_shards; ++i)
         registry[i].set_size(
index 2ee22f8b39475411241bee364d84b5267cb35171..9502ea299b01ede8214dde108ab05fbeb57c592a 100644 (file)
@@ -308,7 +308,7 @@ private:
   int set_throttle_params();
   const char** get_tracked_conf_keys() const override;
   void handle_conf_change(
-    const md_config_t *conf,
+    const ConfigProxy& conf,
     const std::set <std::string> &changed) override {
     for (const char **i = get_tracked_conf_keys();
         *i;
index 4e4e7feb76c7cea40aa9818cefac65c39ba64888..133ab5e7e1aadbfcd3a7f3c16446781013f52762 100644 (file)
@@ -5882,7 +5882,7 @@ const char** FileStore::get_tracked_conf_keys() const
   return KEYS;
 }
 
-void FileStore::handle_conf_change(const md_config_t *mconf,
+void FileStore::handle_conf_change(const ConfigProxy& conf,
                          const std::set <std::string> &changed)
 {
   if (changed.count("filestore_max_inline_xattr_size") ||
@@ -5915,7 +5915,6 @@ void FileStore::handle_conf_change(const md_config_t *mconf,
     set_throttle_params();
   }
 
-  ConfigReader conf{mconf};
   if (changed.count("filestore_min_sync_interval") ||
       changed.count("filestore_max_sync_interval") ||
       changed.count("filestore_kill_at") ||
index 92e8cd26ef5401a86a155e6d2c52467697afd2ac..84fe1ca76d2e059d06a5214613f49ae8370c8f45 100644 (file)
@@ -790,7 +790,7 @@ private:
                               const SequencerPosition &spos);
 
   const char** get_tracked_conf_keys() const override;
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                           const std::set <std::string> &changed) override;
   int set_throttle_params();
   float m_filestore_commit_timeout;
index b9ac4f2392f3ae9bc5dbb6b58b240f446786ae2a..ddffffc574757493ba1b741cce94f51a75b4d2a7 100644 (file)
@@ -118,7 +118,7 @@ void WBThrottle::set_from_conf()
   cond.Signal();
 }
 
-void WBThrottle::handle_conf_change(const md_config_t *conf,
+void WBThrottle::handle_conf_change(const ConfigProxy& conf,
                                    const std::set<std::string> &changed)
 {
   Mutex::Locker l(lock);
index b10b0bb8e3b9884dfc31d02d517545230af3f4ea..06e4906e5c663f2fdbae83cccd8400fb505019e1 100644 (file)
@@ -177,7 +177,7 @@ public:
 
   /// md_config_obs_t
   const char** get_tracked_conf_keys() const override;
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                          const std::set<std::string> &changed) override;
 
   /// Thread
index 88ccebfaf3b5c0f8a59c375279c2bb1ecc5cc411..eedc5cf013b8607f8b6a36fc7d26b3670619a877 100644 (file)
@@ -3259,7 +3259,7 @@ int OSD::shutdown()
     cct->_conf.set_val("debug_filestore", "100");
     cct->_conf.set_val("debug_bluestore", "100");
     cct->_conf.set_val("debug_ms", "100");
-    cct->_conf.apply_changes(NULL);
+    cct->_conf.apply_changes(nullptr);
   }
 
   // stop MgrClient earlier as it's more like an internal consumer of OSD
@@ -5002,7 +5002,7 @@ void TestOpsSocketHook::test_ops(OSDService *service, ObjectStore *store,
         << r;
       return;
     }
-    service->cct->_conf.apply_changes(NULL);
+    service->cct->_conf.apply_changes(nullptr);
     ss << "set_recovery_delay: set osd_recovery_delay_start "
        << "to " << service->cct->_conf->osd_recovery_delay_start;
     return;
@@ -6126,7 +6126,7 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
         << r;
       goto out;
     }
-    cct->_conf.apply_changes(NULL);
+    cct->_conf.apply_changes(nullptr);
     ss << "kicking recovery queue. set osd_recovery_delay_start "
        << "to " << cct->_conf->osd_recovery_delay_start;
   }
@@ -8986,7 +8986,7 @@ const char** OSD::get_tracked_conf_keys() const
   return KEYS;
 }
 
-void OSD::handle_conf_change(const md_config_t *conf,
+void OSD::handle_conf_change(const ConfigProxy& conf,
                             const std::set <std::string> &changed)
 {
   if (changed.count("osd_max_backfills")) {
@@ -9035,7 +9035,7 @@ void OSD::handle_conf_change(const md_config_t *conf,
     update_log_config();
   }
   if (changed.count("osd_pg_epoch_max_lag_factor")) {
-    m_osd_pg_epoch_max_lag_factor = conf->get_val<double>(
+    m_osd_pg_epoch_max_lag_factor = conf.get_val<double>(
       "osd_pg_epoch_max_lag_factor");
   }
 
index 0eb44d504fe2ed78d30caa7cc38dd4254a51c58a..2decffed89bcf5d7811206253c1a2c1f06207030 100644 (file)
@@ -1230,7 +1230,7 @@ class OSD : public Dispatcher,
 public:
   // config observer bits
   const char** get_tracked_conf_keys() const override;
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                           const std::set <std::string> &changed) override;
   void update_log_config();
   void check_config();
index 32041e09e32fd27fe3dcdefaf2c400ac5274a8a3..c6e4e8cd5d70c7cc2a46858d409c151efdaa7e8e 100644 (file)
@@ -216,7 +216,7 @@ const char** Objecter::get_tracked_conf_keys() const
 }
 
 
-void Objecter::handle_conf_change(const md_config_t *conf,
+void Objecter::handle_conf_change(const ConfigProxy& conf,
                                  const std::set <std::string> &changed)
 {
   if (changed.count("crush_location")) {
index ac79a7c684fe6e11c47d202ac2976c1dbfeebd42..bc13542fa4d53bfff049e2e8844607f9f9421f6c 100644 (file)
@@ -1207,7 +1207,7 @@ class Objecter : public md_config_obs_t, public Dispatcher {
 public:
   // config observer bits
   const char** get_tracked_conf_keys() const override;
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                           const std::set <std::string> &changed) override;
 
 public:
index 6e5d7e6d6c86688d4a127f588ed108591395bf66..faa0f5c23aefa5b1f1248c2d7a032f641ab1d2dc 100644 (file)
@@ -451,7 +451,7 @@ namespace rgw {
   int RGWLibFrontend::init()
   {
     pprocess = new RGWLibProcess(g_ceph_context, &env,
-                                g_conf->rgw_thread_pool_size, conf);
+                                g_conf()->rgw_thread_pool_size, conf);
     return 0;
   }
 
@@ -481,7 +481,7 @@ namespace rgw {
     SafeTimer init_timer(g_ceph_context, mutex);
     init_timer.init();
     mutex.Lock();
-    init_timer.add_event_after(g_conf->rgw_init_timeout, new C_InitTimeout);
+    init_timer.add_event_after(g_conf()->rgw_init_timeout, new C_InitTimeout);
     mutex.Unlock();
 
     common_init_finish(g_ceph_context);
@@ -491,11 +491,11 @@ namespace rgw {
     rgw_init_resolver();
 
     store = RGWStoreManager::get_storage(g_ceph_context,
-                                        g_conf->rgw_enable_gc_threads,
-                                        g_conf->rgw_enable_lc_threads,
-                                        g_conf->rgw_enable_quota_threads,
-                                        g_conf->rgw_run_sync_thread,
-                                        g_conf->rgw_dynamic_resharding);
+                                        g_conf()->rgw_enable_gc_threads,
+                                        g_conf()->rgw_enable_lc_threads,
+                                        g_conf()->rgw_enable_quota_threads,
+                                        g_conf()->rgw_run_sync_thread,
+                                        g_conf()->rgw_dynamic_resharding);
 
     if (!store) {
       mutex.Lock();
@@ -538,9 +538,9 @@ namespace rgw {
 
     // XXX ex-RGWRESTMgr_lib, mgr->set_logging(true)
 
-    if (!g_conf->rgw_ops_log_socket_path.empty()) {
-      olog = new OpsLogSocket(g_ceph_context, g_conf->rgw_ops_log_data_backlog);
-      olog->init(g_conf->rgw_ops_log_socket_path);
+    if (!g_conf()->rgw_ops_log_socket_path.empty()) {
+      olog = new OpsLogSocket(g_ceph_context, g_conf()->rgw_ops_log_data_backlog);
+      olog->init(g_conf()->rgw_ops_log_socket_path);
     }
 
     int port = 80;
index fe036c124a1f24f2e2e4b4aa8a7e2026ee4ab4df..2cdccc34c55793f810cc379b72c230896e3f7038 100644 (file)
@@ -92,7 +92,7 @@ namespace rgw {
     SafeTimer init_timer(g_ceph_context, mutex);
     init_timer.init();
     mutex.Lock();
-    init_timer.add_event_after(g_conf->rgw_init_timeout, new C_InitTimeout);
+    init_timer.add_event_after(g_conf()->rgw_init_timeout, new C_InitTimeout);
     mutex.Unlock();
 
     common_init_finish(g_ceph_context);
index 155542d62df39b7c0853fd57f2cf916f06c5d623..685f94de35c45d1c07a0baaee2fa895578c51b2d 100644 (file)
@@ -2588,8 +2588,8 @@ int main(int argc, const char **argv)
                          CODE_ENVIRONMENT_UTILITY, 0);
 
   // for region -> zonegroup conversion (must happen before common_init_finish())
-  if (!g_conf->rgw_region.empty() && g_conf->rgw_zonegroup.empty()) {
-    g_conf->set_val_or_die("rgw_zonegroup", g_conf->rgw_region.c_str());
+  if (!g_conf()->rgw_region.empty() && g_conf()->rgw_zonegroup.empty()) {
+    g_conf().set_val_or_die("rgw_zonegroup", g_conf()->rgw_region.c_str());
   }
 
   common_init_finish(g_ceph_context);
@@ -3159,9 +3159,9 @@ int main(int argc, const char **argv)
     exit(1);
   }
 
-  realm_name = g_conf->rgw_realm;
-  zone_name = g_conf->rgw_zone;
-  zonegroup_name = g_conf->rgw_zonegroup;
+  realm_name = g_conf()->rgw_realm;
+  zone_name = g_conf()->rgw_zone;
+  zonegroup_name = g_conf()->rgw_zonegroup;
 
   RGWStreamFlusher f(formatter, cout);
 
@@ -3254,7 +3254,7 @@ int main(int argc, const char **argv)
     store = RGWStoreManager::get_raw_storage(g_ceph_context);
   } else {
     store = RGWStoreManager::get_storage(g_ceph_context, false, false, false, false, false,
-      need_cache && g_conf->rgw_cache_enabled);
+      need_cache && g_conf()->rgw_cache_enabled);
   }
   if (!store) {
     cerr << "couldn't init storage provider" << std::endl;
@@ -6154,7 +6154,7 @@ next:
     int ret = br.cancel();
     if (ret < 0) {
       if (ret == -EBUSY) {
-       cerr << "There is ongoing resharding, please retry after " << g_conf->rgw_reshard_bucket_lock_duration <<
+       cerr << "There is ongoing resharding, please retry after " << g_conf()->rgw_reshard_bucket_lock_duration <<
             " seconds " << std::endl;
       } else {
        cerr << "Error canceling bucket " << bucket_name << " resharding: " << cpp_strerror(-ret) <<
@@ -6679,7 +6679,7 @@ next:
       return -ret;
     }
 
-    auto num_shards = g_conf->rgw_md_log_max_shards;
+    auto num_shards = g_conf()->rgw_md_log_max_shards;
     ret = crs.run(create_admin_meta_log_trim_cr(store, &http, num_shards));
     if (ret < 0) {
       cerr << "automated mdlog trim failed with " << cpp_strerror(ret) << std::endl;
index c3e011c312048735ac7a4faaebe4c3996eee41f4..101f031f3ad48d4af801e71f443d2a7a15d686a1 100644 (file)
@@ -283,7 +283,7 @@ TokenEngine::authenticate(const std::string& token,
   }
 
   ldout(cct, 0) << "user does not hold a matching role; required roles: "
-                << g_conf->rgw_keystone_accepted_roles << dendl;
+                << g_conf()->rgw_keystone_accepted_roles << dendl;
 
   return result_t::deny(-EPERM);
 }
index 7d7325d9439c3e3998639911f1bae944d07c3344..bd98c52d5996a738242d6c4aaa81a4a0a5a302de 100644 (file)
@@ -52,7 +52,7 @@ int RGWCivetWebFrontend::run()
   auto& conf_map = conf->get_config_map();
 
   set_conf_default(conf_map, "num_threads",
-                   std::to_string(g_conf->rgw_thread_pool_size));
+                   std::to_string(g_conf()->rgw_thread_pool_size));
   set_conf_default(conf_map, "decode_url", "no");
   set_conf_default(conf_map, "enable_keep_alive", "yes");
   set_conf_default(conf_map, "validate_http_method", "no");
index 3d6eac2b5dde3f3851193bb21714740ab68ceeda..525dedca5483ba716df9b666067fffdcfbdb0609 100644 (file)
@@ -24,12 +24,12 @@ void RGWFCGXProcess::run()
   int socket_backlog;
 
   conf->get_val("socket_path", "", &socket_path);
-  conf->get_val("socket_port", g_conf->rgw_port, &socket_port);
-  conf->get_val("socket_host", g_conf->rgw_host, &socket_host);
-  socket_backlog = g_conf->rgw_fcgi_socket_backlog;
+  conf->get_val("socket_port", g_conf()->rgw_port, &socket_port);
+  conf->get_val("socket_host", g_conf()->rgw_host, &socket_host);
+  socket_backlog = g_conf()->rgw_fcgi_socket_backlog;
 
   if (socket_path.empty() && socket_port.empty() && socket_host.empty()) {
-    socket_path = g_conf->rgw_socket_path;
+    socket_path = g_conf()->rgw_socket_path;
     if (socket_path.empty()) {
       dout(0) << "ERROR: no socket server point defined, cannot "
        "start fcgi frontend" << dendl;
index 75bdd86d748c100093e4961e16210716e9b6c6ee..80746b955b56ac249742a4459ee5eaa2716fc68d 100644 (file)
@@ -194,7 +194,7 @@ public:
 
   int init() override {
     pprocess = new RGWFCGXProcess(g_ceph_context, &env,
-                                 g_conf->rgw_thread_pool_size, conf);
+                                 g_conf()->rgw_thread_pool_size, conf);
     return 0;
   }
 }; /* RGWFCGXFrontend */
@@ -206,7 +206,7 @@ public:
 
   int init() override {
     int num_threads;
-    conf->get_val("num_threads", g_conf->rgw_thread_pool_size, &num_threads);
+    conf->get_val("num_threads", g_conf()->rgw_thread_pool_size, &num_threads);
     RGWLoadGenProcess *pp = new RGWLoadGenProcess(g_ceph_context, &env,
                                                  num_threads, conf);
 
index 8bfccf1212a64bbe910825c4b1a672a5ee42a499..b046a5764ca73ddb2ec0da0e6a236c79944721bd 100644 (file)
@@ -197,8 +197,8 @@ int main(int argc, const char **argv)
     flags);
 
   list<string> frontends;
-  g_conf->early_expand_meta(g_conf->rgw_frontends, &cerr);
-  get_str_list(g_conf->rgw_frontends, ",", frontends);
+  g_conf().early_expand_meta(g_conf()->rgw_frontends, &cerr);
+  get_str_list(g_conf()->rgw_frontends, ",", frontends);
   multimap<string, RGWFrontendConfig *> fe_map;
   list<RGWFrontendConfig *> configs;
   if (frontends.empty()) {
@@ -245,32 +245,32 @@ int main(int argc, const char **argv)
                         flags, "rgw_data", false);
 
   // maintain existing region root pool for new multisite objects
-  if (!g_conf->rgw_region_root_pool.empty()) {
-    const char *root_pool = g_conf->rgw_region_root_pool.c_str();
-    if (g_conf->rgw_zonegroup_root_pool.empty()) {
-      g_conf->set_val_or_die("rgw_zonegroup_root_pool", root_pool);
+  if (!g_conf()->rgw_region_root_pool.empty()) {
+    const char *root_pool = g_conf()->rgw_region_root_pool.c_str();
+    if (g_conf()->rgw_zonegroup_root_pool.empty()) {
+      g_conf().set_val_or_die("rgw_zonegroup_root_pool", root_pool);
     }
-    if (g_conf->rgw_period_root_pool.empty()) {
-      g_conf->set_val_or_die("rgw_period_root_pool", root_pool);
+    if (g_conf()->rgw_period_root_pool.empty()) {
+      g_conf().set_val_or_die("rgw_period_root_pool", root_pool);
     }
-    if (g_conf->rgw_realm_root_pool.empty()) {
-      g_conf->set_val_or_die("rgw_realm_root_pool", root_pool);
+    if (g_conf()->rgw_realm_root_pool.empty()) {
+      g_conf().set_val_or_die("rgw_realm_root_pool", root_pool);
     }
   }
 
   // for region -> zonegroup conversion (must happen before common_init_finish())
-  if (!g_conf->rgw_region.empty() && g_conf->rgw_zonegroup.empty()) {
-    g_conf->set_val_or_die("rgw_zonegroup", g_conf->rgw_region.c_str());
+  if (!g_conf()->rgw_region.empty() && g_conf()->rgw_zonegroup.empty()) {
+    g_conf().set_val_or_die("rgw_zonegroup", g_conf()->rgw_region.c_str());
   }
 
-  if (g_conf->daemonize) {
+  if (g_conf()->daemonize) {
     global_init_daemonize(g_ceph_context);
   }
   Mutex mutex("main");
   SafeTimer init_timer(g_ceph_context, mutex);
   init_timer.init();
   mutex.Lock();
-  init_timer.add_event_after(g_conf->rgw_init_timeout, new C_InitTimeout);
+  init_timer.add_event_after(g_conf()->rgw_init_timeout, new C_InitTimeout);
   mutex.Unlock();
 
   // Enable the perf counter before starting the service thread
@@ -299,8 +299,8 @@ int main(int argc, const char **argv)
 #endif
 
   RGWRados *store = RGWStoreManager::get_storage(g_ceph_context,
-      g_conf->rgw_enable_gc_threads, g_conf->rgw_enable_lc_threads, g_conf->rgw_enable_quota_threads,
-      g_conf->rgw_run_sync_thread, g_conf->rgw_dynamic_resharding, g_conf->rgw_cache_enabled);
+      g_conf()->rgw_enable_gc_threads, g_conf()->rgw_enable_lc_threads, g_conf()->rgw_enable_quota_threads,
+      g_conf()->rgw_run_sync_thread, g_conf()->rgw_dynamic_resharding, g_conf()->rgw_cache_enabled);
   if (!store) {
     mutex.Lock();
     init_timer.cancel_all_events();
@@ -332,7 +332,7 @@ int main(int argc, const char **argv)
 
   list<string> apis;
 
-  get_str_list(g_conf->rgw_enable_apis, apis);
+  get_str_list(g_conf()->rgw_enable_apis, apis);
 
   map<string, bool> apis_map;
   for (list<string>::iterator li = apis.begin(); li != apis.end(); ++li) {
@@ -342,7 +342,7 @@ int main(int argc, const char **argv)
   // S3 website mode is a specialization of S3
   const bool s3website_enabled = apis_map.count("s3website") > 0;
   // Swift API entrypoint could placed in the root instead of S3
-  const bool swift_at_root = g_conf->rgw_swift_url_prefix == "/";
+  const bool swift_at_root = g_conf()->rgw_swift_url_prefix == "/";
   if (apis_map.count("s3") > 0 || s3website_enabled) {
     if (! swift_at_root) {
       rest.register_default_mgr(set_logging(rest_filter(store, RGW_REST_S3,
@@ -357,7 +357,7 @@ int main(int argc, const char **argv)
   if (apis_map.count("swift") > 0) {
     RGWRESTMgr_SWIFT* const swift_resource = new RGWRESTMgr_SWIFT;
 
-    if (! g_conf->rgw_cross_domain_policy.empty()) {
+    if (! g_conf()->rgw_cross_domain_policy.empty()) {
       swift_resource->register_resource("crossdomain.xml",
                           set_logging(new RGWRESTMgr_SWIFT_CrossDomain));
     }
@@ -369,7 +369,7 @@ int main(int argc, const char **argv)
                           set_logging(new RGWRESTMgr_SWIFT_Info));
 
     if (! swift_at_root) {
-      rest.register_resource(g_conf->rgw_swift_url_prefix,
+      rest.register_resource(g_conf()->rgw_swift_url_prefix,
                           set_logging(rest_filter(store, RGW_REST_SWIFT,
                                                   swift_resource)));
     } else {
@@ -384,7 +384,7 @@ int main(int argc, const char **argv)
   }
 
   if (apis_map.count("swift_auth") > 0) {
-    rest.register_resource(g_conf->rgw_swift_auth_entry,
+    rest.register_resource(g_conf()->rgw_swift_auth_entry,
                set_logging(new RGWRESTMgr_SWIFT_Auth));
   }
 
@@ -400,7 +400,7 @@ int main(int argc, const char **argv)
     admin_resource->register_resource("opstate", new RGWRESTMgr_Opstate);
     admin_resource->register_resource("config", new RGWRESTMgr_Config);
     admin_resource->register_resource("realm", new RGWRESTMgr_Realm);
-    rest.register_resource(g_conf->rgw_admin_entry, admin_resource);
+    rest.register_resource(g_conf()->rgw_admin_entry, admin_resource);
   }
 
   /* Initialize the registry of auth strategies which will coordinate
@@ -409,13 +409,13 @@ int main(int argc, const char **argv)
     rgw::auth::StrategyRegistry::create(g_ceph_context, store);
 
   /* Header custom behavior */
-  rest.register_x_headers(g_conf->rgw_log_http_headers);
+  rest.register_x_headers(g_conf()->rgw_log_http_headers);
 
   OpsLogSocket *olog = NULL;
 
-  if (!g_conf->rgw_ops_log_socket_path.empty()) {
-    olog = new OpsLogSocket(g_ceph_context, g_conf->rgw_ops_log_data_backlog);
-    olog->init(g_conf->rgw_ops_log_socket_path);
+  if (!g_conf()->rgw_ops_log_socket_path.empty()) {
+    olog = new OpsLogSocket(g_ceph_context, g_conf()->rgw_ops_log_data_backlog);
+    olog->init(g_conf()->rgw_ops_log_socket_path);
   }
 
   r = signal_fd_init();
index 9c8484ef592f66ad5a0e454c65da210166a42450..93258b4208b72dd68c93bfcdafdfe557277d5355 100644 (file)
@@ -75,7 +75,7 @@ int main(const int argc, const char **argv)
     }
   }
 
-  if (g_conf->daemonize) {
+  if (g_conf()->daemonize) {
     global_init_daemonize(g_ceph_context);
   }
 
index 0e9def5c78d6b9fe68629af2bf9456838ba9e398..91914310f48dc28b902ebffba4ce75649caed253 100644 (file)
@@ -17,7 +17,7 @@
 
 void RGWProcess::RGWWQ::_dump_queue()
 {
-  if (!g_conf->subsys.should_gather<ceph_subsys_rgw, 20>()) {
+  if (!g_conf()->subsys.should_gather<ceph_subsys_rgw, 20>()) {
     return;
   }
   deque<RGWRequest *>::iterator iter;
index 6fa788db0e5f8bb342d42b3f4d6fa03c2ccb0426..ae0585c43cc95c474981f5416b6095d380dcfb9f 100644 (file)
@@ -117,8 +117,8 @@ public:
       conf(conf),
       sock_fd(-1),
       uri_prefix(pe->uri_prefix),
-      req_wq(this, g_conf->rgw_op_thread_timeout,
-            g_conf->rgw_op_thread_suicide_timeout, &m_tp) {
+      req_wq(this, g_conf()->rgw_op_thread_timeout,
+            g_conf()->rgw_op_thread_suicide_timeout, &m_tp) {
   }
   
   virtual ~RGWProcess() = default;
index 33d6fc8dc8f368adbb18531843166f69a7200bbc..5c3e6c6cf56f39ccfc5ee5d2332c44da959965f4 100644 (file)
@@ -718,13 +718,13 @@ static inline int handle_metadata_errors(req_state* const s, const int op_ret)
      * (stored as xattr) size. */
     const auto error_message = boost::str(
       boost::format("Metadata value longer than %lld")
-        % s->cct->_conf->get_val<Option::size_t>("rgw_max_attr_size"));
+        % s->cct->_conf.get_val<Option::size_t>("rgw_max_attr_size"));
     set_req_state_err(s, EINVAL, error_message);
     return -EINVAL;
   } else if (op_ret == -E2BIG) {
     const auto error_message = boost::str(
       boost::format("Too many metadata items; max %lld")
-        % s->cct->_conf->get_val<size_t>("rgw_max_attrs_num_in_req"));
+        % s->cct->_conf.get_val<size_t>("rgw_max_attrs_num_in_req"));
     set_req_state_err(s, EINVAL, error_message);
     return -EINVAL;
   }
@@ -1695,7 +1695,7 @@ void RGWGetCrossDomainPolicy_ObjStore_SWIFT::send_response()
      << R"(<!DOCTYPE cross-domain-policy SYSTEM )"
      << R"("http://www.adobe.com/xml/dtds/cross-domain-policy.dtd" >)" << "\n"
      << R"(<cross-domain-policy>)" << "\n"
-     << g_conf->rgw_cross_domain_policy << "\n"
+     << g_conf()->rgw_cross_domain_policy << "\n"
      << R"(</cross-domain-policy>)";
 
   dump_body(s, ss.str());
@@ -1749,7 +1749,7 @@ void RGWInfo_ObjStore_SWIFT::execute()
       s->formatter->close_section();
     }
     else {
-      pair.second.list_data(*(s->formatter), *(s->cct->_conf), *store);
+      pair.second.list_data(*(s->formatter), s->cct->_conf, *store);
     }
   }
 
@@ -1768,31 +1768,31 @@ void RGWInfo_ObjStore_SWIFT::send_response()
 }
 
 void RGWInfo_ObjStore_SWIFT::list_swift_data(Formatter& formatter,
-                                              const md_config_t& config,
+                                              const ConfigProxy& config,
                                               RGWRados& store)
 {
   formatter.open_object_section("swift");
-  formatter.dump_int("max_file_size", config.rgw_max_put_size);
+  formatter.dump_int("max_file_size", config->rgw_max_put_size);
   formatter.dump_int("container_listing_limit", RGW_LIST_BUCKETS_LIMIT_MAX);
 
   string ceph_version(CEPH_GIT_NICE_VER);
   formatter.dump_string("version", ceph_version);
 
   const size_t max_attr_name_len = \
-    g_conf->get_val<size_t>("rgw_max_attr_name_len");
+    g_conf().get_val<size_t>("rgw_max_attr_name_len");
   if (max_attr_name_len) {
     const size_t meta_name_limit = \
       max_attr_name_len - strlen(RGW_ATTR_PREFIX RGW_AMZ_META_PREFIX);
     formatter.dump_int("max_meta_name_length", meta_name_limit);
   }
 
-  const size_t meta_value_limit = g_conf->get_val<Option::size_t>("rgw_max_attr_size");
+  const size_t meta_value_limit = g_conf().get_val<Option::size_t>("rgw_max_attr_size");
   if (meta_value_limit) {
     formatter.dump_int("max_meta_value_length", meta_value_limit);
   }
 
   const size_t meta_num_limit = \
-    g_conf->get_val<size_t>("rgw_max_attrs_num_in_req");
+    g_conf().get_val<size_t>("rgw_max_attrs_num_in_req");
   if (meta_num_limit) {
     formatter.dump_int("max_meta_count", meta_num_limit);
   }
@@ -1816,7 +1816,7 @@ void RGWInfo_ObjStore_SWIFT::list_swift_data(Formatter& formatter,
 }
 
 void RGWInfo_ObjStore_SWIFT::list_tempauth_data(Formatter& formatter,
-                                                 const md_config_t& config,
+                                                 const ConfigProxy& config,
                                                  RGWRados& store)
 {
   formatter.open_object_section("tempauth");
@@ -1824,7 +1824,7 @@ void RGWInfo_ObjStore_SWIFT::list_tempauth_data(Formatter& formatter,
   formatter.close_section();
 }
 void RGWInfo_ObjStore_SWIFT::list_tempurl_data(Formatter& formatter,
-                                                const md_config_t& config,
+                                                const ConfigProxy& config,
                                                 RGWRados& store)
 {
   formatter.open_object_section("tempurl");
@@ -1839,11 +1839,11 @@ void RGWInfo_ObjStore_SWIFT::list_tempurl_data(Formatter& formatter,
 }
 
 void RGWInfo_ObjStore_SWIFT::list_slo_data(Formatter& formatter,
-                                            const md_config_t& config,
+                                            const ConfigProxy& config,
                                             RGWRados& store)
 {
   formatter.open_object_section("slo");
-  formatter.dump_int("max_manifest_segments", config.rgw_max_slo_entries);
+  formatter.dump_int("max_manifest_segments", config->rgw_max_slo_entries);
   formatter.close_section();
 }
 
@@ -2811,23 +2811,23 @@ int RGWHandler_REST_SWIFT::init_from_header(struct req_state* const s,
   }
 
   if ('\0' == req_name[0]) {
-    return g_conf->rgw_swift_url_prefix == "/" ? -ERR_BAD_URL : 0;
+    return g_conf()->rgw_swift_url_prefix == "/" ? -ERR_BAD_URL : 0;
   }
 
   req = req_name;
 
   size_t pos = req.find('/');
-  if (std::string::npos != pos && g_conf->rgw_swift_url_prefix != "/") {
-    bool cut_url = g_conf->rgw_swift_url_prefix.length();
+  if (std::string::npos != pos && g_conf()->rgw_swift_url_prefix != "/") {
+    bool cut_url = g_conf()->rgw_swift_url_prefix.length();
     first = req.substr(0, pos);
 
-    if (first.compare(g_conf->rgw_swift_url_prefix) == 0) {
+    if (first.compare(g_conf()->rgw_swift_url_prefix) == 0) {
       if (cut_url) {
         /* Rewind to the "v1/..." part. */
         next_tok(req, first, '/');
       }
     }
-  } else if (req.compare(g_conf->rgw_swift_url_prefix) == 0) {
+  } else if (req.compare(g_conf()->rgw_swift_url_prefix) == 0) {
     s->formatter = new RGWFormatter_Plain;
     return -ERR_BAD_URL;
   } else {
@@ -2835,19 +2835,19 @@ int RGWHandler_REST_SWIFT::init_from_header(struct req_state* const s,
   }
 
   std::string tenant_path;
-  if (! g_conf->rgw_swift_tenant_name.empty()) {
+  if (! g_conf()->rgw_swift_tenant_name.empty()) {
     tenant_path = "/AUTH_";
-    tenant_path.append(g_conf->rgw_swift_tenant_name);
+    tenant_path.append(g_conf()->rgw_swift_tenant_name);
   }
 
   /* verify that the request_uri conforms with what's expected */
-  char buf[g_conf->rgw_swift_url_prefix.length() + 16 + tenant_path.length()];
+  char buf[g_conf()->rgw_swift_url_prefix.length() + 16 + tenant_path.length()];
   int blen;
-  if (g_conf->rgw_swift_url_prefix == "/") {
+  if (g_conf()->rgw_swift_url_prefix == "/") {
     blen = sprintf(buf, "/v1%s", tenant_path.c_str());
   } else {
     blen = sprintf(buf, "/%s/v1%s",
-                   g_conf->rgw_swift_url_prefix.c_str(), tenant_path.c_str());
+                   g_conf()->rgw_swift_url_prefix.c_str(), tenant_path.c_str());
   }
 
   if (strncmp(reqbuf, buf, blen) != 0) {
@@ -2862,7 +2862,7 @@ int RGWHandler_REST_SWIFT::init_from_header(struct req_state* const s,
 
   next_tok(req, ver, '/');
 
-  if (!tenant_path.empty() || g_conf->rgw_swift_account_in_url) {
+  if (!tenant_path.empty() || g_conf()->rgw_swift_account_in_url) {
     string account_name;
     next_tok(req, account_name, '/');
 
index 6ed9346d5b83a7b04b71b8bbc614767c5cf56413..c6d387fe1a0683754a88d76dcbb70ee2fa986ac9 100644 (file)
@@ -233,7 +233,7 @@ protected:
   struct info
   {
     bool is_admin_info;
-    function<void (Formatter&, const md_config_t&, RGWRados&)> list_data;
+    function<void (Formatter&, const ConfigProxy&, RGWRados&)> list_data;
   };
 
   static const vector<pair<string, struct info>> swift_info;
@@ -243,10 +243,10 @@ public:
 
   void execute() override;
   void send_response() override;
-  static void list_swift_data(Formatter& formatter, const md_config_t& config, RGWRados& store);
-  static void list_tempauth_data(Formatter& formatter, const md_config_t& config, RGWRados& store);
-  static void list_tempurl_data(Formatter& formatter, const md_config_t& config, RGWRados& store);
-  static void list_slo_data(Formatter& formatter, const md_config_t& config, RGWRados& store);
+  static void list_swift_data(Formatter& formatter, const ConfigProxy& config, RGWRados& store);
+  static void list_tempauth_data(Formatter& formatter, const ConfigProxy& config, RGWRados& store);
+  static void list_tempurl_data(Formatter& formatter, const ConfigProxy& config, RGWRados& store);
+  static void list_slo_data(Formatter& formatter, const ConfigProxy& config, RGWRados& store);
   static bool is_expired(const std::string& expires, CephContext* cct);
 };
 
index 9092f3ebe1a01d17846bdc05892c577fd2e9c125..571a6286031efc097a32bc5971c26ea2b9e31adc 100644 (file)
@@ -289,7 +289,7 @@ TempURLEngine::authenticate(const req_state* const s) const
    * of Swift API entry point removed. */
 
   /* XXX can we search this ONCE? */
-  const size_t pos = g_conf->rgw_swift_url_prefix.find_last_not_of('/') + 1;
+  const size_t pos = g_conf()->rgw_swift_url_prefix.find_last_not_of('/') + 1;
   const boost::string_view ref_uri = s->decoded_uri;
   const std::array<boost::string_view, 2> allowed_paths = {
     ref_uri,
@@ -355,7 +355,7 @@ bool ExternalTokenEngine::is_applicable(const std::string& token) const noexcept
 {
   if (token.empty()) {
     return false;
-  } else if (g_conf->rgw_swift_auth_url.empty()) {
+  } else if (g_conf()->rgw_swift_auth_url.empty()) {
     return false;
   } else {
     return true;
@@ -370,7 +370,7 @@ ExternalTokenEngine::authenticate(const std::string& token,
     return result_t::deny();
   }
 
-  std::string auth_url = g_conf->rgw_swift_auth_url;
+  std::string auth_url = g_conf()->rgw_swift_auth_url;
   if (auth_url.back() != '/') {
     auth_url.append("/");
   }
@@ -591,8 +591,8 @@ void RGW_SWIFT_Auth_Get::execute()
   RGWAccessKey *swift_key;
   map<string, RGWAccessKey>::iterator siter;
 
-  string swift_url = g_conf->rgw_swift_url;
-  string swift_prefix = g_conf->rgw_swift_url_prefix;
+  string swift_url = g_conf()->rgw_swift_url;
+  string swift_prefix = g_conf()->rgw_swift_url_prefix;
   string tenant_path;
 
   /*
@@ -662,10 +662,10 @@ void RGW_SWIFT_Auth_Get::execute()
     goto done;
   }
 
-  if (!g_conf->rgw_swift_tenant_name.empty()) {
+  if (!g_conf()->rgw_swift_tenant_name.empty()) {
     tenant_path = "/AUTH_";
-    tenant_path.append(g_conf->rgw_swift_tenant_name);
-  } else if (g_conf->rgw_swift_account_in_url) {
+    tenant_path.append(g_conf()->rgw_swift_tenant_name);
+  } else if (g_conf()->rgw_swift_account_in_url) {
     tenant_path = "/AUTH_";
     tenant_path.append(info.user_id.to_str());
   }
index 7794f84835d37c32513c905ea885dc1099dad4a2..abc7133a131f0b674dc59a5aed2ff2c3a0d27f21 100644 (file)
  *
  *
  */
-#include "common/config.h"
+#include "common/config_proxy.h"
 #include "common/errno.h"
 #include "gtest/gtest.h"
 
 extern std::string exec(const char* cmd); // defined in test_hostname.cc
 
-class test_md_config_t : public md_config_t, public ::testing::Test {
+class test_config_proxy : public ConfigProxy, public ::testing::Test {
 public:
 
-  test_md_config_t()
-    : md_config_t(true), Test()
+  test_config_proxy()
+    : ConfigProxy{true}, Test()
   {}
 
   void test_expand_meta() {
-    auto locker = lock();
     // successfull meta expansion $run_dir and ${run_dir}
     {
       ostringstream oss;
@@ -126,7 +125,7 @@ public:
   }
 };
 
-TEST_F(test_md_config_t, expand_meta)
+TEST_F(test_config_proxy, expand_meta)
 {
   test_expand_meta();
 }
@@ -134,7 +133,7 @@ TEST_F(test_md_config_t, expand_meta)
 TEST(md_config_t, set_val)
 {
   int buf_size = 1024;
-  md_config_t conf;
+  ConfigProxy conf{false};
   {
     char *run_dir = (char*)malloc(buf_size);
     EXPECT_EQ(0, conf.get_val("run_dir", &run_dir, buf_size));
index 1ddf21cbee5ccc67add66e03a30215398717f26a..1d1e22e2558d97218fe90ab3a12b48835276bb3e 100644 (file)
@@ -23,7 +23,7 @@
 #include "include/types.h"
 #include "include/msgr.h"
 #include "common/ceph_context.h"
-#include "common/config.h"
+#include "common/config_proxy.h"
 #include "log/Log.h"
 
 TEST(CephContext, do_command)
@@ -34,7 +34,7 @@ TEST(CephContext, do_command)
 
   string key("key");
   string value("value");
-  cct->_conf->set_val(key.c_str(), value.c_str());
+  cct->_conf.set_val(key.c_str(), value.c_str());
   cmdmap_t cmdmap;
   cmdmap["var"] = key;
 
@@ -71,30 +71,30 @@ TEST(CephContext, experimental_features)
   ASSERT_FALSE(cct->check_experimental_feature_enabled("bar"));
   ASSERT_FALSE(cct->check_experimental_feature_enabled("baz"));
 
-  cct->_conf->set_val("enable_experimental_unrecoverable_data_corrupting_features",
+  cct->_conf.set_val("enable_experimental_unrecoverable_data_corrupting_features",
                      "foo,bar");
-  cct->_conf->apply_changes(&cout);
+  cct->_conf.apply_changes(&cout);
   ASSERT_TRUE(cct->check_experimental_feature_enabled("foo"));
   ASSERT_TRUE(cct->check_experimental_feature_enabled("bar"));
   ASSERT_FALSE(cct->check_experimental_feature_enabled("baz"));
 
-  cct->_conf->set_val("enable_experimental_unrecoverable_data_corrupting_features",
+  cct->_conf.set_val("enable_experimental_unrecoverable_data_corrupting_features",
                      "foo bar");
-  cct->_conf->apply_changes(&cout);
+  cct->_conf.apply_changes(&cout);
   ASSERT_TRUE(cct->check_experimental_feature_enabled("foo"));
   ASSERT_TRUE(cct->check_experimental_feature_enabled("bar"));
   ASSERT_FALSE(cct->check_experimental_feature_enabled("baz"));
 
-  cct->_conf->set_val("enable_experimental_unrecoverable_data_corrupting_features",
+  cct->_conf.set_val("enable_experimental_unrecoverable_data_corrupting_features",
                      "baz foo");
-  cct->_conf->apply_changes(&cout);
+  cct->_conf.apply_changes(&cout);
   ASSERT_TRUE(cct->check_experimental_feature_enabled("foo"));
   ASSERT_FALSE(cct->check_experimental_feature_enabled("bar"));
   ASSERT_TRUE(cct->check_experimental_feature_enabled("baz"));
 
-  cct->_conf->set_val("enable_experimental_unrecoverable_data_corrupting_features",
+  cct->_conf.set_val("enable_experimental_unrecoverable_data_corrupting_features",
                      "*");
-  cct->_conf->apply_changes(&cout);
+  cct->_conf.apply_changes(&cout);
   ASSERT_TRUE(cct->check_experimental_feature_enabled("foo"));
   ASSERT_TRUE(cct->check_experimental_feature_enabled("bar"));
   ASSERT_TRUE(cct->check_experimental_feature_enabled("baz"));
index e747205ff1150d590e5b042822de93e9c60aca34..0bdc2f2601e11cc31e1d26416960ee1fe9c4260b 100644 (file)
@@ -33,7 +33,7 @@ public:
 
   CompressorTest() {
     // note for later
-    old_zlib_isal = g_conf->compressor_zlib_isal;
+    old_zlib_isal = g_conf()->compressor_zlib_isal;
 
     plugin = GetParam();
     size_t pos = plugin.find('/');
@@ -41,11 +41,11 @@ public:
       string isal = plugin.substr(pos + 1);
       plugin = plugin.substr(0, pos);
       if (isal == "isal") {
-       g_conf->set_val("compressor_zlib_isal", "true");
-       g_ceph_context->_conf->apply_changes(NULL);
+       g_conf().set_val("compressor_zlib_isal", "true");
+       g_ceph_context->_conf.apply_changes(nullptr);
       } else if (isal == "noisal") {
-       g_conf->set_val("compressor_zlib_isal", "false");
-       g_ceph_context->_conf->apply_changes(NULL);
+       g_conf().set_val("compressor_zlib_isal", "false");
+       g_ceph_context->_conf.apply_changes(nullptr);
       } else {
        assert(0 == "bad option");
       }
@@ -53,8 +53,8 @@ public:
     cout << "[plugin " << plugin << " (" << GetParam() << ")]" << std::endl;
   }
   ~CompressorTest() override {
-    g_conf->set_val("compressor_zlib_isal", old_zlib_isal ? "true" : "false");
-    g_ceph_context->_conf->apply_changes(NULL);
+    g_conf().set_val("compressor_zlib_isal", old_zlib_isal ? "true" : "false");
+    g_ceph_context->_conf.apply_changes(nullptr);
   }
 
   void SetUp() override {
@@ -343,15 +343,15 @@ INSTANTIATE_TEST_CASE_P(
 
 TEST(ZlibCompressor, zlib_isal_compatibility)
 {
-  g_conf->set_val("compressor_zlib_isal", "true");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_conf().set_val("compressor_zlib_isal", "true");
+  g_ceph_context->_conf.apply_changes(nullptr);
   CompressorRef isal = Compressor::create(g_ceph_context, "zlib");
   if (!isal) {
     // skip the test if the plugin is not ready
     return;
   }
-  g_conf->set_val("compressor_zlib_isal", "false");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_conf().set_val("compressor_zlib_isal", "false");
+  g_ceph_context->_conf.apply_changes(nullptr);
   CompressorRef zlib = Compressor::create(g_ceph_context, "zlib");
   char test[101];
   srand(time(0));
@@ -407,15 +407,15 @@ TEST(CompressionPlugin, all)
 
 TEST(ZlibCompressor, isal_compress_zlib_decompress_random)
 {
-  g_conf->set_val("compressor_zlib_isal", "true");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_conf().set_val("compressor_zlib_isal", "true");
+  g_ceph_context->_conf.apply_changes(nullptr);
   CompressorRef isal = Compressor::create(g_ceph_context, "zlib");
   if (!isal) {
     // skip the test if the plugin is not ready
     return;
   }
-  g_conf->set_val("compressor_zlib_isal", "false");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_conf().set_val("compressor_zlib_isal", "false");
+  g_ceph_context->_conf.apply_changes(nullptr);
   CompressorRef zlib = Compressor::create(g_ceph_context, "zlib");
 
   for (int cnt=0; cnt<100; cnt++)
@@ -443,15 +443,15 @@ TEST(ZlibCompressor, isal_compress_zlib_decompress_random)
 
 TEST(ZlibCompressor, isal_compress_zlib_decompress_walk)
 {
-  g_conf->set_val("compressor_zlib_isal", "true");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_conf().set_val("compressor_zlib_isal", "true");
+  g_ceph_context->_conf.apply_changes(nullptr);
   CompressorRef isal = Compressor::create(g_ceph_context, "zlib");
   if (!isal) {
     // skip the test if the plugin is not ready
     return;
   }
-  g_conf->set_val("compressor_zlib_isal", "false");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_conf().set_val("compressor_zlib_isal", "false");
+  g_ceph_context->_conf.apply_changes(nullptr);
   CompressorRef zlib = Compressor::create(g_ceph_context, "zlib");
 
   for (int cnt=0; cnt<100; cnt++)
@@ -490,9 +490,9 @@ TEST(QAT, enc_qat_dec_noqat) {
   const char* alg_collection[] = {"zlib", "snappy"}; 
 #endif
   for (auto alg : alg_collection) {
-    g_conf->set_val("qat_compressor_enabled", "true");
+    g_conf().set_val("qat_compressor_enabled", "true");
     CompressorRef q = Compressor::create(g_ceph_context, alg);
-    g_conf->set_val("qat_compressor_enabled", "false");
+    g_conf().set_val("qat_compressor_enabled", "false");
     CompressorRef noq = Compressor::create(g_ceph_context, alg);
 
     // generate random buffer
@@ -526,9 +526,9 @@ TEST(QAT, enc_noqat_dec_qat) {
   const char* alg_collection[] = {"zlib", "snappy"}; 
 #endif
   for (auto alg : alg_collection) {
-    g_conf->set_val("qat_compressor_enabled", "true");
+    g_conf().set_val("qat_compressor_enabled", "true");
     CompressorRef q = Compressor::create(g_ceph_context, alg);
-    g_conf->set_val("qat_compressor_enabled", "false");
+    g_conf().set_val("qat_compressor_enabled", "false");
     CompressorRef noq = Compressor::create(g_ceph_context, alg);
 
     // generate random buffer
index 49aadaa36cb5ec909bfe63996d5228b6c54fd1d2..e89c80730ea5da3019d69fc32ff6981fcc34492d 100644 (file)
@@ -475,18 +475,18 @@ TEST(ConfUtils, Overrides) {
 
   conf->name.set(CEPH_ENTITY_TYPE_MON, "0");
   conf.parse_config_files(override_conf_1_f.c_str(), &warn, 0);
-  ASSERT_EQ(conf.parse_errors.size(), 0U);
-  ASSERT_EQ(conf.log_file, "global_log");
+  ASSERT_EQ(conf.num_parse_errors(), 0U);
+  ASSERT_EQ(conf->log_file, "global_log");
 
   conf->name.set(CEPH_ENTITY_TYPE_MDS, "a");
   conf.parse_config_files(override_conf_1_f.c_str(), &warn, 0);
-  ASSERT_EQ(conf.parse_errors.size(), 0U);
-  ASSERT_EQ(conf.log_file, "mds_log");
+  ASSERT_EQ(conf.num_parse_errors(), 0U);
+  ASSERT_EQ(conf->log_file, "mds_log");
 
   conf->name.set(CEPH_ENTITY_TYPE_OSD, "0");
   conf.parse_config_files(override_conf_1_f.c_str(), &warn, 0);
-  ASSERT_EQ(conf.parse_errors.size(), 0U);
-  ASSERT_EQ(conf.log_file, "osd0_log");
+  ASSERT_EQ(conf.num_parse_errors(), 0U);
+  ASSERT_EQ(conf->log_file, "osd0_log");
 }
 
 TEST(ConfUtils, DupKey) {
@@ -496,8 +496,8 @@ TEST(ConfUtils, DupKey) {
 
   conf->name.set(CEPH_ENTITY_TYPE_MDS, "a");
   conf.parse_config_files(dup_key_config_f.c_str(), &warn, 0);
-  ASSERT_EQ(conf.parse_errors.size(), 0U);
-  ASSERT_EQ(conf.log_file, string("3"));
+  ASSERT_EQ(conf.num_parse_errors(), 0U);
+  ASSERT_EQ(conf->log_file, string("3"));
 }
 
 
index b06bc686a175a07bb1990867f20638ffeeaf3f3b..84b46056851a7218bafeef341210198b41afb4a8 100644 (file)
@@ -102,7 +102,7 @@ struct Server {
   Server(CephContext* cct, const entity_inst_t& entity)
     : dispatcher(cct)
   {
-    msgr.reset(Messenger::create(cct, cct->_conf->get_val<string>("ms_type"),
+    msgr.reset(Messenger::create(cct, cct->_conf.get_val<string>("ms_type"),
                                  entity.name, "pong", entity.addr.get_nonce(), 0));
     msgr->set_cluster_protocol(CEPH_OSD_PROTOCOL);
     msgr->set_default_policy(Messenger::Policy::stateless_server(0));
@@ -164,7 +164,7 @@ struct Client {
   Client(CephContext *cct)
     : dispatcher(cct)
   {
-    msgr.reset(Messenger::create(cct, cct->_conf->get_val<string>("ms_type"),
+    msgr.reset(Messenger::create(cct, cct->_conf.get_val<string>("ms_type"),
                                  entity_name_t::CLIENT(-1), "ping",
                                  getpid(), 0));
     msgr->set_cluster_protocol(CEPH_OSD_PROTOCOL);
index c9248c788dfffbd2e6c0db4d5aa940ac6a4781b4..bfe993798756cc94ebfaad22ce9dcd0e5484cecd 100644 (file)
@@ -98,7 +98,7 @@ TEST(DaemonConfig, SubstitutionBracesTrailing) {
   ASSERT_EQ(0, ret);
   ret = g_ceph_context->_conf.set_val("public_network", "bar${host}");
   ASSERT_EQ(0, ret);
-  g_ceph_context->_conf.apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
   char buf[128];
   memset(buf, 0, sizeof(buf));
   char *tmp = buf;
@@ -114,7 +114,7 @@ TEST(DaemonConfig, SubstitutionMultiple) {
   ASSERT_EQ(0, ret);
   ret = g_ceph_context->_conf.set_val("keyring", "$mon_host/$cluster.keyring,$mon_host/$cluster.mon.keyring");
   ASSERT_EQ(0, ret);
-  g_ceph_context->_conf.apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
   char buf[512];
   memset(buf, 0, sizeof(buf));
   char *tmp = buf;
@@ -302,7 +302,7 @@ TEST(DaemonConfig, InjectArgsLogfile) {
   // Let's turn off the logfile.
   ret = g_ceph_context->_conf.set_val("log_file", "");
   ASSERT_EQ(0, ret);
-  g_ceph_context->_conf.apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
   ret = g_ceph_context->_conf.get_val("log_file", &tmp, sizeof(buf));
   ASSERT_EQ(0, ret);
   ASSERT_EQ(string(""), string(buf));
index 21926af2b93eb8e496eb6d46d0824f1fc70c6532..9df75dabc91a5d2bde86f7761cc6d9e687fa824c 100644 (file)
 #include "include/stringify.h"
 #include "erasure-code/lrc/ErasureCodeLrc.h"
 #include "global/global_context.h"
-#include "common/config.h"
+#include "common/config_proxy.h"
 #include "gtest/gtest.h"
 
 
 TEST(ErasureCodeLrc, parse_rule)
 {
-  ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+  ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
   EXPECT_EQ("default", lrc.rule_root);
   EXPECT_EQ("host", lrc.rule_steps.front().type);
 
@@ -130,7 +130,7 @@ TEST(ErasureCodeTest, create_rule)
 
   c->finalize();
 
-  ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+  ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
   EXPECT_EQ(0, lrc.create_rule("rule1", *c, &cerr));
 
   ErasureCodeProfile profile;
@@ -171,7 +171,7 @@ TEST(ErasureCodeTest, create_rule)
 
 TEST(ErasureCodeLrc, parse_kml)
 {
-  ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+  ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
   ErasureCodeProfile profile;
   EXPECT_EQ(0, lrc.parse_kml(profile, &cerr));
   profile["k"] = "4";
@@ -246,7 +246,7 @@ TEST(ErasureCodeLrc, parse_kml)
 
 TEST(ErasureCodeLrc, layers_description)
 {
-  ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+  ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
   ErasureCodeProfile profile;
 
   json_spirit::mArray description;
@@ -275,7 +275,7 @@ TEST(ErasureCodeLrc, layers_description)
 TEST(ErasureCodeLrc, layers_parse)
 {
   {
-    ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+    ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
     ErasureCodeProfile profile;
 
     const char *description_string ="[ 0 ]";
@@ -287,7 +287,7 @@ TEST(ErasureCodeLrc, layers_parse)
   }
 
   {
-    ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+    ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
     ErasureCodeProfile profile;
 
     const char *description_string ="[ [ 0 ] ]";
@@ -299,7 +299,7 @@ TEST(ErasureCodeLrc, layers_parse)
   }
 
   {
-    ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+    ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
     ErasureCodeProfile profile;
 
     const char *description_string ="[ [ \"\", 0 ] ]";
@@ -315,7 +315,7 @@ TEST(ErasureCodeLrc, layers_parse)
   // profile.
   //
   {
-    ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+    ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
     ErasureCodeProfile profile;
 
     const char *description_string ="[ [ \"\", { \"a\": \"b\" }, \"ignored\" ] ]";
@@ -331,7 +331,7 @@ TEST(ErasureCodeLrc, layers_parse)
   // profile.
   //
   {
-    ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+    ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
     ErasureCodeProfile profile;
 
     const char *description_string ="[ [ \"\", \"a=b c=d\" ] ]";
@@ -348,7 +348,7 @@ TEST(ErasureCodeLrc, layers_parse)
 TEST(ErasureCodeLrc, layers_sanity_checks)
 {
   {
-    ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+    ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
     ErasureCodeProfile profile;
     profile["mapping"] =
            "__DDD__DD";
@@ -362,7 +362,7 @@ TEST(ErasureCodeLrc, layers_sanity_checks)
     EXPECT_EQ(0, lrc.init(profile, &cerr));
   }
   {
-    ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+    ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
     ErasureCodeProfile profile;
     const char *description_string =
       "[ "
@@ -371,7 +371,7 @@ TEST(ErasureCodeLrc, layers_sanity_checks)
     EXPECT_EQ(ERROR_LRC_MAPPING, lrc.init(profile, &cerr));
   }
   {
-    ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+    ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
     ErasureCodeProfile profile;
     profile["mapping"] = "";
     const char *description_string =
@@ -381,7 +381,7 @@ TEST(ErasureCodeLrc, layers_sanity_checks)
     EXPECT_EQ(ERROR_LRC_LAYERS_COUNT, lrc.init(profile, &cerr));
   }
   {
-    ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+    ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
     ErasureCodeProfile profile;
     profile["mapping"] =
            "DD";
@@ -399,7 +399,7 @@ TEST(ErasureCodeLrc, layers_sanity_checks)
 TEST(ErasureCodeLrc, layers_init)
 {
   {
-    ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+    ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
     ErasureCodeProfile profile;
 
     const char* env = getenv("CEPH_LIB");
@@ -422,7 +422,7 @@ TEST(ErasureCodeLrc, layers_init)
 
 TEST(ErasureCodeLrc, init)
 {
-  ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+  ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
   ErasureCodeProfile profile;
   profile["mapping"] =
     "__DDD__DD";
@@ -438,7 +438,7 @@ TEST(ErasureCodeLrc, init)
 
 TEST(ErasureCodeLrc, init_kml)
 {
-  ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+  ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
   ErasureCodeProfile profile;
   profile["k"] = "4";
   profile["m"] = "2";
@@ -451,7 +451,7 @@ TEST(ErasureCodeLrc, minimum_to_decode)
 {
   // trivial : no erasures, the minimum is want_to_read
   {
-    ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+    ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
     ErasureCodeProfile profile;
     profile["mapping"] =
       "__DDD__DD";
@@ -474,7 +474,7 @@ TEST(ErasureCodeLrc, minimum_to_decode)
   }
   // locally repairable erasure
   {
-    ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+    ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
     ErasureCodeProfile profile;
     profile["mapping"] =
            "__DDD__DD_";
@@ -524,7 +524,7 @@ TEST(ErasureCodeLrc, minimum_to_decode)
   }
   // implicit parity required
   {
-    ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+    ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
     ErasureCodeProfile profile;
     profile["mapping"] =
            "__DDD__DD";
@@ -602,7 +602,7 @@ TEST(ErasureCodeLrc, minimum_to_decode)
 
 TEST(ErasureCodeLrc, encode_decode)
 {
-  ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+  ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
   ErasureCodeProfile profile;
   profile["mapping"] =
     "__DD__DD";
@@ -615,7 +615,7 @@ TEST(ErasureCodeLrc, encode_decode)
   profile["layers"] = description_string;
   EXPECT_EQ(0, lrc.init(profile, &cerr));
   EXPECT_EQ(4U, lrc.get_data_chunk_count());
-  unsigned int chunk_size = g_conf->get_val<Option::size_t>("osd_pool_erasure_code_stripe_unit");
+  unsigned int chunk_size = g_conf().get_val<Option::size_t>("osd_pool_erasure_code_stripe_unit");
   unsigned int stripe_width = lrc.get_data_chunk_count() * chunk_size;
   EXPECT_EQ(chunk_size, lrc.get_chunk_size(stripe_width));
   set<int> want_to_encode;
@@ -735,7 +735,7 @@ TEST(ErasureCodeLrc, encode_decode)
 
 TEST(ErasureCodeLrc, encode_decode_2)
 {
-  ErasureCodeLrc lrc(g_conf->get_val<std::string>("erasure_code_dir"));
+  ErasureCodeLrc lrc(g_conf().get_val<std::string>("erasure_code_dir"));
   ErasureCodeProfile profile;
   profile["mapping"] =
     "DD__DD__";
@@ -748,7 +748,7 @@ TEST(ErasureCodeLrc, encode_decode_2)
   profile["layers"] = description_string;
   EXPECT_EQ(0, lrc.init(profile, &cerr));
   EXPECT_EQ(4U, lrc.get_data_chunk_count());
-  unsigned int chunk_size = g_conf->get_val<Option::size_t>("osd_pool_erasure_code_stripe_unit");
+  unsigned int chunk_size = g_conf().get_val<Option::size_t>("osd_pool_erasure_code_stripe_unit");
   unsigned int stripe_width = lrc.get_data_chunk_count() * chunk_size;
   EXPECT_EQ(chunk_size, lrc.get_chunk_size(stripe_width));
   set<int> want_to_encode;
index dd2e142c9bf3fb8903c2474e0e796fe88dbd74a2..08404b6e503e8ed077d2fdd3b3a739c4961ce94f 100644 (file)
@@ -21,7 +21,7 @@
 #include "common/Thread.h"
 #include "erasure-code/ErasureCodePlugin.h"
 #include "global/global_context.h"
-#include "common/config.h"
+#include "common/config_proxy.h"
 #include "gtest/gtest.h"
 
 
@@ -42,7 +42,7 @@ protected:
       ErasureCodeInterfaceRef erasure_code;
       pthread_cleanup_push(cleanup, NULL);
       instance.factory("hangs",
-                      g_conf->get_val<std::string>("erasure_code_dir"),
+                      g_conf().get_val<std::string>("erasure_code_dir"),
                       profile, &erasure_code, &cerr);
       pthread_cleanup_pop(0);
       return NULL;
@@ -82,36 +82,36 @@ TEST_F(ErasureCodePluginRegistryTest, factory_mutex) {
 TEST_F(ErasureCodePluginRegistryTest, all)
 {
   ErasureCodeProfile profile;
-  string directory = g_conf->get_val<std::string>("erasure_code_dir");
+  string directory = g_conf().get_val<std::string>("erasure_code_dir");
   ErasureCodeInterfaceRef erasure_code;
   ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
   EXPECT_FALSE(erasure_code);
   EXPECT_EQ(-EIO, instance.factory("invalid",
-                                  g_conf->get_val<std::string>("erasure_code_dir"),
+                                  g_conf().get_val<std::string>("erasure_code_dir"),
                                   profile, &erasure_code, &cerr));
   EXPECT_FALSE(erasure_code);
   EXPECT_EQ(-EXDEV, instance.factory("missing_version",
-                                    g_conf->get_val<std::string>("erasure_code_dir"),
+                                    g_conf().get_val<std::string>("erasure_code_dir"),
                                     profile,
                                     &erasure_code, &cerr));
   EXPECT_FALSE(erasure_code);
   EXPECT_EQ(-ENOENT, instance.factory("missing_entry_point",
-                                     g_conf->get_val<std::string>("erasure_code_dir"),
+                                     g_conf().get_val<std::string>("erasure_code_dir"),
                                      profile,
                                      &erasure_code, &cerr));
   EXPECT_FALSE(erasure_code);
   EXPECT_EQ(-ESRCH, instance.factory("fail_to_initialize",
-                                    g_conf->get_val<std::string>("erasure_code_dir"),
+                                    g_conf().get_val<std::string>("erasure_code_dir"),
                                     profile,
                                     &erasure_code, &cerr));
   EXPECT_FALSE(erasure_code);
   EXPECT_EQ(-EBADF, instance.factory("fail_to_register",
-                                    g_conf->get_val<std::string>("erasure_code_dir"),
+                                    g_conf().get_val<std::string>("erasure_code_dir"),
                                     profile,
                                     &erasure_code, &cerr));
   EXPECT_FALSE(erasure_code);
   EXPECT_EQ(0, instance.factory("example",
-                               g_conf->get_val<std::string>("erasure_code_dir"),
+                               g_conf().get_val<std::string>("erasure_code_dir"),
                                profile, &erasure_code, &cerr));
   EXPECT_TRUE(erasure_code.get());
   ErasureCodePlugin *plugin = 0;
index 0656f54dd9f2433cbef6b79f07706220f63ccf28..b57bf489654682f088ed63240cf0da1f88ee3ef6 100644 (file)
@@ -18,7 +18,7 @@
 #include "arch/intel.h"
 #include "erasure-code/ErasureCodePlugin.h"
 #include "global/global_context.h"
-#include "common/config.h"
+#include "common/config_proxy.h"
 #include "gtest/gtest.h"
 
 TEST(ErasureCodePlugin, factory)
@@ -29,7 +29,7 @@ TEST(ErasureCodePlugin, factory)
     ErasureCodeInterfaceRef erasure_code;
     EXPECT_FALSE(erasure_code);
     EXPECT_EQ(-EIO, instance.factory("no-isa",
-                                    g_conf->get_val<std::string>("erasure_code_dir"),
+                                    g_conf().get_val<std::string>("erasure_code_dir"),
                                     profile,
                                     &erasure_code, &cerr));
     EXPECT_FALSE(erasure_code);
@@ -43,7 +43,7 @@ TEST(ErasureCodePlugin, factory)
     profile["technique"] = *technique;
     EXPECT_FALSE(erasure_code);
     EXPECT_EQ(0, instance.factory("isa",
-                                 g_conf->get_val<std::string>("erasure_code_dir"),
+                                 g_conf().get_val<std::string>("erasure_code_dir"),
                                  profile,
                                   &erasure_code, &cerr));
     EXPECT_TRUE(erasure_code.get());
index 93ae080a5b482d46afd83a8c9a93c1f78dbd50db..0010d0206705de47c7e379f9aab78918aab06f9c 100644 (file)
@@ -20,7 +20,7 @@
 #include "erasure-code/ErasureCodePlugin.h"
 #include "log/Log.h"
 #include "global/global_context.h"
-#include "common/config.h"
+#include "common/config_proxy.h"
 #include "gtest/gtest.h"
 
 TEST(ErasureCodePlugin, factory)
@@ -31,7 +31,7 @@ TEST(ErasureCodePlugin, factory)
     ErasureCodeInterfaceRef erasure_code;
     EXPECT_FALSE(erasure_code);
     EXPECT_EQ(-ENOENT, instance.factory("jerasure",
-                                       g_conf->get_val<std::string>("erasure_code_dir"),
+                                       g_conf().get_val<std::string>("erasure_code_dir"),
                                        profile,
                                         &erasure_code, &cerr));
     EXPECT_FALSE(erasure_code);
@@ -52,7 +52,7 @@ TEST(ErasureCodePlugin, factory)
     profile["technique"] = *technique;
     EXPECT_FALSE(erasure_code);
     EXPECT_EQ(0, instance.factory("jerasure",
-                                 g_conf->get_val<std::string>("erasure_code_dir"),
+                                 g_conf().get_val<std::string>("erasure_code_dir"),
                                  profile,
                                   &erasure_code, &cerr));
     EXPECT_TRUE(erasure_code.get());
index 2b9b5c19f21cffd925eeb1f7f416a8ef32626483..4df3711a1f186ab1805ee6b4c37d31047d8242d0 100644 (file)
@@ -21,7 +21,7 @@
 #include "arch/intel.h"
 #include "erasure-code/ErasureCodePlugin.h"
 #include "global/global_context.h"
-#include "common/config.h"
+#include "common/config_proxy.h"
 #include "gtest/gtest.h"
 
 
@@ -34,7 +34,7 @@ TEST(ErasureCodePlugin, factory)
   ErasureCodeInterfaceRef erasure_code;
   EXPECT_FALSE(erasure_code);
   EXPECT_EQ(0, instance.factory("lrc",
-                               g_conf->get_val<std::string>("erasure_code_dir"),
+                               g_conf().get_val<std::string>("erasure_code_dir"),
                                profile, &erasure_code, &cerr));
   EXPECT_TRUE(erasure_code.get());
 }
index 603f34fc9efc5f98d937c5753f5908446cc3669b..10088343b0a7889eb81c450e0a6a6b64028bc781 100644 (file)
@@ -21,7 +21,7 @@
 #include "erasure-code/ErasureCodePlugin.h"
 #include "global/global_context.h"
 #include "gtest/gtest.h"
-#include "common/config.h"
+#include "common/config_proxy.h"
 
 TEST(ErasureCodePlugin, factory)
 {
@@ -31,7 +31,7 @@ TEST(ErasureCodePlugin, factory)
     ErasureCodeInterfaceRef erasure_code;
     EXPECT_FALSE(erasure_code);
     EXPECT_EQ(0, instance.factory("shec",
-                                 g_conf->get_val<std::string>("erasure_code_dir"),
+                                 g_conf().get_val<std::string>("erasure_code_dir"),
                                  profile,
                                  &erasure_code, &cerr));
     EXPECT_TRUE(erasure_code.get());
@@ -46,7 +46,7 @@ TEST(ErasureCodePlugin, factory)
     profile["technique"] = *technique;
     EXPECT_FALSE(erasure_code);
     EXPECT_EQ(0, instance.factory("shec",
-                                 g_conf->get_val<std::string>("erasure_code_dir"),
+                                 g_conf().get_val<std::string>("erasure_code_dir"),
                                  profile,
                                   &erasure_code, &cerr));
     EXPECT_TRUE(erasure_code.get());
index 9b52eb6d488964cc85f5ff2be2a07142e569867d..19eef327cb42d0f82bfab457139bc4c59a529b0d 100644 (file)
@@ -89,7 +89,7 @@ int ErasureCodeCommand::setup(int argc, char** argv) {
     CODE_ENVIRONMENT_UTILITY,
     CINIT_FLAG_NO_MON_CONFIG);
   common_init_finish(g_ceph_context);
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   if (vm.count("help")) {
     cout << desc << std::endl;
@@ -128,7 +128,7 @@ int ErasureCodeCommand::plugin_exists() {
   Mutex::Locker l(instance.lock);
   stringstream ss;
   int code = instance.load(vm["plugin_exists"].as<string>(),
-                          g_conf->get_val<std::string>("erasure_code_dir"), &plugin, &ss);
+                          g_conf().get_val<std::string>("erasure_code_dir"), &plugin, &ss);
   if (code)
     cerr << ss.str() << endl;
   return code;
@@ -144,7 +144,7 @@ int ErasureCodeCommand::display_information() {
   }
 
   int code = instance.factory(profile["plugin"],
-                             g_conf->get_val<std::string>("erasure_code_dir"),
+                             g_conf().get_val<std::string>("erasure_code_dir"),
                              profile,
                              &erasure_code, &cerr);
   if (code)
index f74f393abacc27384a9c70f150a2f980270aba91..7dbdf171155c7aca3f1756c541f07ab43520b05e 100644 (file)
@@ -87,7 +87,7 @@ int ErasureCodeBench::setup(int argc, char** argv) {
     CODE_ENVIRONMENT_UTILITY,
     CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
   common_init_finish(g_ceph_context);
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   if (vm.count("help")) {
     cout << desc << std::endl;
@@ -154,7 +154,7 @@ int ErasureCodeBench::encode()
   ErasureCodeInterfaceRef erasure_code;
   stringstream messages;
   int code = instance.factory(plugin,
-                             g_conf->get_val<std::string>("erasure_code_dir"),
+                             g_conf().get_val<std::string>("erasure_code_dir"),
                              profile, &erasure_code, &messages);
   if (code) {
     cerr << messages.str() << endl;
@@ -258,7 +258,7 @@ int ErasureCodeBench::decode()
   ErasureCodeInterfaceRef erasure_code;
   stringstream messages;
   int code = instance.factory(plugin,
-                             g_conf->get_val<std::string>("erasure_code_dir"),
+                             g_conf().get_val<std::string>("erasure_code_dir"),
                              profile, &erasure_code, &messages);
   if (code) {
     cerr << messages.str() << endl;
index 58af60a7ee3baa648ee3f228d7febda8330013ba..410bb5ec11785bd36bc33989e3172322d3f8bfd5 100644 (file)
@@ -96,7 +96,7 @@ int ErasureCodeNonRegression::setup(int argc, char** argv) {
                    CODE_ENVIRONMENT_UTILITY,
                    CINIT_FLAG_NO_MON_CONFIG);
   common_init_finish(g_ceph_context);
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   if (vm.count("help")) {
     cout << desc << std::endl;
@@ -155,7 +155,7 @@ int ErasureCodeNonRegression::run_create()
   ErasureCodeInterfaceRef erasure_code;
   stringstream messages;
   int code = instance.factory(plugin,
-                             g_conf->get_val<std::string>("erasure_code_dir"),
+                             g_conf().get_val<std::string>("erasure_code_dir"),
                              profile, &erasure_code, &messages);
   if (code) {
     cerr << messages.str() << endl;
@@ -227,7 +227,7 @@ int ErasureCodeNonRegression::run_check()
   ErasureCodeInterfaceRef erasure_code;
   stringstream messages;
   int code = instance.factory(plugin,
-                             g_conf->get_val<std::string>("erasure_code_dir"),
+                             g_conf().get_val<std::string>("erasure_code_dir"),
                              profile, &erasure_code, &messages);
   if (code) {
     cerr << messages.str() << endl;
index 9b095e838c33fab2285ff3e9e8da52af956db0fb..88ec02f484e9a8086ecd3cffe581c3966ad72e10 100644 (file)
@@ -72,8 +72,8 @@ int main(int argc, char **argv) {
                         CODE_ENVIRONMENT_UTILITY,
                         CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
   common_init_finish(g_ceph_context);
-  g_ceph_context->_conf->set_val("osd_journal_size", "100");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("osd_journal_size", "100");
+  g_ceph_context->_conf.apply_changes(NULL);
 
   ::testing::InitGoogleTest(&argc, argv);
   return RUN_ALL_TESTS();
index 8f092d40affa9d09118e81f7cb59eb61a37adc61..61c028aa4f93e7f0b28149650ebf25e1a0ab89b5 100644 (file)
@@ -276,7 +276,7 @@ struct Engine {
       cct->get_perfcounters_collection()->dump_formatted(f, false);
       ostr << "FIO plugin ";
       f->flush(ostr);
-      if (g_conf->rocksdb_perf) {
+      if (g_conf()->rocksdb_perf) {
         os->get_db_statistics(f);
         ostr << "FIO get_db_statistics ";
         f->flush(ostr);
@@ -327,19 +327,19 @@ Engine::Engine(thread_data* td)
 
   // create the ObjectStore
   os.reset(ObjectStore::create(g_ceph_context,
-                               g_conf->osd_objectstore,
-                               g_conf->osd_data,
-                               g_conf->osd_journal));
+                               g_conf()->osd_objectstore,
+                               g_conf()->osd_data,
+                               g_conf()->osd_journal));
   if (!os)
-    throw std::runtime_error("bad objectstore type " + g_conf->osd_objectstore);
+    throw std::runtime_error("bad objectstore type " + g_conf()->osd_objectstore);
 
   unsigned num_shards;
-  if(g_conf->osd_op_num_shards)
-    num_shards = g_conf->osd_op_num_shards;
+  if(g_conf()->osd_op_num_shards)
+    num_shards = g_conf()->osd_op_num_shards;
   else if(os->is_rotational())
-    num_shards = g_conf->osd_op_num_shards_hdd;
+    num_shards = g_conf()->osd_op_num_shards_hdd;
   else
-    num_shards = g_conf->osd_op_num_shards_ssd;
+    num_shards = g_conf()->osd_op_num_shards_ssd;
   os->set_cache_shards(num_shards);
 
   //normalize options
@@ -363,7 +363,7 @@ Engine::Engine(thread_data* td)
 
   // create shared collections up to osd_pool_default_pg_num
   if (o->single_pool_mode) {
-    uint64_t count = g_conf->get_val<uint64_t>("osd_pool_default_pg_num");
+    uint64_t count = g_conf()->get_val<uint64_t>("osd_pool_default_pg_num");
     if (count > td->o.nr_files)
       count = td->o.nr_files;
     init_collections(os, Collection::MIN_POOL_ID, collections, count);
@@ -417,7 +417,7 @@ Job::Job(Engine* engine, const thread_data* td)
   std::vector<Collection>* colls;
   // create private collections up to osd_pool_default_pg_num
   if (!o->single_pool_mode) {
-    uint64_t count = g_conf->get_val<uint64_t>("osd_pool_default_pg_num");
+    uint64_t count = g_conf()->get_val<uint64_t>("osd_pool_default_pg_num");
     if (count > td->o.nr_files)
       count = td->o.nr_files;
     // use the fio thread_number for our unique pool id
@@ -606,18 +606,18 @@ enum fio_q_status fio_ceph_os_queue(thread_data* td, io_u* u)
        if (o->pglog_omap_len_high &&
            pglog_ver_cnt >=
              coll.pglog_ver_tail +
-               g_conf->osd_min_pg_log_entries + g_conf->osd_pg_log_trim_min) {
+               g_conf()->osd_min_pg_log_entries + g_conf()->osd_pg_log_trim_min) {
          pglog_trim_tail = coll.pglog_ver_tail;
          coll.pglog_ver_tail = pglog_trim_head =
-           pglog_trim_tail + g_conf->osd_pg_log_trim_min;
+           pglog_trim_tail + g_conf()->osd_pg_log_trim_min;
 
          if (o->pglog_dup_omap_len_high &&
              pglog_ver_cnt >=
-               coll.pglog_dup_ver_tail + g_conf->osd_pg_log_dups_tracked +
-                 g_conf->osd_pg_log_trim_min) {
+               coll.pglog_dup_ver_tail + g_conf()->osd_pg_log_dups_tracked +
+                 g_conf()->osd_pg_log_trim_min) {
            pglog_dup_trim_tail = coll.pglog_dup_ver_tail;
            coll.pglog_dup_ver_tail = pglog_dup_trim_head =
-             pglog_dup_trim_tail + g_conf->osd_pg_log_trim_min;
+             pglog_dup_trim_tail + g_conf()->osd_pg_log_trim_min;
          }
        }
       }
index 7808aa68322dba79597fa8f0de37d78719f7545b..afb535d3111de2613c1ffed0dd5fd47b8eeb5cfa 100644 (file)
@@ -4,7 +4,7 @@
 #include "gtest/gtest.h"
 #include "common/ceph_argparse.h"
 #include "common/ceph_crypto.h"
-#include "common/config.h"
+#include "common/config_proxy.h"
 #include "global/global_context.h"
 #include "global/global_init.h"
 #include <vector>
@@ -19,7 +19,7 @@ int main(int argc, char **argv)
   auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_OSD,
                         CODE_ENVIRONMENT_UTILITY,
                         CINIT_FLAG_NO_MON_CONFIG);
-  g_conf->set_val("lockdep", "true");
+  g_conf().set_val("lockdep", "true");
   common_init_finish(g_ceph_context);
 
   int r = RUN_ALL_TESTS();
index 152c61512b948b4f8e31bc2d416d83df2fde268d..aa6f7691052765282583ad846c106ded3e033747 100644 (file)
@@ -168,7 +168,7 @@ TEST_F(LibRadosMiscPP, WaitOSDMapPP) {
 TEST_F(LibRadosMiscPP, LongNamePP) {
   bufferlist bl;
   bl.append("content");
-  int maxlen = g_conf->osd_max_object_name_len;
+  int maxlen = g_conf()->osd_max_object_name_len;
   ASSERT_EQ(0, ioctx.write(string(maxlen/2, 'a').c_str(), bl, bl.length(), 0));
   ASSERT_EQ(0, ioctx.write(string(maxlen-1, 'a').c_str(), bl, bl.length(), 0));
   ASSERT_EQ(0, ioctx.write(string(maxlen, 'a').c_str(), bl, bl.length(), 0));
@@ -179,7 +179,7 @@ TEST_F(LibRadosMiscPP, LongNamePP) {
 TEST_F(LibRadosMiscPP, LongLocatorPP) {
   bufferlist bl;
   bl.append("content");
-  int maxlen = g_conf->osd_max_object_name_len;
+  int maxlen = g_conf()->osd_max_object_name_len;
   ioctx.locator_set_key(
     string((maxlen/2), 'a'));
   ASSERT_EQ(
@@ -220,7 +220,7 @@ TEST_F(LibRadosMiscPP, LongLocatorPP) {
 TEST_F(LibRadosMiscPP, LongNSpacePP) {
   bufferlist bl;
   bl.append("content");
-  int maxlen = g_conf->osd_max_object_namespace_len;
+  int maxlen = g_conf()->osd_max_object_namespace_len;
   ioctx.set_namespace(
     string((maxlen/2), 'a'));
   ASSERT_EQ(
@@ -261,7 +261,7 @@ TEST_F(LibRadosMiscPP, LongNSpacePP) {
 TEST_F(LibRadosMiscPP, LongAttrNamePP) {
   bufferlist bl;
   bl.append("content");
-  int maxlen = g_conf->osd_max_attr_name_len;
+  int maxlen = g_conf()->osd_max_attr_name_len;
   ASSERT_EQ(0, ioctx.setxattr("bigattrobj", string(maxlen/2, 'a').c_str(), bl));
   ASSERT_EQ(0, ioctx.setxattr("bigattrobj", string(maxlen-1, 'a').c_str(), bl));
   ASSERT_EQ(0, ioctx.setxattr("bigattrobj", string(maxlen, 'a').c_str(), bl));
@@ -733,17 +733,17 @@ TEST_F(LibRadosMiscPP, BigAttrPP) {
 
   bufferlist got;
 
-  cout << "osd_max_attr_size = " << g_conf->osd_max_attr_size << std::endl;
-  if (g_conf->osd_max_attr_size) {
+  cout << "osd_max_attr_size = " << g_conf()->osd_max_attr_size << std::endl;
+  if (g_conf()->osd_max_attr_size) {
     bl.clear();
     got.clear();
-    bl.append(buffer::create(g_conf->osd_max_attr_size));
+    bl.append(buffer::create(g_conf()->osd_max_attr_size));
     ASSERT_EQ(0, ioctx.setxattr("foo", "one", bl));
     ASSERT_EQ((int)bl.length(), ioctx.getxattr("foo", "one", got));
     ASSERT_TRUE(bl.contents_equal(got));
 
     bl.clear();
-    bl.append(buffer::create(g_conf->osd_max_attr_size+1));
+    bl.append(buffer::create(g_conf()->osd_max_attr_size+1));
     ASSERT_EQ(-EFBIG, ioctx.setxattr("foo", "one", bl));
   } else {
     cout << "osd_max_attr_size == 0; skipping test" << std::endl;
@@ -752,7 +752,7 @@ TEST_F(LibRadosMiscPP, BigAttrPP) {
   for (int i=0; i<1000; i++) {
     bl.clear();
     got.clear();
-    bl.append(buffer::create(std::min<uint64_t>(g_conf->osd_max_attr_size,
+    bl.append(buffer::create(std::min<uint64_t>(g_conf()->osd_max_attr_size,
                                                1024)));
     char n[10];
     snprintf(n, sizeof(n), "a%d", i);
@@ -812,7 +812,7 @@ TEST_F(LibRadosMiscPP, CopyPP) {
   }
 
   // do a big object
-  bl.append(buffer::create(g_conf->osd_copyfrom_max_chunk * 3));
+  bl.append(buffer::create(g_conf()->osd_copyfrom_max_chunk * 3));
   bl.zero();
   bl.append("tail");
   blc = bl;
@@ -923,7 +923,7 @@ TEST_F(LibRadosMiscPP, CopyScrubPP) {
   bufferlist inbl, bl, x;
   for (int i=0; i<100; ++i)
     x.append("barrrrrrrrrrrrrrrrrrrrrrrrrr");
-  bl.append(buffer::create(g_conf->osd_copyfrom_max_chunk * 3));
+  bl.append(buffer::create(g_conf()->osd_copyfrom_max_chunk * 3));
   bl.zero();
   bl.append("tail");
   bufferlist cbl;
index afb4ee23d8cea58a5750635d28754de07c9b0ddf..da37fb3d62f3519bbe79d356553a5e2f8ecf41a9 100644 (file)
@@ -1,8 +1,9 @@
 #include "include/rados/librados.h"
 #include "include/rados/librados.hpp"
+#include "include/stringify.h"
+#include "common/config_proxy.h"
 #include "test/librados/test.h"
 #include "test/librados/TestCase.h"
-#include "include/stringify.h"
 
 #include <algorithm>
 #include <thread>
@@ -134,8 +135,8 @@ TEST(LibRadosServicePP, Close) {
       cluster.shutdown();
     }
     // mgr updates servicemap every tick
-    //sleep(g_conf->get_val<int64_t>("mgr_tick_period"));
-    std::this_thread::sleep_for(g_conf->get_val<std::chrono::seconds>(
+    //sleep(g_conf().get_val<int64_t>("mgr_tick_period"));
+    std::this_thread::sleep_for(g_conf().get_val<std::chrono::seconds>(
                                  "mgr_tick_period"));
     // make sure we are deregistered
     {
index b270ba4ab9d409b112b3a2828a77580f0bdcd85e..986849e6428419634d7665260ac6ed49a25957f8 100644 (file)
@@ -34,9 +34,9 @@ struct BreakRequest<librbd::MockImageCtx> {
                               uint32_t blacklist_expire_seconds,
                               bool force_break_lock, Context *on_finish) {
     CephContext *cct = reinterpret_cast<CephContext *>(ioctx.cct());
-    EXPECT_EQ(cct->_conf->get_val<bool>("rbd_blacklist_on_break_lock"),
+    EXPECT_EQ(cct->_conf.get_val<bool>("rbd_blacklist_on_break_lock"),
               blacklist_locker);
-    EXPECT_EQ(cct->_conf->get_val<int64_t>("rbd_blacklist_expire_seconds"),
+    EXPECT_EQ(cct->_conf.get_val<int64_t>("rbd_blacklist_expire_seconds"),
               (int)blacklist_expire_seconds);
     EXPECT_FALSE(force_break_lock);
     assert(s_instance != nullptr);
index 276371a2ab59875956a78d0aa9188a4688786399..a0c4559c4d8467f8027bafae99dc1f3e4f73252a 100644 (file)
@@ -102,7 +102,7 @@ int main(int argc, const char **argv)
          "initial msgs (pipe depth) " << n_msgs << " " <<
          "data buffer size " << n_dsize << std::endl;
 
-       messenger = Messenger::create(g_ceph_context, g_conf->get_val<std::string>("ms_type"),
+       messenger = Messenger::create(g_ceph_context, g_conf().get_val<std::string>("ms_type"),
                                      entity_name_t::MON(-1),
                                      "client",
                                      getpid(), 0);
index ba54879ea88e58fa8bb84f68ad9bd43c537a860d..8b85f3afbcf30250668a14dc74b694d502a87026 100644 (file)
@@ -73,7 +73,7 @@ int main(int argc, const char **argv)
        dest_str += port;
        entity_addr_from_url(&bind_addr, dest_str.c_str());
 
-       messenger = Messenger::create(g_ceph_context, g_conf->get_val<std::string>("ms_type"),
+       messenger = Messenger::create(g_ceph_context, g_conf().get_val<std::string>("ms_type"),
                                      entity_name_t::MON(-1),
                                      "simple_server",
                                      0 /* nonce */,
index 52ae30161f0a130a33d12f34ded759986f3c4a56..2b09f33e758dd8dd957d9ada3cffe0f1c17184fc 100644 (file)
@@ -97,7 +97,7 @@ TEST_F(MonMapTest, build_initial_config_from_dns) {
 
 
   CephContext *cct = (new CephContext(CEPH_ENTITY_TYPE_MON))->get();
-  cct->_conf->set_val("mon_dns_srv_name", "cephmon");
+  cct->_conf.set_val("mon_dns_srv_name", "cephmon");
   MonMap monmap;
   int r = monmap.build_initial(cct, std::cerr);
 
@@ -195,7 +195,7 @@ TEST_F(MonMapTest, build_initial_config_from_dns_with_domain) {
 
 
   CephContext *cct = (new CephContext(CEPH_ENTITY_TYPE_MON))->get();
-  cct->_conf->set_val("mon_dns_srv_name", "cephmon_ceph.com");
+  cct->_conf.set_val("mon_dns_srv_name", "cephmon_ceph.com");
   MonMap monmap;
   int r = monmap.build_initial(cct, std::cerr);
 
index f033e859af1242cac3ab62dc12bee4751f2a5ae8..0afa9844395ebd4892298a9629d41099323a1c33 100644 (file)
@@ -80,7 +80,7 @@ public:
   int init_messenger() {
     dout(1) << __func__ << dendl;
 
-    std::string public_msgr_type = cct->_conf->ms_public_type.empty() ? cct->_conf->get_val<std::string>("ms_type") : cct->_conf->ms_public_type;
+    std::string public_msgr_type = cct->_conf->ms_public_type.empty() ? cct->_conf.get_val<std::string>("ms_type") : cct->_conf->ms_public_type;
     msg = Messenger::create(cct, public_msgr_type, entity_name_t::CLIENT(-1),
                             "test-mon-msg", 0, 0);
     assert(msg != NULL);
@@ -331,7 +331,7 @@ int main(int argc, char *argv[])
                         CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY,
                         CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
   common_init_finish(g_ceph_context);
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
   ::testing::InitGoogleTest(&argc, argv);
 
   return RUN_ALL_TESTS();
index 1b968d33650f4c9df6267849a2dd89b2048ad403..2f976a4e1323b36f3e051bc59bf0f091222f271b 100644 (file)
@@ -361,12 +361,12 @@ class OSDStub : public TestStub
             << cct->_conf->auth_supported << dendl;
     stringstream ss;
     ss << "client-osd" << whoami;
-    std::string public_msgr_type = cct->_conf->ms_public_type.empty() ? cct->_conf->get_val<std::string>("ms_type") : cct->_conf->ms_public_type;
+    std::string public_msgr_type = cct->_conf->ms_public_type.empty() ? cct->_conf.get_val<std::string>("ms_type") : cct->_conf->ms_public_type;
     messenger.reset(Messenger::create(cct, public_msgr_type, entity_name_t::OSD(whoami),
                                      ss.str().c_str(), getpid(), 0));
 
     Throttle throttler(g_ceph_context, "osd_client_bytes",
-       g_conf->osd_client_message_size_cap);
+       g_conf()->osd_client_message_size_cap);
 
     messenger->set_default_policy(
        Messenger::Policy::stateless_server(0));
@@ -380,8 +380,8 @@ class OSDStub : public TestStub
     messenger->set_policy(entity_name_t::TYPE_OSD,
        Messenger::Policy::stateless_server(0));
 
-    dout(10) << __func__ << " public addr " << g_conf->public_addr << dendl;
-    int err = messenger->bind(g_conf->public_addr);
+    dout(10) << __func__ << " public addr " << g_conf()->public_addr << dendl;
+    int err = messenger->bind(g_conf()->public_addr);
     if (err < 0)
       exit(1);
 
@@ -397,8 +397,8 @@ class OSDStub : public TestStub
     Mutex::Locker l(lock);
 
     dout(1) << __func__ << " fsid " << monc.monmap.fsid
-           << " osd_fsid " << g_conf->osd_uuid << dendl;
-    dout(1) << __func__ << " name " << g_conf->name << dendl;
+           << " osd_fsid " << g_conf()->osd_uuid << dendl;
+    dout(1) << __func__ << " name " << g_conf()->name << dendl;
 
     timer.init();
     messenger->add_dispatcher_head(this);
@@ -1001,7 +1001,7 @@ int main(int argc, const char *argv[])
                         CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
 
   common_init_finish(g_ceph_context);
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   set<int> stub_ids;
   double duration = 300.0;
index 1442b05784a522d6f67a9490c6195d16e9278cc1..e247fca5e91b54606959aef6dd6484408d2f43e2 100644 (file)
@@ -183,7 +183,7 @@ int main(int argc, char **argv)
                         CODE_ENVIRONMENT_UTILITY,
                         CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
   common_init_finish(g_ceph_context);
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   if (args.size() < 6) {
     usage(argv[0]);
@@ -196,7 +196,7 @@ int main(int argc, char **argv)
   int think_time = atoi(args[4]);
   int len = atoi(args[5]);
 
-  std::string public_msgr_type = g_ceph_context->_conf->ms_public_type.empty() ? g_ceph_context->_conf->get_val<std::string>("ms_type") : g_ceph_context->_conf->ms_public_type;
+  std::string public_msgr_type = g_ceph_context->_conf->ms_public_type.empty() ? g_ceph_context->_conf.get_val<std::string>("ms_type") : g_ceph_context->_conf->ms_public_type;
 
   cerr << " using ms-public-type " << public_msgr_type << std::endl;
   cerr << "       server ip:port " << args[0] << std::endl;
index 7df732853daf6a5c873bb590744373a499461e10..fc7ff16ca4b38a53214411b9a055e517ad322050 100644 (file)
@@ -149,7 +149,7 @@ int main(int argc, char **argv)
                         CODE_ENVIRONMENT_UTILITY,
                         CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
   common_init_finish(g_ceph_context);
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   if (args.size() < 3) {
     usage(argv[0]);
@@ -158,7 +158,7 @@ int main(int argc, char **argv)
 
   int worker_threads = atoi(args[1]);
   int think_time = atoi(args[2]);
-  std::string public_msgr_type = g_ceph_context->_conf->ms_public_type.empty() ? g_ceph_context->_conf->get_val<std::string>("ms_type") : g_ceph_context->_conf->ms_public_type;
+  std::string public_msgr_type = g_ceph_context->_conf->ms_public_type.empty() ? g_ceph_context->_conf.get_val<std::string>("ms_type") : g_ceph_context->_conf->ms_public_type;
 
   cerr << " This tool won't handle connection error alike things, " << std::endl;
   cerr << "please ensure the proper network environment to test." << std::endl;
index 9bd9f611cc99f8dc0829c2e3de4401e4c6be0d75..921539b1f9bd58ba3f684ccdf0699a29217ba2d1 100644 (file)
@@ -53,7 +53,7 @@ public:
   const char** get_tracked_conf_keys() const override {
     return ptrs;
   }
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                          const std::set <std::string> &changed) override {
   }
 };
@@ -73,17 +73,17 @@ class NetworkWorkerTest : public ::testing::TestWithParam<const char*> {
   void SetUp() override {
     cerr << __func__ << " start set up " << GetParam() << std::endl;
     if (strncmp(GetParam(), "dpdk", 4)) {
-      g_ceph_context->_conf->set_val("ms_type", "async+posix");
+      g_ceph_context->_conf.set_val("ms_type", "async+posix");
       addr = "127.0.0.1:15000";
       port_addr = "127.0.0.1:15001";
     } else {
-      g_ceph_context->_conf->set_val_or_die("ms_type", "async+dpdk");
-      g_ceph_context->_conf->set_val_or_die("ms_dpdk_debug_allow_loopback", "true");
-      g_ceph_context->_conf->set_val_or_die("ms_async_op_threads", "2");
-      g_ceph_context->_conf->set_val_or_die("ms_dpdk_coremask", "0x7");
-      g_ceph_context->_conf->set_val_or_die("ms_dpdk_host_ipv4_addr", "172.16.218.3");
-      g_ceph_context->_conf->set_val_or_die("ms_dpdk_gateway_ipv4_addr", "172.16.218.2");
-      g_ceph_context->_conf->set_val_or_die("ms_dpdk_netmask_ipv4_addr", "255.255.255.0");
+      g_ceph_context->_conf.set_val_or_die("ms_type", "async+dpdk");
+      g_ceph_context->_conf.set_val_or_die("ms_dpdk_debug_allow_loopback", "true");
+      g_ceph_context->_conf.set_val_or_die("ms_async_op_threads", "2");
+      g_ceph_context->_conf.set_val_or_die("ms_dpdk_coremask", "0x7");
+      g_ceph_context->_conf.set_val_or_die("ms_dpdk_host_ipv4_addr", "172.16.218.3");
+      g_ceph_context->_conf.set_val_or_die("ms_dpdk_gateway_ipv4_addr", "172.16.218.2");
+      g_ceph_context->_conf.set_val_or_die("ms_dpdk_netmask_ipv4_addr", "255.255.255.0");
       addr = "172.16.218.3:15000";
       port_addr = "172.16.218.3:15001";
     }
index 159279c8c7cd059fdd1a1138ecee17d2f5181959..c4cafa9c022855104c845e24d3496f96178248b1 100644 (file)
@@ -390,7 +390,7 @@ TEST_P(MessengerTest, FeatureTest) {
 }
 
 TEST_P(MessengerTest, TimeoutTest) {
-  g_ceph_context->_conf->set_val("ms_tcp_read_timeout", "1");
+  g_ceph_context->_conf.set_val("ms_tcp_read_timeout", "1");
   FakeDispatcher cli_dispatcher(false), srv_dispatcher(true);
   entity_addr_t bind_addr;
   bind_addr.parse("127.0.0.1");
@@ -425,7 +425,7 @@ TEST_P(MessengerTest, TimeoutTest) {
 
   client_msgr->shutdown();
   client_msgr->wait();
-  g_ceph_context->_conf->set_val("ms_tcp_read_timeout", "900");
+  g_ceph_context->_conf.set_val("ms_tcp_read_timeout", "900");
 }
 
 TEST_P(MessengerTest, StatefulTest) {
@@ -677,9 +677,9 @@ TEST_P(MessengerTest, ClientStandbyTest) {
 }
 
 TEST_P(MessengerTest, AuthTest) {
-  g_ceph_context->_conf->set_val("auth_cluster_required", "cephx");
-  g_ceph_context->_conf->set_val("auth_service_required", "cephx");
-  g_ceph_context->_conf->set_val("auth_client_required", "cephx");
+  g_ceph_context->_conf.set_val("auth_cluster_required", "cephx");
+  g_ceph_context->_conf.set_val("auth_service_required", "cephx");
+  g_ceph_context->_conf.set_val("auth_client_required", "cephx");
   FakeDispatcher cli_dispatcher(false), srv_dispatcher(true);
   entity_addr_t bind_addr;
   bind_addr.parse("127.0.0.1");
@@ -705,9 +705,9 @@ TEST_P(MessengerTest, AuthTest) {
   ASSERT_EQ(1U, static_cast<Session*>(conn->get_priv().get())->get_count());
 
   // 2. mix auth
-  g_ceph_context->_conf->set_val("auth_cluster_required", "none");
-  g_ceph_context->_conf->set_val("auth_service_required", "none");
-  g_ceph_context->_conf->set_val("auth_client_required", "none");
+  g_ceph_context->_conf.set_val("auth_cluster_required", "none");
+  g_ceph_context->_conf.set_val("auth_service_required", "none");
+  g_ceph_context->_conf.set_val("auth_client_required", "none");
   conn->mark_down();
   ASSERT_FALSE(conn->is_connected());
   conn = client_msgr->connect_to(server_msgr->get_mytype(),
@@ -1253,9 +1253,9 @@ TEST_P(MessengerTest, SyntheticStressTest1) {
 
 TEST_P(MessengerTest, SyntheticInjectTest) {
   uint64_t dispatch_throttle_bytes = g_ceph_context->_conf->ms_dispatch_throttle_bytes;
-  g_ceph_context->_conf->set_val("ms_inject_socket_failures", "30");
-  g_ceph_context->_conf->set_val("ms_inject_internal_delays", "0.1");
-  g_ceph_context->_conf->set_val("ms_dispatch_throttle_bytes", "16777216");
+  g_ceph_context->_conf.set_val("ms_inject_socket_failures", "30");
+  g_ceph_context->_conf.set_val("ms_inject_internal_delays", "0.1");
+  g_ceph_context->_conf.set_val("ms_dispatch_throttle_bytes", "16777216");
   SyntheticWorkload test_msg(8, 32, GetParam(), 100,
                              Messenger::Policy::stateful_server(0),
                              Messenger::Policy::lossless_client(0));
@@ -1282,15 +1282,15 @@ TEST_P(MessengerTest, SyntheticInjectTest) {
     }
   }
   test_msg.wait_for_done();
-  g_ceph_context->_conf->set_val("ms_inject_socket_failures", "0");
-  g_ceph_context->_conf->set_val("ms_inject_internal_delays", "0");
-  g_ceph_context->_conf->set_val(
+  g_ceph_context->_conf.set_val("ms_inject_socket_failures", "0");
+  g_ceph_context->_conf.set_val("ms_inject_internal_delays", "0");
+  g_ceph_context->_conf.set_val(
       "ms_dispatch_throttle_bytes", std::to_string(dispatch_throttle_bytes));
 }
 
 TEST_P(MessengerTest, SyntheticInjectTest2) {
-  g_ceph_context->_conf->set_val("ms_inject_socket_failures", "30");
-  g_ceph_context->_conf->set_val("ms_inject_internal_delays", "0.1");
+  g_ceph_context->_conf.set_val("ms_inject_socket_failures", "30");
+  g_ceph_context->_conf.set_val("ms_inject_internal_delays", "0.1");
   SyntheticWorkload test_msg(8, 16, GetParam(), 100,
                              Messenger::Policy::lossless_peer_reuse(0),
                              Messenger::Policy::lossless_peer_reuse(0));
@@ -1317,13 +1317,13 @@ TEST_P(MessengerTest, SyntheticInjectTest2) {
     }
   }
   test_msg.wait_for_done();
-  g_ceph_context->_conf->set_val("ms_inject_socket_failures", "0");
-  g_ceph_context->_conf->set_val("ms_inject_internal_delays", "0");
+  g_ceph_context->_conf.set_val("ms_inject_socket_failures", "0");
+  g_ceph_context->_conf.set_val("ms_inject_internal_delays", "0");
 }
 
 TEST_P(MessengerTest, SyntheticInjectTest3) {
-  g_ceph_context->_conf->set_val("ms_inject_socket_failures", "600");
-  g_ceph_context->_conf->set_val("ms_inject_internal_delays", "0.1");
+  g_ceph_context->_conf.set_val("ms_inject_socket_failures", "600");
+  g_ceph_context->_conf.set_val("ms_inject_internal_delays", "0.1");
   SyntheticWorkload test_msg(8, 16, GetParam(), 100,
                              Messenger::Policy::stateless_server(0),
                              Messenger::Policy::lossy_client(0));
@@ -1350,17 +1350,17 @@ TEST_P(MessengerTest, SyntheticInjectTest3) {
     }
   }
   test_msg.wait_for_done();
-  g_ceph_context->_conf->set_val("ms_inject_socket_failures", "0");
-  g_ceph_context->_conf->set_val("ms_inject_internal_delays", "0");
+  g_ceph_context->_conf.set_val("ms_inject_socket_failures", "0");
+  g_ceph_context->_conf.set_val("ms_inject_internal_delays", "0");
 }
 
 
 TEST_P(MessengerTest, SyntheticInjectTest4) {
-  g_ceph_context->_conf->set_val("ms_inject_socket_failures", "30");
-  g_ceph_context->_conf->set_val("ms_inject_internal_delays", "0.1");
-  g_ceph_context->_conf->set_val("ms_inject_delay_probability", "1");
-  g_ceph_context->_conf->set_val("ms_inject_delay_type", "client osd");
-  g_ceph_context->_conf->set_val("ms_inject_delay_max", "5");
+  g_ceph_context->_conf.set_val("ms_inject_socket_failures", "30");
+  g_ceph_context->_conf.set_val("ms_inject_internal_delays", "0.1");
+  g_ceph_context->_conf.set_val("ms_inject_delay_probability", "1");
+  g_ceph_context->_conf.set_val("ms_inject_delay_type", "client osd");
+  g_ceph_context->_conf.set_val("ms_inject_delay_max", "5");
   SyntheticWorkload test_msg(16, 32, GetParam(), 100,
                              Messenger::Policy::lossless_peer(0),
                              Messenger::Policy::lossless_peer(0));
@@ -1387,11 +1387,11 @@ TEST_P(MessengerTest, SyntheticInjectTest4) {
     }
   }
   test_msg.wait_for_done();
-  g_ceph_context->_conf->set_val("ms_inject_socket_failures", "0");
-  g_ceph_context->_conf->set_val("ms_inject_internal_delays", "0");
-  g_ceph_context->_conf->set_val("ms_inject_delay_probability", "0");
-  g_ceph_context->_conf->set_val("ms_inject_delay_type", "");
-  g_ceph_context->_conf->set_val("ms_inject_delay_max", "0");
+  g_ceph_context->_conf.set_val("ms_inject_socket_failures", "0");
+  g_ceph_context->_conf.set_val("ms_inject_internal_delays", "0");
+  g_ceph_context->_conf.set_val("ms_inject_delay_probability", "0");
+  g_ceph_context->_conf.set_val("ms_inject_delay_type", "");
+  g_ceph_context->_conf.set_val("ms_inject_delay_max", "0");
 }
 
 
@@ -1556,13 +1556,13 @@ int main(int argc, char **argv) {
   auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
                         CODE_ENVIRONMENT_UTILITY,
                         CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
-  g_ceph_context->_conf->set_val("auth_cluster_required", "none");
-  g_ceph_context->_conf->set_val("auth_service_required", "none");
-  g_ceph_context->_conf->set_val("auth_client_required", "none");
-  g_ceph_context->_conf->set_val("enable_experimental_unrecoverable_data_corrupting_features", "ms-type-async");
-  g_ceph_context->_conf->set_val("ms_die_on_bad_msg", "true");
-  g_ceph_context->_conf->set_val("ms_die_on_old_message", "true");
-  g_ceph_context->_conf->set_val("ms_max_backoff", "1");
+  g_ceph_context->_conf.set_val("auth_cluster_required", "none");
+  g_ceph_context->_conf.set_val("auth_service_required", "none");
+  g_ceph_context->_conf.set_val("auth_client_required", "none");
+  g_ceph_context->_conf.set_val("enable_experimental_unrecoverable_data_corrupting_features", "ms-type-async");
+  g_ceph_context->_conf.set_val("ms_die_on_bad_msg", "true");
+  g_ceph_context->_conf.set_val("ms_die_on_old_message", "true");
+  g_ceph_context->_conf.set_val("ms_max_backoff", "1");
   common_init_finish(g_ceph_context);
 
   ::testing::InitGoogleTest(&argc, argv);
index 7a166d7d4d57b3c721dfde6430cd4d4f205fcf31..5e248cbe21f4d1d7a94fd97841007589128afc4d 100644 (file)
@@ -250,7 +250,7 @@ int main(int argc, char **argv)
                         CODE_ENVIRONMENT_UTILITY,
                         CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
   common_init_finish(g_ceph_context);
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
   Cycles::init();
 
   cerr << "args: " << args << std::endl;
index 3f0d599b24f42014ec2f453b52b6c561fd85245d..76e7a6c5777fbfd8e0053252bb5750cbe0ae2293 100644 (file)
@@ -440,9 +440,9 @@ int main(int argc, char **argv) {
                         CODE_ENVIRONMENT_UTILITY,
                         CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
   common_init_finish(g_ceph_context);
-  g_ceph_context->_conf->set_val("err_to_stderr", "false");
-  g_ceph_context->_conf->set_val("log_to_stderr", "false");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("err_to_stderr", "false");
+  g_ceph_context->_conf.set_val("log_to_stderr", "false");
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   const char* file = FILENAME;
   int x = 1234;
index 941cc81d12f44abe6e812b0dd4f2bba493e332cf..dc55ac28600b9daa0d5ba76acd3bcf7e32aab980 100644 (file)
@@ -152,7 +152,7 @@ public:
           uint64_t align)> MatrixTest;
 
   void StartDeferred(size_t min_alloc_size) {
-    SetVal(g_conf, "bluestore_min_alloc_size", stringify(min_alloc_size).c_str());
+    SetVal(g_conf(), "bluestore_min_alloc_size", stringify(min_alloc_size).c_str());
     DeferredSetup();
   }
 
@@ -175,7 +175,7 @@ protected:
       return stringify(num_ops);
     } else {
       char *buf;
-      g_conf->get_val(k, &buf, -1);
+      g_conf().get_val(k, &buf, -1);
       string v = buf;
       free(buf);
       return v;
@@ -192,7 +192,7 @@ protected:
     } else if (string(k) == "num_ops") {
       num_ops = atoll(v);
     } else {
-      SetVal(g_conf, k, v);
+      SetVal(g_conf(), k, v);
     }
   }
 
@@ -217,7 +217,7 @@ protected:
         cout << "  " << matrix[k][0] << " = " << matrix_get(matrix[k][0])
             << std::endl;
       }
-      g_ceph_context->_conf->apply_changes(NULL);
+      g_ceph_context->_conf.apply_changes(nullptr);
       fn(num_ops, max_size, max_write, alignment);
     }
   }
@@ -589,7 +589,7 @@ TEST_P(StoreTest, SimpleColPreHashTest) {
   std::ostringstream oss;
   if (merge_threshold > 0) {
     oss << "-" << merge_threshold;
-    SetVal(g_conf, "filestore_merge_threshold", oss.str().c_str());
+    SetVal(g_conf(), "filestore_merge_threshold", oss.str().c_str());
   }
 
   uint32_t pg_num = 128;
@@ -1051,8 +1051,8 @@ void StoreTest::doCompressionTest()
   EXPECT_EQ(store->mount(), 0);
   ch = store->open_collection(cid);
   auto settingsBookmark = BookmarkSettings();
-  SetVal(g_conf, "bluestore_compression_min_blob_size", "262144");
-  g_ceph_context->_conf->apply_changes(NULL);
+  SetVal(g_conf(), "bluestore_compression_min_blob_size", "262144");
+  g_ceph_context->_conf.apply_changes(nullptr);
   {
     data.resize(0x10000*6);
 
@@ -1085,14 +1085,14 @@ TEST_P(StoreTest, CompressionTest) {
   if (string(GetParam()) != "bluestore")
     return;
 
-  SetVal(g_conf, "bluestore_compression_algorithm", "snappy");
-  SetVal(g_conf, "bluestore_compression_mode", "force");
-  g_ceph_context->_conf->apply_changes(NULL);
+  SetVal(g_conf(), "bluestore_compression_algorithm", "snappy");
+  SetVal(g_conf(), "bluestore_compression_mode", "force");
+  g_ceph_context->_conf.apply_changes(nullptr);
   doCompressionTest();
 
-  SetVal(g_conf, "bluestore_compression_algorithm", "zlib");
-  SetVal(g_conf, "bluestore_compression_mode", "aggressive");
-  g_ceph_context->_conf->apply_changes(NULL);
+  SetVal(g_conf(), "bluestore_compression_algorithm", "zlib");
+  SetVal(g_conf(), "bluestore_compression_mode", "aggressive");
+  g_ceph_context->_conf.apply_changes(nullptr);
   doCompressionTest();
 }
 
@@ -1316,10 +1316,10 @@ TEST_P(StoreTestSpecificAUSize, BluestoreStatFSTest) {
   if(string(GetParam()) != "bluestore")
     return;
   StartDeferred(65536);
-  SetVal(g_conf, "bluestore_compression_mode", "force");
+  SetVal(g_conf(), "bluestore_compression_mode", "force");
   // just a big number to disble gc
-  SetVal(g_conf, "bluestore_gc_enable_total_threshold", "100000");
-  g_conf->apply_changes(NULL);
+  SetVal(g_conf(), "bluestore_gc_enable_total_threshold", "100000");
+  g_conf().apply_changes(nullptr);
   int r;
 
   coll_t cid;
@@ -1357,8 +1357,8 @@ TEST_P(StoreTestSpecificAUSize, BluestoreStatFSTest) {
     ASSERT_EQ(r, 0);
     ASSERT_EQ( 0u, statfs.allocated);
     ASSERT_EQ( 0u, statfs.stored);
-    ASSERT_EQ(g_conf->bluestore_block_size, statfs.total);
-    ASSERT_TRUE(statfs.available > 0u && statfs.available < g_conf->bluestore_block_size);
+    ASSERT_EQ(g_conf()->bluestore_block_size, statfs.total);
+    ASSERT_TRUE(statfs.available > 0u && statfs.available < g_conf()->bluestore_block_size);
     //force fsck
     ch.reset();
     EXPECT_EQ(store->umount(), 0);
@@ -1604,10 +1604,10 @@ TEST_P(StoreTestSpecificAUSize, BluestoreFragmentedBlobTest) {
     struct store_statfs_t statfs;
     int r = store->statfs(&statfs);
     ASSERT_EQ(r, 0);
-    ASSERT_EQ(g_conf->bluestore_block_size, statfs.total);
+    ASSERT_EQ(g_conf()->bluestore_block_size, statfs.total);
     ASSERT_EQ(0u, statfs.allocated);
     ASSERT_EQ(0u, statfs.stored);
-    ASSERT_TRUE(statfs.available > 0u && statfs.available < g_conf->bluestore_block_size);
+    ASSERT_TRUE(statfs.available > 0u && statfs.available < g_conf()->bluestore_block_size);
   }
   std::string data;
   data.resize(0x10000 * 3);
@@ -1931,7 +1931,7 @@ TEST_P(StoreTest, AppendDeferredVsTailCache) {
     r = store->queue_transaction(ch, std::move(t));
     ASSERT_EQ(r, 0);
   }
-  unsigned min_alloc = g_conf->bluestore_min_alloc_size;
+  unsigned min_alloc = g_conf()->bluestore_min_alloc_size;
   unsigned size = min_alloc / 3;
   bufferptr bpa(size);
   memset(bpa.c_str(), 1, bpa.length());
@@ -2008,7 +2008,7 @@ TEST_P(StoreTest, AppendZeroTrailingSharedBlock) {
     r = store->queue_transaction(ch, std::move(t));
     ASSERT_EQ(r, 0);
   }
-  unsigned min_alloc = g_conf->bluestore_min_alloc_size;
+  unsigned min_alloc = g_conf()->bluestore_min_alloc_size;
   unsigned size = min_alloc / 3;
   bufferptr bpa(size);
   memset(bpa.c_str(), 1, bpa.length());
@@ -4261,9 +4261,9 @@ void StoreTest::doSyntheticTest(
   gen_type rng(time(NULL));
   coll_t cid(spg_t(pg_t(0,555), shard_id_t::NO_SHARD));
 
-  SetVal(g_conf, "bluestore_fsck_on_mount", "false");
-  SetVal(g_conf, "bluestore_fsck_on_umount", "false");
-  g_ceph_context->_conf->apply_changes(NULL);
+  SetVal(g_conf(), "bluestore_fsck_on_mount", "false");
+  SetVal(g_conf(), "bluestore_fsck_on_umount", "false");
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   SyntheticWorkloadState test_obj(store.get(), &gen, &rng, cid,
                                  max_obj, max_wr, align);
@@ -5538,8 +5538,8 @@ TEST_P(StoreTest, TryMoveRename) {
 TEST_P(StoreTest, BluestoreOnOffCSumTest) {
   if (string(GetParam()) != "bluestore")
     return;
-  SetVal(g_conf, "bluestore_csum_type", "crc32c");
-  g_conf->apply_changes(NULL);
+  SetVal(g_conf(), "bluestore_csum_type", "crc32c");
+  g_conf().apply_changes(nullptr);
 
   int r;
   coll_t cid;
@@ -5570,8 +5570,8 @@ TEST_P(StoreTest, BluestoreOnOffCSumTest) {
     r = queue_transaction(store, ch, std::move(t));
     ASSERT_EQ(r, 0);
 
-    SetVal(g_conf, "bluestore_csum_type", "none");
-    g_conf->apply_changes(NULL);
+    SetVal(g_conf(), "bluestore_csum_type", "none");
+    g_conf().apply_changes(nullptr);
 
     bufferlist in;
     r = store->read(ch, hoid, 0, block_size, in);
@@ -5594,8 +5594,8 @@ TEST_P(StoreTest, BluestoreOnOffCSumTest) {
     r = queue_transaction(store, ch, std::move(t));
     ASSERT_EQ(r, 0);
 
-    SetVal(g_conf, "bluestore_csum_type", "crc32c");
-    g_conf->apply_changes(NULL);
+    SetVal(g_conf(), "bluestore_csum_type", "crc32c");
+    g_conf().apply_changes(nullptr);
 
     bufferlist in;
     r = store->read(ch, hoid, 0, block_size, in);
@@ -5616,8 +5616,8 @@ TEST_P(StoreTest, BluestoreOnOffCSumTest) {
     r = queue_transaction(store, ch, std::move(t));
     ASSERT_EQ(r, 0);
 
-    SetVal(g_conf, "bluestore_csum_type", "none");
-    g_conf->apply_changes(NULL);
+    SetVal(g_conf(), "bluestore_csum_type", "none");
+    g_conf().apply_changes(nullptr);
 
     ObjectStore::Transaction t2;
     t2.write(cid, hoid, block_size*2, bl.length(), bl);
@@ -5634,8 +5634,8 @@ TEST_P(StoreTest, BluestoreOnOffCSumTest) {
     ASSERT_EQ((int)block_size, r);
     ASSERT_TRUE(bl_eq(orig, in));
 
-    SetVal(g_conf, "bluestore_csum_type", "crc32c");
-    g_conf->apply_changes(NULL);
+    SetVal(g_conf(), "bluestore_csum_type", "crc32c");
+    g_conf().apply_changes(nullptr);
     in.clear();
     r = store->read(ch, hoid, 0, block_size, in);
     ASSERT_EQ((int)block_size, r);
@@ -5661,8 +5661,8 @@ TEST_P(StoreTest, BluestoreOnOffCSumTest) {
     r = queue_transaction(store, ch, std::move(t));
     ASSERT_EQ(r, 0);
 
-    SetVal(g_conf, "bluestore_csum_type", "none");
-    g_conf->apply_changes(NULL);
+    SetVal(g_conf(), "bluestore_csum_type", "none");
+    g_conf().apply_changes(nullptr);
 
     ObjectStore::Transaction t2;
     bl.clear();
@@ -5686,8 +5686,8 @@ TEST_P(StoreTest, BluestoreOnOffCSumTest) {
     ASSERT_EQ((int)block_size, r);
     ASSERT_TRUE(bl_eq(orig2, in));
 
-    SetVal(g_conf, "bluestore_csum_type", "crc32c");
-    g_conf->apply_changes(NULL);
+    SetVal(g_conf(), "bluestore_csum_type", "crc32c");
+    g_conf().apply_changes(nullptr);
 
     ObjectStore::Transaction t3;
     bl.clear();
@@ -5811,8 +5811,8 @@ TEST_P(StoreTestSpecificAUSize, Many4KWritesNoCSumTest) {
   if (string(GetParam()) != "bluestore")
     return;
   StartDeferred(0x10000);
-  SetVal(g_conf, "bluestore_csum_type", "none");
-  g_ceph_context->_conf->apply_changes(NULL);
+  SetVal(g_conf(), "bluestore_csum_type", "none");
+  g_ceph_context->_conf.apply_changes(nullptr);
   const unsigned max_object = 4*1024*1024;
 
   doMany4KWritesTest(store, 1, 1000, max_object, 4*1024, 0 );
@@ -5848,11 +5848,11 @@ TEST_P(StoreTestSpecificAUSize, OnodeSizeTracking) {
 
   size_t block_size = 4096;
   StartDeferred(block_size);
-  SetVal(g_conf, "bluestore_compression_mode", "none");
-  SetVal(g_conf, "bluestore_csum_type", "none");
-  SetVal(g_conf, "bluestore_cache_size_hdd", "400000000");
-  SetVal(g_conf, "bluestore_cache_size_ssd", "400000000");
-  g_conf->apply_changes(NULL);
+  SetVal(g_conf(), "bluestore_compression_mode", "none");
+  SetVal(g_conf(), "bluestore_csum_type", "none");
+  SetVal(g_conf(), "bluestore_cache_size_hdd", "400000000");
+  SetVal(g_conf(), "bluestore_cache_size_ssd", "400000000");
+  g_conf().apply_changes(nullptr);
 
   int r;
   coll_t cid;
@@ -5948,8 +5948,8 @@ TEST_P(StoreTestSpecificAUSize, BlobReuseOnOverwrite) {
 
   size_t block_size = 4096;
   StartDeferred(block_size);
-  SetVal(g_conf, "bluestore_max_blob_size", "65536");
-  g_conf->apply_changes(NULL);
+  SetVal(g_conf(), "bluestore_max_blob_size", "65536");
+  g_conf().apply_changes(nullptr);
 
   int r;
   coll_t cid;
@@ -6121,8 +6121,8 @@ TEST_P(StoreTestSpecificAUSize, BlobReuseOnOverwriteReverse) {
 
   size_t block_size = 4096;
   StartDeferred(block_size);
-  SetVal(g_conf, "bluestore_max_blob_size", "65536");
-  g_conf->apply_changes(NULL);
+  SetVal(g_conf(), "bluestore_max_blob_size", "65536");
+  g_conf().apply_changes(nullptr);
 
   int r;
   coll_t cid;
@@ -6302,8 +6302,8 @@ TEST_P(StoreTestSpecificAUSize, BlobReuseOnSmallOverwrite) {
 
   size_t block_size = 4096;
   StartDeferred(block_size);
-  SetVal(g_conf, "bluestore_max_blob_size", "65536");
-  g_conf->apply_changes(NULL);
+  SetVal(g_conf(), "bluestore_max_blob_size", "65536");
+  g_conf().apply_changes(nullptr);
 
   int r;
   coll_t cid;
@@ -6381,10 +6381,10 @@ TEST_P(StoreTestSpecificAUSize, SmallWriteOnShardedExtents) {
   size_t block_size = 0x10000;
   StartDeferred(block_size);
 
-  SetVal(g_conf, "bluestore_csum_type", "xxhash64");
-  SetVal(g_conf, "bluestore_max_blob_size", "524288"); // for sure
+  SetVal(g_conf(), "bluestore_csum_type", "xxhash64");
+  SetVal(g_conf(), "bluestore_max_blob_size", "524288"); // for sure
 
-  g_conf->apply_changes(NULL);
+  g_conf().apply_changes(nullptr);
 
   int r;
   coll_t cid;
@@ -6462,10 +6462,10 @@ TEST_P(StoreTestSpecificAUSize, ExcessiveFragmentation) {
   if (string(GetParam()) != "bluestore")
     return;
 
-  SetVal(g_conf, "bluestore_block_size",
+  SetVal(g_conf(), "bluestore_block_size",
     stringify((uint64_t)2048 * 1024 * 1024).c_str());
 
-  ASSERT_EQ(g_conf->get_val<uint64_t>("bluefs_alloc_size"),
+  ASSERT_EQ(g_conf().get_val<uint64_t>("bluefs_alloc_size"),
            1024 * 1024);
 
   size_t block_size = 0x10000;
@@ -6536,7 +6536,7 @@ TEST_P(StoreTestSpecificAUSize, ExcessiveFragmentation) {
   }
 
   auto to_sleep = 5 *
-    (int)g_conf->get_val<double>("bluestore_bluefs_balance_interval");
+    (int)g_conf().get_val<double>("bluestore_bluefs_balance_interval");
   std::cout<<"sleeping... " << std::endl;
   sleep(to_sleep);
 
@@ -6599,11 +6599,11 @@ TEST_P(StoreTest, KVDBStatsTest) {
   if (string(GetParam()) != "bluestore")
     return;
 
-  SetVal(g_conf, "rocksdb_perf", "true");
-  SetVal(g_conf, "rocksdb_collect_compaction_stats", "true");
-  SetVal(g_conf, "rocksdb_collect_extended_stats","true");
-  SetVal(g_conf, "rocksdb_collect_memory_stats","true");
-  g_ceph_context->_conf->apply_changes(NULL);
+  SetVal(g_conf(), "rocksdb_perf", "true");
+  SetVal(g_conf(), "rocksdb_collect_compaction_stats", "true");
+  SetVal(g_conf(), "rocksdb_collect_extended_stats","true");
+  SetVal(g_conf(), "rocksdb_collect_memory_stats","true");
+  g_ceph_context->_conf.apply_changes(nullptr);
   int r = store->umount();
   ASSERT_EQ(r, 0);
   r = store->mount(); //to force rocksdb stats
@@ -6665,10 +6665,10 @@ TEST_P(StoreTestSpecificAUSize, garbageCollection) {
 
   StartDeferred(65536);
 
-  SetVal(g_conf, "bluestore_compression_max_blob_size", "524288");
-  SetVal(g_conf, "bluestore_compression_min_blob_size", "262144");
-  SetVal(g_conf, "bluestore_compression_mode", "force");
-  g_conf->apply_changes(NULL);
+  SetVal(g_conf(), "bluestore_compression_max_blob_size", "524288");
+  SetVal(g_conf(), "bluestore_compression_min_blob_size", "262144");
+  SetVal(g_conf(), "bluestore_compression_mode", "force");
+  g_conf().apply_changes(nullptr);
 
   auto ch = store->create_new_collection(cid);
 
@@ -6772,7 +6772,7 @@ TEST_P(StoreTestSpecificAUSize, garbageCollection) {
       const PerfCounters* counters = store->get_perf_counters();
       ASSERT_EQ(counters->get(l_bluestore_gc_merged), 0x40001u);
     }
-    SetVal(g_conf, "bluestore_gc_enable_total_threshold", "1"); //forbid GC when saving = 0
+    SetVal(g_conf(), "bluestore_gc_enable_total_threshold", "1"); //forbid GC when saving = 0
     {
       struct store_statfs_t statfs;
       WRITE_AT(1, overlap_offset-2);
@@ -6806,10 +6806,10 @@ TEST_P(StoreTestSpecificAUSize, fsckOnUnalignedDevice) {
   if (string(GetParam()) != "bluestore")
     return;
 
-  SetVal(g_conf, "bluestore_block_size",
+  SetVal(g_conf(), "bluestore_block_size",
     stringify(0x280005000).c_str()); //10 Gb + 4K
-  SetVal(g_conf, "bluestore_fsck_on_mount", "false");
-  SetVal(g_conf, "bluestore_fsck_on_umount", "false");
+  SetVal(g_conf(), "bluestore_fsck_on_mount", "false");
+  SetVal(g_conf(), "bluestore_fsck_on_umount", "false");
   StartDeferred(0x4000);
   store->umount();
   ASSERT_EQ(store->fsck(false), 0); // do fsck explicitly
@@ -6821,10 +6821,10 @@ TEST_P(StoreTestSpecificAUSize, fsckOnUnalignedDevice2) {
   if (string(GetParam()) != "bluestore")
     return;
 
-  SetVal(g_conf, "bluestore_block_size",
+  SetVal(g_conf(), "bluestore_block_size",
     stringify(0x280005000).c_str()); //10 Gb + 20K
-  SetVal(g_conf, "bluestore_fsck_on_mount", "false");
-  SetVal(g_conf, "bluestore_fsck_on_umount", "false");
+  SetVal(g_conf(), "bluestore_fsck_on_mount", "false");
+  SetVal(g_conf(), "bluestore_fsck_on_umount", "false");
   StartDeferred(0x1000);
   store->umount();
   ASSERT_EQ(store->fsck(false), 0); // do fsck explicitly
@@ -6836,12 +6836,12 @@ TEST_P(StoreTest, BluestoreRepairTest) {
     return;
   const size_t offs_base = 65536 / 2;
 
-  SetVal(g_conf, "bluestore_fsck_on_mount", "false");
-  SetVal(g_conf, "bluestore_fsck_on_umount", "false");
-  SetVal(g_conf, "bluestore_max_blob_size",
+  SetVal(g_conf(), "bluestore_fsck_on_mount", "false");
+  SetVal(g_conf(), "bluestore_fsck_on_umount", "false");
+  SetVal(g_conf(), "bluestore_max_blob_size",
     stringify(2 * offs_base).c_str());
-  SetVal(g_conf, "bluestore_extent_map_shard_max_size", "12000");
-  g_ceph_context->_conf->apply_changes(NULL);
+  SetVal(g_conf(), "bluestore_extent_map_shard_max_size", "12000");
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   BlueStore* bstore = dynamic_cast<BlueStore*> (store.get());
 
@@ -6947,8 +6947,8 @@ TEST_P(StoreTest, BluestoreRepairTest) {
   ASSERT_EQ(bstore->fsck(true), 0);
 
   // reproducing issues #21040 & 20983
-  SetVal(g_conf, "bluestore_debug_inject_bug21040", "true");
-  g_ceph_context->_conf->apply_changes(NULL);
+  SetVal(g_conf(), "bluestore_debug_inject_bug21040", "true");
+  g_ceph_context->_conf.apply_changes(nullptr);
   bstore->mount();
 
   cerr << "repro bug #21040" << std::endl;
@@ -6976,8 +6976,8 @@ TEST_P(StoreTest, BluestoreRepairTest) {
     ASSERT_EQ(bstore->fsck(false), 3);
     ASSERT_LE(bstore->repair(false), 0);
     ASSERT_EQ(bstore->fsck(false), 0);
-    SetVal(g_conf, "bluestore_debug_inject_bug21040", "true");
-    g_ceph_context->_conf->apply_changes(NULL);
+    SetVal(g_conf(), "bluestore_debug_inject_bug21040", "true");
+    g_ceph_context->_conf.apply_changes(nullptr);
   }
 
 
@@ -6988,16 +6988,16 @@ TEST_P(StoreTest, BluestoreStatistics) {
   if (string(GetParam()) != "bluestore")
     return;
 
-  SetVal(g_conf, "rocksdb_perf", "true");
-  SetVal(g_conf, "rocksdb_collect_compaction_stats", "true");
-  SetVal(g_conf, "rocksdb_collect_extended_stats","true");
-  SetVal(g_conf, "rocksdb_collect_memory_stats","true");
+  SetVal(g_conf(), "rocksdb_perf", "true");
+  SetVal(g_conf(), "rocksdb_collect_compaction_stats", "true");
+  SetVal(g_conf(), "rocksdb_collect_extended_stats","true");
+  SetVal(g_conf(), "rocksdb_collect_memory_stats","true");
 
   // disable cache
-  SetVal(g_conf, "bluestore_cache_size_ssd", "0");
-  SetVal(g_conf, "bluestore_cache_size_hdd", "0");
-  SetVal(g_conf, "bluestore_cache_size", "0");
-  g_ceph_context->_conf->apply_changes(NULL);
+  SetVal(g_conf(), "bluestore_cache_size_ssd", "0");
+  SetVal(g_conf(), "bluestore_cache_size_hdd", "0");
+  SetVal(g_conf(), "bluestore_cache_size", "0");
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   int r = store->umount();
   ASSERT_EQ(r, 0);
@@ -7044,41 +7044,41 @@ int main(int argc, char **argv) {
   common_init_finish(g_ceph_context);
 
   // make sure we can adjust any config settings
-  g_ceph_context->_conf->_clear_safe_to_start_threads();
-
-  g_ceph_context->_conf->set_val_or_die("osd_journal_size", "400");
-  g_ceph_context->_conf->set_val_or_die("filestore_index_retry_probability", "0.5");
-  g_ceph_context->_conf->set_val_or_die("filestore_op_thread_timeout", "1000");
-  g_ceph_context->_conf->set_val_or_die("filestore_op_thread_suicide_timeout", "10000");
-  //g_ceph_context->_conf->set_val_or_die("filestore_fiemap", "true");
-  g_ceph_context->_conf->set_val_or_die("bluestore_fsck_on_mkfs", "false");
-  g_ceph_context->_conf->set_val_or_die("bluestore_fsck_on_mount", "false");
-  g_ceph_context->_conf->set_val_or_die("bluestore_fsck_on_umount", "false");
-  g_ceph_context->_conf->set_val_or_die("bluestore_debug_misc", "true");
-  g_ceph_context->_conf->set_val_or_die("bluestore_debug_small_allocations", "4");
-  g_ceph_context->_conf->set_val_or_die("bluestore_debug_freelist", "true");
-  g_ceph_context->_conf->set_val_or_die("bluestore_clone_cow", "true");
-  g_ceph_context->_conf->set_val_or_die("bluestore_max_alloc_size", "196608");
+  g_ceph_context->_conf._clear_safe_to_start_threads();
+
+  g_ceph_context->_conf.set_val_or_die("osd_journal_size", "400");
+  g_ceph_context->_conf.set_val_or_die("filestore_index_retry_probability", "0.5");
+  g_ceph_context->_conf.set_val_or_die("filestore_op_thread_timeout", "1000");
+  g_ceph_context->_conf.set_val_or_die("filestore_op_thread_suicide_timeout", "10000");
+  //g_ceph_context->_conf.set_val_or_die("filestore_fiemap", "true");
+  g_ceph_context->_conf.set_val_or_die("bluestore_fsck_on_mkfs", "false");
+  g_ceph_context->_conf.set_val_or_die("bluestore_fsck_on_mount", "false");
+  g_ceph_context->_conf.set_val_or_die("bluestore_fsck_on_umount", "false");
+  g_ceph_context->_conf.set_val_or_die("bluestore_debug_misc", "true");
+  g_ceph_context->_conf.set_val_or_die("bluestore_debug_small_allocations", "4");
+  g_ceph_context->_conf.set_val_or_die("bluestore_debug_freelist", "true");
+  g_ceph_context->_conf.set_val_or_die("bluestore_clone_cow", "true");
+  g_ceph_context->_conf.set_val_or_die("bluestore_max_alloc_size", "196608");
 
   // set small cache sizes so we see trimming during Synthetic tests
-  g_ceph_context->_conf->set_val_or_die("bluestore_cache_size_hdd", "4000000");
-  g_ceph_context->_conf->set_val_or_die("bluestore_cache_size_ssd", "4000000");
+  g_ceph_context->_conf.set_val_or_die("bluestore_cache_size_hdd", "4000000");
+  g_ceph_context->_conf.set_val_or_die("bluestore_cache_size_ssd", "4000000");
 
   // very short *_max prealloc so that we fall back to async submits
-  g_ceph_context->_conf->set_val_or_die("bluestore_blobid_prealloc", "10");
-  g_ceph_context->_conf->set_val_or_die("bluestore_nid_prealloc", "10");
-  g_ceph_context->_conf->set_val_or_die("bluestore_debug_randomize_serial_transaction",
+  g_ceph_context->_conf.set_val_or_die("bluestore_blobid_prealloc", "10");
+  g_ceph_context->_conf.set_val_or_die("bluestore_nid_prealloc", "10");
+  g_ceph_context->_conf.set_val_or_die("bluestore_debug_randomize_serial_transaction",
                                 "10");
 
-  g_ceph_context->_conf->set_val_or_die("bdev_debug_aio", "true");
+  g_ceph_context->_conf.set_val_or_die("bdev_debug_aio", "true");
 
   // specify device size
-  g_ceph_context->_conf->set_val_or_die("bluestore_block_size",
+  g_ceph_context->_conf.set_val_or_die("bluestore_block_size",
     stringify(DEF_STORE_TEST_BLOCKDEV_SIZE));
 
-  g_ceph_context->_conf->set_val_or_die(
+  g_ceph_context->_conf.set_val_or_die(
     "enable_experimental_unrecoverable_data_corrupting_features", "*");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   ::testing::InitGoogleTest(&argc, argv);
   return RUN_ALL_TESTS();
index 11a3760c2424c3d71b0241bdb1ded2efe6310caf..0e590c9b3fa55c66570690c3a159bc27a2d8602f 100644 (file)
@@ -77,10 +77,10 @@ void StoreTestFixture::TearDown()
   }
 }
 
-void StoreTestFixture::SetVal(md_config_t* _conf, const char* key, const char* val)
+void StoreTestFixture::SetVal(ConfigProxy& _conf, const char* key, const char* val)
 {
-  assert(!conf || conf == _conf);
-  conf = _conf;
+  assert(!conf || conf == &_conf);
+  conf = &_conf;
   std::string skey(key);
   std::string prev_val;
   conf->get_val(skey, &prev_val);
index 97b27d9d1f122911f3f04b6aa3d2141bb2c71c52..d816dbdf49de7a71783c96d5670c0363e65e10c2 100644 (file)
@@ -11,7 +11,7 @@ class StoreTestFixture : virtual public ::testing::Test {
   const std::string data_dir;
 
   std::stack<std::pair<std::string, std::string>> saved_settings;
-  md_config_t* conf = nullptr;
+  ConfigProxy* conf = nullptr;
 
 public:
   boost::scoped_ptr<ObjectStore> store;
@@ -23,7 +23,7 @@ public:
 
   void SetUp() override;
   void TearDown() override;
-  void SetVal(md_config_t* conf, const char* key, const char* val);
+  void SetVal(ConfigProxy& conf, const char* key, const char* val);
   struct SettingsBookmark {
     StoreTestFixture& s;
     size_t pos;
index 80435b3c228dbf855d762f4a44952ad52e1024ca..aa6cd571374524a346c0b91dac9d221642a4d9f7 100644 (file)
@@ -164,9 +164,9 @@ void write_data(BlueFS &fs, uint64_t rationed_bytes)
       if (r < 0) {
          break;
       }
-      written_bytes += g_conf->bluefs_alloc_size;
+      written_bytes += g_conf()->bluefs_alloc_size;
       j++;
-      if ((rationed_bytes - written_bytes) <= g_conf->bluefs_alloc_size) {
+      if ((rationed_bytes - written_bytes) <= g_conf()->bluefs_alloc_size) {
         break;
       }
     }
@@ -210,8 +210,8 @@ void write_single_file(BlueFS &fs, uint64_t rationed_bytes)
       if (r < 0) {
          break;
       }
-      written_bytes += g_conf->bluefs_alloc_size;
-      if ((rationed_bytes - written_bytes) <= g_conf->bluefs_alloc_size) {
+      written_bytes += g_conf()->bluefs_alloc_size;
+      if ((rationed_bytes - written_bytes) <= g_conf()->bluefs_alloc_size) {
         break;
       }
     }
@@ -249,10 +249,10 @@ void join_all(std::vector<std::thread>& v)
 TEST(BlueFS, test_flush_1) {
   uint64_t size = 1048576 * 128;
   string fn = get_temp_bdev(size);
-  g_ceph_context->_conf->set_val(
+  g_ceph_context->_conf.set_val(
     "bluefs_alloc_size",
     "65536");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   BlueFS fs(g_ceph_context);
   ASSERT_EQ(0, fs.add_block_device(BlueFS::BDEV_DB, fn, false));
@@ -284,10 +284,10 @@ TEST(BlueFS, test_flush_1) {
 TEST(BlueFS, test_flush_2) {
   uint64_t size = 1048576 * 256;
   string fn = get_temp_bdev(size);
-  g_ceph_context->_conf->set_val(
+  g_ceph_context->_conf.set_val(
     "bluefs_alloc_size",
     "65536");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   BlueFS fs(g_ceph_context);
   ASSERT_EQ(0, fs.add_block_device(BlueFS::BDEV_DB, fn, false));
@@ -312,10 +312,10 @@ TEST(BlueFS, test_flush_2) {
 TEST(BlueFS, test_flush_3) {
   uint64_t size = 1048576 * 256;
   string fn = get_temp_bdev(size);
-  g_ceph_context->_conf->set_val(
+  g_ceph_context->_conf.set_val(
     "bluefs_alloc_size",
     "65536");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   BlueFS fs(g_ceph_context);
   ASSERT_EQ(0, fs.add_block_device(BlueFS::BDEV_DB, fn, false));
@@ -345,7 +345,7 @@ TEST(BlueFS, test_flush_3) {
 }
 
 TEST(BlueFS, test_simple_compaction_sync) {
-  g_ceph_context->_conf->set_val(
+  g_ceph_context->_conf.set_val(
     "bluefs_compact_log_sync",
     "true");
   uint64_t size = 1048576 * 128;
@@ -398,7 +398,7 @@ TEST(BlueFS, test_simple_compaction_sync) {
 }
 
 TEST(BlueFS, test_simple_compaction_async) {
-  g_ceph_context->_conf->set_val(
+  g_ceph_context->_conf.set_val(
     "bluefs_compact_log_sync",
     "false");
   uint64_t size = 1048576 * 128;
@@ -453,10 +453,10 @@ TEST(BlueFS, test_simple_compaction_async) {
 TEST(BlueFS, test_compaction_sync) {
   uint64_t size = 1048576 * 128;
   string fn = get_temp_bdev(size);
-  g_ceph_context->_conf->set_val(
+  g_ceph_context->_conf.set_val(
     "bluefs_alloc_size",
     "65536");
-  g_ceph_context->_conf->set_val(
+  g_ceph_context->_conf.set_val(
     "bluefs_compact_log_sync",
     "true");
 
@@ -491,10 +491,10 @@ TEST(BlueFS, test_compaction_sync) {
 TEST(BlueFS, test_compaction_async) {
   uint64_t size = 1048576 * 128;
   string fn = get_temp_bdev(size);
-  g_ceph_context->_conf->set_val(
+  g_ceph_context->_conf.set_val(
     "bluefs_alloc_size",
     "65536");
-  g_ceph_context->_conf->set_val(
+  g_ceph_context->_conf.set_val(
     "bluefs_compact_log_sync",
     "false");
 
@@ -529,10 +529,10 @@ TEST(BlueFS, test_compaction_async) {
 TEST(BlueFS, test_replay) {
   uint64_t size = 1048576 * 128;
   string fn = get_temp_bdev(size);
-  g_ceph_context->_conf->set_val(
+  g_ceph_context->_conf.set_val(
     "bluefs_alloc_size",
     "65536");
-  g_ceph_context->_conf->set_val(
+  g_ceph_context->_conf.set_val(
     "bluefs_compact_log_sync",
     "false");
 
@@ -580,10 +580,10 @@ int main(int argc, char **argv) {
                         CODE_ENVIRONMENT_UTILITY,
                         CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
   common_init_finish(g_ceph_context);
-  g_ceph_context->_conf->set_val(
+  g_ceph_context->_conf.set_val(
     "enable_experimental_unrecoverable_data_corrupting_features",
     "*");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   ::testing::InitGoogleTest(&argc, argv);
   return RUN_ALL_TESTS();
index 78cdb9879e302b83ce2da4d133276be30eaa91b5..a9ef77c853085891378b75554d199e65f9e41af4 100644 (file)
@@ -49,7 +49,7 @@ int main(int argc, char **argv) {
                         CODE_ENVIRONMENT_UTILITY,
                         CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
   common_init_finish(g_ceph_context);
-  g_ceph_context->_conf->apply_changes(NULL);
+  cct->_conf.apply_changes(nullptr);
 
   std::cerr << "args: " << args << std::endl;
   if (args.size() < 4) {
index 052db64915ffadc1c7d2f6ca4c1169a5de216dcd..33608c2bb3ff2a1ca03fce56832c0b30f41750ca 100644 (file)
@@ -218,7 +218,7 @@ int main(int argc, const char *argv[])
                         CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY,
                         CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
   common_init_finish(g_ceph_context);
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   std::string command;
   std::vector<std::string> command_args;
index cf5948f8c13b2dea6a05b4056c24e321c6e03923..407cee5d929ca2ef7b0f8b99993566c4c071ec01 100644 (file)
@@ -319,7 +319,7 @@ TEST_P(KVTest, RocksDBColumnFamilyTest) {
   std::vector<KeyValueDB::ColumnFamily> cfs;
   cfs.push_back(KeyValueDB::ColumnFamily("cf1", ""));
   cfs.push_back(KeyValueDB::ColumnFamily("cf2", ""));
-  ASSERT_EQ(0, db->init(g_conf->bluestore_rocksdb_options));
+  ASSERT_EQ(0, db->init(g_conf()->bluestore_rocksdb_options));
   cout << "creating two column families and opening them" << std::endl;
   ASSERT_EQ(0, db->create_and_open(cout, cfs));
   {
@@ -374,7 +374,7 @@ TEST_P(KVTest, RocksDBIteratorTest) {
 
   std::vector<KeyValueDB::ColumnFamily> cfs;
   cfs.push_back(KeyValueDB::ColumnFamily("cf1", ""));
-  ASSERT_EQ(0, db->init(g_conf->bluestore_rocksdb_options));
+  ASSERT_EQ(0, db->init(g_conf()->bluestore_rocksdb_options));
   cout << "creating one column family and opening it" << std::endl;
   ASSERT_EQ(0, db->create_and_open(cout, cfs));
   {
@@ -427,7 +427,7 @@ TEST_P(KVTest, RocksDBCFMerge) {
     return; // No merge operators for this database type
   std::vector<KeyValueDB::ColumnFamily> cfs;
   cfs.push_back(KeyValueDB::ColumnFamily("cf1", ""));
-  ASSERT_EQ(0, db->init(g_conf->bluestore_rocksdb_options));
+  ASSERT_EQ(0, db->init(g_conf()->bluestore_rocksdb_options));
   cout << "creating one column family and opening it" << std::endl;
   ASSERT_EQ(0, db->create_and_open(cout, cfs));
 
@@ -492,10 +492,10 @@ int main(int argc, char **argv) {
                         CODE_ENVIRONMENT_UTILITY,
                         CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
   common_init_finish(g_ceph_context);
-  g_ceph_context->_conf->set_val(
+  g_ceph_context->_conf.set_val(
     "enable_experimental_unrecoverable_data_corrupting_features",
     "rocksdb, memdb");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   ::testing::InitGoogleTest(&argc, argv);
   return RUN_ALL_TESTS();
index 2c41d8af53c7eaffe70f4fad102f34714bd38b78..294679dfa30ddf72e3a6279678cfac829014bd8e 100644 (file)
@@ -199,9 +199,9 @@ int main(int argc, const char *argv[])
   common_init_finish(g_ceph_context);
 
   // create object store
-  dout(0) << "objectstore " << g_conf->osd_objectstore << dendl;
-  dout(0) << "data " << g_conf->osd_data << dendl;
-  dout(0) << "journal " << g_conf->osd_journal << dendl;
+  dout(0) << "objectstore " << g_conf()->osd_objectstore << dendl;
+  dout(0) << "data " << g_conf()->osd_data << dendl;
+  dout(0) << "journal " << g_conf()->osd_journal << dendl;
   dout(0) << "size " << cfg.size << dendl;
   dout(0) << "block-size " << cfg.block_size << dendl;
   dout(0) << "repeats " << cfg.repeats << dendl;
@@ -209,15 +209,15 @@ int main(int argc, const char *argv[])
 
   auto os = std::unique_ptr<ObjectStore>(
       ObjectStore::create(g_ceph_context,
-                          g_conf->osd_objectstore,
-                          g_conf->osd_data,
-                          g_conf->osd_journal));
+                          g_conf()->osd_objectstore,
+                          g_conf()->osd_data,
+                          g_conf()->osd_journal));
 
   //Checking data folder: create if needed or error if it's not empty
-  DIR *dir = ::opendir(g_conf->osd_data.c_str());
+  DIR *dir = ::opendir(g_conf()->osd_data.c_str());
   if (!dir) {
     std::string cmd("mkdir -p ");
-    cmd+=g_conf->osd_data;
+    cmd+=g_conf()->osd_data;
     int r = ::system( cmd.c_str() );
     if( r<0 ){
       derr << "Failed to create data directory, ret = " << r << dendl;
@@ -227,14 +227,14 @@ int main(int argc, const char *argv[])
   else {
      bool non_empty = readdir(dir) != NULL && readdir(dir) != NULL && readdir(dir) != NULL;
      if( non_empty ){
-       derr << "Data directory '"<<g_conf->osd_data<<"' isn't empty, please clean it first."<< dendl;
+       derr << "Data directory '"<<g_conf()->osd_data<<"' isn't empty, please clean it first."<< dendl;
        return 1;
      }
   }
   ::closedir(dir);
 
   //Create folders for journal if needed
-  string journal_base = g_conf->osd_journal.substr(0, g_conf->osd_journal.rfind('/'));
+  string journal_base = g_conf()->osd_journal.substr(0, g_conf()->osd_journal.rfind('/'));
   struct stat sb;
   if (stat(journal_base.c_str(), &sb) != 0 ){
     std::string cmd("mkdir -p ");
@@ -247,7 +247,7 @@ int main(int argc, const char *argv[])
   }
 
   if (!os) {
-    derr << "bad objectstore type " << g_conf->osd_objectstore << dendl;
+    derr << "bad objectstore type " << g_conf()->osd_objectstore << dendl;
     return 1;
   }
   if (os->mkfs() < 0) {
index 45fed3458ac16fd0e5caea3cf59d1528db323a03..7e9c2bcddd1052ff46f4122a0c2d63f57d5c34ae 100644 (file)
@@ -19,9 +19,9 @@ int main(int argc, char **argv) {
                         CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
   common_init_finish(g_ceph_context);
   // make sure we have 3 copies, or some tests won't work
-  g_ceph_context->_conf->set_val("osd_pool_default_size", "3");
+  g_ceph_context->_conf.set_val("osd_pool_default_size", "3");
   // our map is flat, so just try and split across OSDs, not hosts or whatever
-  g_ceph_context->_conf->set_val("osd_crush_chooseleaf_type", "0");
+  g_ceph_context->_conf.set_val("osd_crush_chooseleaf_type", "0");
   ::testing::InitGoogleTest(&argc, argv);
   return RUN_ALL_TESTS();
 }
index b1f22b7716e5bef3277921fdba62cca7dc1b4321..34a3b8d81afae65437a4d2048f644b393fcc53a1 100644 (file)
@@ -53,88 +53,88 @@ public:
 
 TEST(TestOSDScrub, scrub_time_permit) {
   ObjectStore *store = ObjectStore::create(g_ceph_context,
-             g_conf->osd_objectstore,
-             g_conf->osd_data,
-             g_conf->osd_journal);
-  std::string cluster_msgr_type = g_conf->ms_cluster_type.empty() ? g_conf->get_val<std::string>("ms_type") : g_conf->ms_cluster_type;
+             g_conf()->osd_objectstore,
+             g_conf()->osd_data,
+             g_conf()->osd_journal);
+  std::string cluster_msgr_type = g_conf()->ms_cluster_type.empty() ? g_conf().get_val<std::string>("ms_type") : g_conf()->ms_cluster_type;
   Messenger *ms = Messenger::create(g_ceph_context, cluster_msgr_type,
                                    entity_name_t::OSD(0), "make_checker",
                                    getpid(), 0);
   ms->set_cluster_protocol(CEPH_OSD_PROTOCOL);
   ms->set_default_policy(Messenger::Policy::stateless_server(0));
-  ms->bind(g_conf->public_addr);
+  ms->bind(g_conf()->public_addr);
   MonClient mc(g_ceph_context);
   mc.build_initial_monmap();
   TestOSDScrub* osd = new TestOSDScrub(g_ceph_context, store, 0, ms, ms, ms, ms, ms, ms, ms, &mc, "", "");
 
-  g_ceph_context->_conf->set_val("osd_scrub_begin_hour", "0");
-  g_ceph_context->_conf->set_val("osd_scrub_end_hour", "24");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("osd_scrub_begin_hour", "0");
+  g_ceph_context->_conf.set_val("osd_scrub_end_hour", "24");
+  g_ceph_context->_conf.apply_changes(nullptr);
   tm tm;
   strptime("2015-01-16 12:05:13", "%Y-%m-%d %H:%M:%S", &tm);
   utime_t now = utime_t(mktime(&tm), 0);
   bool ret = osd->scrub_time_permit(now);
   ASSERT_TRUE(ret);
 
-  g_ceph_context->_conf->set_val("osd_scrub_begin_hour", "24");
-  g_ceph_context->_conf->set_val("osd_scrub_end_hour", "0");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("osd_scrub_begin_hour", "24");
+  g_ceph_context->_conf.set_val("osd_scrub_end_hour", "0");
+  g_ceph_context->_conf.apply_changes(nullptr);
   strptime("2015-01-16 12:05:13", "%Y-%m-%d %H:%M:%S", &tm);
   now = utime_t(mktime(&tm), 0);
   ret = osd->scrub_time_permit(now);
   ASSERT_FALSE(ret);
 
-  g_ceph_context->_conf->set_val("osd_scrub_begin_hour", "0");
-  g_ceph_context->_conf->set_val("osd_scrub_end_hour", "0");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("osd_scrub_begin_hour", "0");
+  g_ceph_context->_conf.set_val("osd_scrub_end_hour", "0");
+  g_ceph_context->_conf.apply_changes(nullptr);
   strptime("2015-01-16 12:05:13", "%Y-%m-%d %H:%M:%S", &tm);
   now = utime_t(mktime(&tm), 0);
   ret = osd->scrub_time_permit(now);
   ASSERT_TRUE(ret);
 
-  g_ceph_context->_conf->set_val("osd_scrub_begin_hour", "20");
-  g_ceph_context->_conf->set_val("osd_scrub_end_hour", "07");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("osd_scrub_begin_hour", "20");
+  g_ceph_context->_conf.set_val("osd_scrub_end_hour", "07");
+  g_ceph_context->_conf.apply_changes(nullptr);
   strptime("2015-01-16 01:05:13", "%Y-%m-%d %H:%M:%S", &tm);
   now = utime_t(mktime(&tm), 0);
   ret = osd->scrub_time_permit(now);
   ASSERT_TRUE(ret);
 
-  g_ceph_context->_conf->set_val("osd_scrub_begin_hour", "20");
-  g_ceph_context->_conf->set_val("osd_scrub_end_hour", "07");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("osd_scrub_begin_hour", "20");
+  g_ceph_context->_conf.set_val("osd_scrub_end_hour", "07");
+  g_ceph_context->_conf.apply_changes(nullptr);
   strptime("2015-01-16 20:05:13", "%Y-%m-%d %H:%M:%S", &tm);
   now = utime_t(mktime(&tm), 0);
   ret = osd->scrub_time_permit(now);
   ASSERT_TRUE(ret);
 
-  g_ceph_context->_conf->set_val("osd_scrub_begin_hour", "20");
-  g_ceph_context->_conf->set_val("osd_scrub_end_hour", "07");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("osd_scrub_begin_hour", "20");
+  g_ceph_context->_conf.set_val("osd_scrub_end_hour", "07");
+  g_ceph_context->_conf.apply_changes(nullptr);
   strptime("2015-01-16 08:05:13", "%Y-%m-%d %H:%M:%S", &tm);
   now = utime_t(mktime(&tm), 0);
   ret = osd->scrub_time_permit(now);
   ASSERT_FALSE(ret);
 
-  g_ceph_context->_conf->set_val("osd_scrub_begin_hour", "01");
-  g_ceph_context->_conf->set_val("osd_scrub_end_hour", "07");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("osd_scrub_begin_hour", "01");
+  g_ceph_context->_conf.set_val("osd_scrub_end_hour", "07");
+  g_ceph_context->_conf.apply_changes(nullptr);
   strptime("2015-01-16 20:05:13", "%Y-%m-%d %H:%M:%S", &tm);
   now = utime_t(mktime(&tm), 0);
   ret = osd->scrub_time_permit(now);
   ASSERT_FALSE(ret);
 
-  g_ceph_context->_conf->set_val("osd_scrub_begin_hour", "01");
-  g_ceph_context->_conf->set_val("osd_scrub_end_hour", "07");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("osd_scrub_begin_hour", "01");
+  g_ceph_context->_conf.set_val("osd_scrub_end_hour", "07");
+  g_ceph_context->_conf.apply_changes(nullptr);
   strptime("2015-01-16 00:05:13", "%Y-%m-%d %H:%M:%S", &tm);
   now = utime_t(mktime(&tm), 0);
   ret = osd->scrub_time_permit(now);
   ASSERT_FALSE(ret);
 
-  g_ceph_context->_conf->set_val("osd_scrub_begin_hour", "01");
-  g_ceph_context->_conf->set_val("osd_scrub_end_hour", "07");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("osd_scrub_begin_hour", "01");
+  g_ceph_context->_conf.set_val("osd_scrub_end_hour", "07");
+  g_ceph_context->_conf.apply_changes(nullptr);
   strptime("2015-01-16 04:05:13", "%Y-%m-%d %H:%M:%S", &tm);
   now = utime_t(mktime(&tm), 0);
   ret = osd->scrub_time_permit(now);
index dfe457c69804b28b4f0929eb8858b2343ddf8df8..b923dda8f788524e7fc2aa152ff2320e0e1e4750 100644 (file)
@@ -2691,9 +2691,9 @@ struct PGLogTrimTest :
     snprintf(max_entries_s, size, "%u", max_entries);
     snprintf(dup_track_s, size, "%u", dup_track);
 
-    cct->_conf->set_val_or_die("osd_min_pg_log_entries", min_entries_s);
-    cct->_conf->set_val_or_die("osd_max_pg_log_entries", max_entries_s);
-    cct->_conf->set_val_or_die("osd_pg_log_dups_tracked", dup_track_s);
+    cct->_conf.set_val_or_die("osd_min_pg_log_entries", min_entries_s);
+    cct->_conf.set_val_or_die("osd_max_pg_log_entries", max_entries_s);
+    cct->_conf.set_val_or_die("osd_pg_log_dups_tracked", dup_track_s);
   }
 }; // struct PGLogTrimTest
 
index 4e7971153f245dceb5f93f99add87c0ce3860417..214d62599f6e836524849b9f2d8ec39c41cf3a5f 100644 (file)
@@ -60,11 +60,11 @@ int stress_test(uint64_t num_ops, uint64_t num_objs,
   FakeWriteback writeback(g_ceph_context, &lock, delay_ns);
 
   ObjectCacher obc(g_ceph_context, "test", writeback, lock, NULL, NULL,
-                  g_conf->client_oc_size,
-                  g_conf->client_oc_max_objects,
-                  g_conf->client_oc_max_dirty,
-                  g_conf->client_oc_target_dirty,
-                  g_conf->client_oc_max_dirty_age,
+                  g_conf()->client_oc_size,
+                  g_conf()->client_oc_max_objects,
+                  g_conf()->client_oc_max_dirty,
+                  g_conf()->client_oc_target_dirty,
+                  g_conf()->client_oc_max_dirty_age,
                   true);
   obc.start();
 
@@ -186,7 +186,7 @@ int correctness_test(uint64_t delay_ns)
                   1, // max objects, just one
                   1<<18, // max dirty, 256KB
                   1<<17, // target dirty, 128KB
-                  g_conf->client_oc_max_dirty_age,
+                  g_conf()->client_oc_max_dirty_age,
                   true);
   obc.start();
   std::cerr << "just start()ed ObjectCacher" << std::endl;
index e6a705bb68365efccf95b2ec207c134f8f486868..50ef3c7a615a0629d5b71497071e02b8c8ff514f 100644 (file)
@@ -205,7 +205,7 @@ public:
       .WillOnce(DoAll(WithArg<1>(Invoke([this](Context *ctx) {
                 // disable rebalance so as to not reschedule it again
                 CephContext *cct = reinterpret_cast<CephContext *>(m_local_io_ctx.cct());
-                cct->_conf->set_val("rbd_mirror_image_policy_rebalance_timeout", "0");
+                cct->_conf.set_val("rbd_mirror_image_policy_rebalance_timeout", "0");
 
                 auto wrapped_ctx = new FunctionContext([this, ctx](int r) {
                     Mutex::Locker timer_locker(m_threads->timer_lock);
@@ -1563,7 +1563,7 @@ TEST_F(TestMockImageMap, RebalanceImageMap) {
 
   // set rebalance interval
   CephContext *cct = reinterpret_cast<CephContext *>(m_local_io_ctx.cct());
-  cct->_conf->set_val("rbd_mirror_image_policy_rebalance_timeout", "5");
+  cct->_conf.set_val("rbd_mirror_image_policy_rebalance_timeout", "5");
   remote_peer_ack_nowait(mock_image_map.get(), new_global_image_ids_ack, 0,
                          &peer_ack_ctxs);
 
index 0ece2c080aa9e16b28adc123490e4b1e92fa5be1..c2d497fabc69bf24b3f185e1bf33ecd6bed8551e 100644 (file)
@@ -626,7 +626,7 @@ TEST_F(TestMockLeaderWatcher, Break) {
   EXPECT_EQ(0, _rados->conf_set("rbd_mirror_leader_max_missed_heartbeats",
                                 "1"));
   CephContext *cct = reinterpret_cast<CephContext *>(m_local_io_ctx.cct());
-  int max_acquire_attempts = cct->_conf->get_val<int64_t>(
+  int max_acquire_attempts = cct->_conf.get_val<int64_t>(
     "rbd_mirror_leader_max_acquire_attempts_before_break");
 
   MockManagedLock mock_managed_lock;
index 164e9bbcde730e7deb24d5c5200b4684cfc2d2ef..bd058c33fe6c38c4e676b8deb20744a3aa040567 100644 (file)
@@ -594,7 +594,7 @@ TEST_F(IPPolicyTest, IPEnvironment) {
   ASSERT_NE(ip, iam_env.end());
   EXPECT_EQ(ip->second, "192.168.1.1");
 
-  ASSERT_EQ(cct.get()->_conf->set_val("rgw_remote_addr_param", "SOME_VAR"), 0);
+  ASSERT_EQ(cct.get()->_conf.set_val("rgw_remote_addr_param", "SOME_VAR"), 0);
   EXPECT_EQ(cct.get()->_conf->rgw_remote_addr_param, "SOME_VAR");
   iam_env = rgw_build_iam_environment(&rgw_rados, &rgw_req_state);
   ip = iam_env.find("aws:SourceIp");
@@ -606,7 +606,7 @@ TEST_F(IPPolicyTest, IPEnvironment) {
   ASSERT_NE(ip, iam_env.end());
   EXPECT_EQ(ip->second, "192.168.1.2");
 
-  ASSERT_EQ(cct.get()->_conf->set_val("rgw_remote_addr_param", "HTTP_X_FORWARDED_FOR"), 0);
+  ASSERT_EQ(cct.get()->_conf.set_val("rgw_remote_addr_param", "HTTP_X_FORWARDED_FOR"), 0);
   rgw_env.set("HTTP_X_FORWARDED_FOR", "192.168.1.3");
   iam_env = rgw_build_iam_environment(&rgw_rados, &rgw_req_state);
   ip = iam_env.find("aws:SourceIp");
index c48f9bec619eeb76865ba8a1f065997408e510f0..5883be764563ae36160e194edb3ddff202597e38 100644 (file)
@@ -77,8 +77,8 @@ int main(int argc, char **argv) {
 
   char mb[10];
   sprintf(mb, "%u", size_mb);
-  g_ceph_context->_conf->set_val("osd_journal_size", mb);
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("osd_journal_size", mb);
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   finisher = new Finisher(g_ceph_context);
   
@@ -114,9 +114,9 @@ int main(int argc, char **argv) {
 }
 
 TEST(TestFileJournal, Create) {
-  g_ceph_context->_conf->set_val("journal_ignore_corruption", "false");
-  g_ceph_context->_conf->set_val("journal_write_header_frequency", "0");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("journal_ignore_corruption", "false");
+  g_ceph_context->_conf.set_val("journal_write_header_frequency", "0");
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   for (unsigned i = 0 ; i < 3; ++i) {
     SCOPED_TRACE(subtests[i].description);
@@ -128,9 +128,9 @@ TEST(TestFileJournal, Create) {
 }
 
 TEST(TestFileJournal, WriteSmall) {
-  g_ceph_context->_conf->set_val("journal_ignore_corruption", "false");
-  g_ceph_context->_conf->set_val("journal_write_header_frequency", "0");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("journal_ignore_corruption", "false");
+  g_ceph_context->_conf.set_val("journal_write_header_frequency", "0");
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   for (unsigned i = 0 ; i < 3; ++i) {
     SCOPED_TRACE(subtests[i].description);
@@ -153,9 +153,9 @@ TEST(TestFileJournal, WriteSmall) {
 }
 
 TEST(TestFileJournal, WriteBig) {
-  g_ceph_context->_conf->set_val("journal_ignore_corruption", "false");
-  g_ceph_context->_conf->set_val("journal_write_header_frequency", "0");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("journal_ignore_corruption", "false");
+  g_ceph_context->_conf.set_val("journal_write_header_frequency", "0");
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   for (unsigned i = 0 ; i < 3; ++i) {
     SCOPED_TRACE(subtests[i].description);
@@ -181,9 +181,9 @@ TEST(TestFileJournal, WriteBig) {
 }
 
 TEST(TestFileJournal, WriteMany) {
-  g_ceph_context->_conf->set_val("journal_ignore_corruption", "false");
-  g_ceph_context->_conf->set_val("journal_write_header_frequency", "0");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("journal_ignore_corruption", "false");
+  g_ceph_context->_conf.set_val("journal_write_header_frequency", "0");
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   for (unsigned i = 0 ; i < 3; ++i) {
     SCOPED_TRACE(subtests[i].description);
@@ -214,9 +214,9 @@ TEST(TestFileJournal, WriteMany) {
 }
 
 TEST(TestFileJournal, WriteManyVecs) {
-  g_ceph_context->_conf->set_val("journal_ignore_corruption", "false");
-  g_ceph_context->_conf->set_val("journal_write_header_frequency", "0");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("journal_ignore_corruption", "false");
+  g_ceph_context->_conf.set_val("journal_write_header_frequency", "0");
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   for (unsigned i = 0 ; i < 3; ++i) {
     SCOPED_TRACE(subtests[i].description);
@@ -264,9 +264,9 @@ TEST(TestFileJournal, WriteManyVecs) {
 }
 
 TEST(TestFileJournal, ReplaySmall) {
-  g_ceph_context->_conf->set_val("journal_ignore_corruption", "false");
-  g_ceph_context->_conf->set_val("journal_write_header_frequency", "0");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("journal_ignore_corruption", "false");
+  g_ceph_context->_conf.set_val("journal_write_header_frequency", "0");
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   vector<ObjectStore::Transaction> tls;
 
@@ -325,9 +325,9 @@ TEST(TestFileJournal, ReplaySmall) {
 }
 
 TEST(TestFileJournal, ReplayCorrupt) {
-  g_ceph_context->_conf->set_val("journal_ignore_corruption", "true");
-  g_ceph_context->_conf->set_val("journal_write_header_frequency", "0");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("journal_ignore_corruption", "true");
+  g_ceph_context->_conf.set_val("journal_write_header_frequency", "0");
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   vector<ObjectStore::Transaction> tls;
   for (unsigned i = 0 ; i < 3; ++i) {
@@ -411,9 +411,9 @@ TEST(TestFileJournal, ReplayCorrupt) {
 }
 
 TEST(TestFileJournal, WriteTrim) {
-  g_ceph_context->_conf->set_val("journal_ignore_corruption", "false");
-  g_ceph_context->_conf->set_val("journal_write_header_frequency", "0");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("journal_ignore_corruption", "false");
+  g_ceph_context->_conf.set_val("journal_write_header_frequency", "0");
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   for (unsigned i = 0 ; i < 3; ++i) {
     SCOPED_TRACE(subtests[i].description);
@@ -462,9 +462,9 @@ TEST(TestFileJournal, WriteTrim) {
 }
 
 TEST(TestFileJournal, WriteTrimSmall) {
-  g_ceph_context->_conf->set_val("journal_ignore_corruption", "false");
-  g_ceph_context->_conf->set_val("journal_write_header_frequency", "0");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("journal_ignore_corruption", "false");
+  g_ceph_context->_conf.set_val("journal_write_header_frequency", "0");
+  g_ceph_context->_conf.apply_changes(nullptr);
   vector<ObjectStore::Transaction> tls;
 
   for (unsigned i = 0 ; i < 3; ++i) {
@@ -512,9 +512,9 @@ TEST(TestFileJournal, WriteTrimSmall) {
 }
 
 TEST(TestFileJournal, ReplayDetectCorruptFooterMagic) {
-  g_ceph_context->_conf->set_val("journal_ignore_corruption", "true");
-  g_ceph_context->_conf->set_val("journal_write_header_frequency", "1");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("journal_ignore_corruption", "true");
+  g_ceph_context->_conf.set_val("journal_write_header_frequency", "1");
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   vector<ObjectStore::Transaction> tls;
   for (unsigned i = 0 ; i < 3; ++i) {
@@ -571,9 +571,9 @@ TEST(TestFileJournal, ReplayDetectCorruptFooterMagic) {
 }
 
 TEST(TestFileJournal, ReplayDetectCorruptPayload) {
-  g_ceph_context->_conf->set_val("journal_ignore_corruption", "true");
-  g_ceph_context->_conf->set_val("journal_write_header_frequency", "1");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("journal_ignore_corruption", "true");
+  g_ceph_context->_conf.set_val("journal_write_header_frequency", "1");
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   vector<ObjectStore::Transaction> tls;
   for (unsigned i = 0 ; i < 3; ++i) {
@@ -630,9 +630,9 @@ TEST(TestFileJournal, ReplayDetectCorruptPayload) {
 }
 
 TEST(TestFileJournal, ReplayDetectCorruptHeader) {
-  g_ceph_context->_conf->set_val("journal_ignore_corruption", "true");
-  g_ceph_context->_conf->set_val("journal_write_header_frequency", "1");
-  g_ceph_context->_conf->apply_changes(NULL);
+  g_ceph_context->_conf.set_val("journal_ignore_corruption", "true");
+  g_ceph_context->_conf.set_val("journal_write_header_frequency", "1");
+  g_ceph_context->_conf.apply_changes(nullptr);
 
   vector<ObjectStore::Transaction> tls;
   for (unsigned i = 0 ; i < 3; ++i) {
index 36ff97387046128f4e0f28f3915f5d571cf18864..ffd7b7911350af068c4efcf6a1e6d3dc277e0440 100644 (file)
@@ -633,14 +633,14 @@ TEST(pick_address, filtering)
   ipv6(&a_three, "2001:1234:5678:90ab::cdef");
 
   CephContext *cct = new CephContext(CEPH_ENTITY_TYPE_MON);
-  cct->_conf->_clear_safe_to_start_threads();  // so we can set configs
+  cct->_conf._clear_safe_to_start_threads();  // so we can set configs
 
-  cct->_conf->set_val("public_addr", "");
-  cct->_conf->set_val("public_network", "");
-  cct->_conf->set_val("public_network_interface", "");
-  cct->_conf->set_val("cluster_addr", "");
-  cct->_conf->set_val("cluster_network", "");
-  cct->_conf->set_val("cluster_network_interface", "");
+  cct->_conf.set_val("public_addr", "");
+  cct->_conf.set_val("public_network", "");
+  cct->_conf.set_val("public_network_interface", "");
+  cct->_conf.set_val("cluster_addr", "");
+  cct->_conf.set_val("cluster_network", "");
+  cct->_conf.set_val("cluster_network_interface", "");
 
   entity_addrvec_t av;
   {
@@ -666,7 +666,7 @@ TEST(pick_address, filtering)
     ASSERT_EQ(string("[::]:0/0"), stringify(av.v[0]));
   }
   {
-    cct->_conf->set_val("public_network", "10.2.0.0/16");
+    cct->_conf.set_val("public_network", "10.2.0.0/16");
     int r = pick_addresses(cct,
                           CEPH_PICK_ADDRESS_PUBLIC |
                           CEPH_PICK_ADDRESS_IPV4 |
@@ -676,11 +676,11 @@ TEST(pick_address, filtering)
     ASSERT_EQ(0, r);
     ASSERT_EQ(1, av.v.size());
     ASSERT_EQ(string("10.2.1.123:0/0"), stringify(av.v[0]));
-    cct->_conf->set_val("public_network", "");
+    cct->_conf.set_val("public_network", "");
   }
   {
-    cct->_conf->set_val("public_network", "10.0.0.0/8");
-    cct->_conf->set_val("public_network_interface", "eth1");
+    cct->_conf.set_val("public_network", "10.0.0.0/8");
+    cct->_conf.set_val("public_network_interface", "eth1");
     int r = pick_addresses(cct,
                           CEPH_PICK_ADDRESS_PUBLIC |
                           CEPH_PICK_ADDRESS_IPV4 |
@@ -690,12 +690,12 @@ TEST(pick_address, filtering)
     ASSERT_EQ(0, r);
     ASSERT_EQ(1, av.v.size());
     ASSERT_EQ(string("10.2.1.123:0/0"), stringify(av.v[0]));
-    cct->_conf->set_val("public_network", "");
-    cct->_conf->set_val("public_network_interface", "");
+    cct->_conf.set_val("public_network", "");
+    cct->_conf.set_val("public_network_interface", "");
   }
   {
-    cct->_conf->set_val("public_network", "10.2.0.0/16");
-    cct->_conf->set_val("cluster_network", "10.1.0.0/16");
+    cct->_conf.set_val("public_network", "10.2.0.0/16");
+    cct->_conf.set_val("cluster_network", "10.1.0.0/16");
     int r = pick_addresses(cct,
                           CEPH_PICK_ADDRESS_PUBLIC |
                           CEPH_PICK_ADDRESS_IPV4 |
@@ -705,12 +705,12 @@ TEST(pick_address, filtering)
     ASSERT_EQ(0, r);
     ASSERT_EQ(1, av.v.size());
     ASSERT_EQ(string("10.2.1.123:0/0"), stringify(av.v[0]));
-    cct->_conf->set_val("public_network", "");
-    cct->_conf->set_val("cluster_network", "");
+    cct->_conf.set_val("public_network", "");
+    cct->_conf.set_val("cluster_network", "");
   }
   {
-    cct->_conf->set_val("public_network", "10.2.0.0/16");
-    cct->_conf->set_val("cluster_network", "10.1.0.0/16");
+    cct->_conf.set_val("public_network", "10.2.0.0/16");
+    cct->_conf.set_val("cluster_network", "10.1.0.0/16");
     int r = pick_addresses(cct,
                           CEPH_PICK_ADDRESS_CLUSTER |
                           CEPH_PICK_ADDRESS_IPV4 |
@@ -720,12 +720,12 @@ TEST(pick_address, filtering)
     ASSERT_EQ(0, r);
     ASSERT_EQ(1, av.v.size());
     ASSERT_EQ(string("10.1.1.2:0/0"), stringify(av.v[0]));
-    cct->_conf->set_val("public_network", "");
-    cct->_conf->set_val("cluster_network", "");
+    cct->_conf.set_val("public_network", "");
+    cct->_conf.set_val("cluster_network", "");
   }
 
   {
-    cct->_conf->set_val("public_network", "2001::/16");
+    cct->_conf.set_val("public_network", "2001::/16");
     int r = pick_addresses(cct,
                           CEPH_PICK_ADDRESS_PUBLIC |
                           CEPH_PICK_ADDRESS_IPV6 |
@@ -735,11 +735,11 @@ TEST(pick_address, filtering)
     ASSERT_EQ(0, r);
     ASSERT_EQ(1, av.v.size());
     ASSERT_EQ(string("[2001:1234:5678:90ab::cdef]:0/0"), stringify(av.v[0]));
-    cct->_conf->set_val("public_network", "");
+    cct->_conf.set_val("public_network", "");
   }
   {
-    cct->_conf->set_val("public_network", "2001::/16 10.0.0.0/8");
-    cct->_conf->set_val("public_network_interface", "eth1");
+    cct->_conf.set_val("public_network", "2001::/16 10.0.0.0/8");
+    cct->_conf.set_val("public_network_interface", "eth1");
     int r = pick_addresses(cct,
                           CEPH_PICK_ADDRESS_PUBLIC |
                           CEPH_PICK_ADDRESS_IPV4 |
@@ -751,12 +751,12 @@ TEST(pick_address, filtering)
     ASSERT_EQ(2, av.v.size());
     ASSERT_EQ(string("[2001:1234:5678:90ab::cdef]:0/0"), stringify(av.v[0]));
     ASSERT_EQ(string("10.2.1.123:0/0"), stringify(av.v[1]));
-    cct->_conf->set_val("public_network", "");
-    cct->_conf->set_val("public_network_interface", "");
+    cct->_conf.set_val("public_network", "");
+    cct->_conf.set_val("public_network_interface", "");
   }
   {
-    cct->_conf->set_val("public_network", "2001::/16 10.0.0.0/8");
-    cct->_conf->set_val("public_network_interface", "eth1");
+    cct->_conf.set_val("public_network", "2001::/16 10.0.0.0/8");
+    cct->_conf.set_val("public_network_interface", "eth1");
     int r = pick_addresses(cct,
                           CEPH_PICK_ADDRESS_PUBLIC |
                           CEPH_PICK_ADDRESS_IPV4 |
@@ -769,12 +769,12 @@ TEST(pick_address, filtering)
     ASSERT_EQ(2, av.v.size());
     ASSERT_EQ(string("10.2.1.123:0/0"), stringify(av.v[0]));
     ASSERT_EQ(string("[2001:1234:5678:90ab::cdef]:0/0"), stringify(av.v[1]));
-    cct->_conf->set_val("public_network", "");
-    cct->_conf->set_val("public_network_interface", "");
+    cct->_conf.set_val("public_network", "");
+    cct->_conf.set_val("public_network_interface", "");
   }
 
   {
-    cct->_conf->set_val("public_network", "2001::/16");
+    cct->_conf.set_val("public_network", "2001::/16");
     int r = pick_addresses(cct,
                           CEPH_PICK_ADDRESS_PUBLIC |
                           CEPH_PICK_ADDRESS_IPV6 |
@@ -786,7 +786,7 @@ TEST(pick_address, filtering)
     ASSERT_EQ(2, av.v.size());
     ASSERT_EQ(string("msgr2:[2001:1234:5678:90ab::cdef]:0/0"), stringify(av.v[0]));
     ASSERT_EQ(string("[2001:1234:5678:90ab::cdef]:0/0"), stringify(av.v[1]));
-    cct->_conf->set_val("public_network", "");
+    cct->_conf.set_val("public_network", "");
   }
 
   {
index f43e267bd6053089cdc5660d9991c73b0b8a3be8..0b3daeb05558c356ebd42105c9105877005637d6 100644 (file)
@@ -25,28 +25,28 @@ TEST(WorkQueue, Resize)
   sleep(1);
   ASSERT_EQ(2, tp.get_num_threads());
 
-  g_conf->set_val("filestore op threads", "5");
-  g_conf->apply_changes(&cout);
+  g_conf().set_val("filestore op threads", "5");
+  g_conf().apply_changes(&cout);
   sleep(1);
   ASSERT_EQ(5, tp.get_num_threads());
 
-  g_conf->set_val("filestore op threads", "3");
-  g_conf->apply_changes(&cout);
+  g_conf().set_val("filestore op threads", "3");
+  g_conf().apply_changes(&cout);
   sleep(1);
   ASSERT_EQ(3, tp.get_num_threads());
 
-  g_conf->set_val("filestore op threads", "0");
-  g_conf->apply_changes(&cout);
+  g_conf().set_val("filestore op threads", "0");
+  g_conf().apply_changes(&cout);
   sleep(1);
   ASSERT_EQ(0, tp.get_num_threads());
 
-  g_conf->set_val("filestore op threads", "15");
-  g_conf->apply_changes(&cout);
+  g_conf().set_val("filestore op threads", "15");
+  g_conf().apply_changes(&cout);
   sleep(1);
   ASSERT_EQ(15, tp.get_num_threads());
 
-  g_conf->set_val("filestore op threads", "-1");
-  g_conf->apply_changes(&cout);
+  g_conf().set_val("filestore op threads", "-1");
+  g_conf().apply_changes(&cout);
   sleep(1);
   ASSERT_EQ(15, tp.get_num_threads());
 
index 4765757c8e719526b45f848911cf1e272bf04c41..99640e52a83643c531dde34cba45ce282df4d617 100644 (file)
@@ -90,9 +90,9 @@ int main(int argc, const char **argv, const char *envp[]) {
   ostringstream ss;
   ss << mc.monmap.get_addr(whoami);
   std::string sss(ss.str());
-  g_ceph_context->_conf->set_val("public_addr", sss.c_str());
-  g_ceph_context->_conf->apply_changes(NULL);
-  std::string public_msgr_type = g_conf->ms_public_type.empty() ? g_conf->get_val<std::string>("ms_type") : g_conf->ms_public_type;
+  g_ceph_context->_conf.set_val("public_addr", sss.c_str());
+  g_ceph_context->_conf.apply_changes(nullptr);
+  std::string public_msgr_type = g_conf()->ms_public_type.empty() ? g_conf().get_val<std::string>("ms_type") : g_conf()->ms_public_type;
   Messenger *rank = Messenger::create(g_ceph_context,
                                      public_msgr_type,
                                      entity_name_t::MON(whoami), "tester",
index 3b5edc253d167c45c3f5190f6c4d2d9284d9e532..f100b1e5017a453b069e910d73d8319479edae1c 100644 (file)
@@ -603,7 +603,7 @@ static int update_mgrmap(MonitorDBStore& st)
     // mgr expects epoch > 1
     map.epoch++;
     auto initial_modules =
-      get_str_vec(g_ceph_context->_conf->get_val<string>("mgr_initial_modules"));
+      get_str_vec(g_ceph_context->_conf.get_val<string>("mgr_initial_modules"));
     copy(begin(initial_modules),
         end(initial_modules),
         inserter(map.modules, end(map.modules)));
@@ -840,8 +840,7 @@ int main(int argc, char **argv) {
     CODE_ENVIRONMENT_UTILITY,
     CINIT_FLAG_NO_MON_CONFIG);
   common_init_finish(g_ceph_context);
-  g_ceph_context->_conf->apply_changes(NULL);
-  g_conf = g_ceph_context->_conf;
+  cct->_conf.apply_changes(nullptr);
 
   // this is where we'll write *whatever*, on a per-command basis.
   // not all commands require some place to write their things.
index be65987c6d587e038cf510cd948e81ec16d7990b..6f9fcbfc60158f6a3a3b94ebec6dabc20629237a 100644 (file)
@@ -3267,12 +3267,11 @@ int main(int argc, char **argv)
     CODE_ENVIRONMENT_UTILITY_NODOUT,
     0);
   common_init_finish(g_ceph_context);
-  g_conf = g_ceph_context->_conf;
   if (debug) {
-    g_conf->set_val_or_die("log_to_stderr", "true");
-    g_conf->set_val_or_die("err_to_stderr", "true");
+    g_conf().set_val_or_die("log_to_stderr", "true");
+    g_conf().set_val_or_die("err_to_stderr", "true");
   }
-  g_conf->apply_changes(NULL);
+  g_conf().apply_changes(nullptr);
 
   // Special list handling.  Treating pretty_format as human readable,
   // with one object per line and not an enclosing array.
@@ -3290,7 +3289,7 @@ int main(int argc, char **argv)
 
   // Special handling for filestore journal, so we can dump it without mounting
   if (op == "dump-journal" && type == "filestore") {
-    int ret = mydump_journal(formatter, jpath, g_conf->journal_dio);
+    int ret = mydump_journal(formatter, jpath, g_conf()->journal_dio);
     if (ret < 0) {
       cerr << "journal-path: " << jpath << ": "
           << cpp_strerror(ret) << std::endl;
index b377aa163aa100e467807fa5d312a7abfa4c0c8e..59746b5c855896d315c4cbac9bdc54f14b596c8a 100644 (file)
@@ -79,13 +79,12 @@ int main(int argc, char **argv) {
     NULL, ceph_options, CEPH_ENTITY_TYPE_OSD,
     CODE_ENVIRONMENT_UTILITY_NODOUT, 0);
   common_init_finish(g_ceph_context);
-  g_ceph_context->_conf->apply_changes(NULL);
-  g_conf = g_ceph_context->_conf;
+  cct->_conf.apply_changes(nullptr);
   if (debug) {
-    g_conf->set_val_or_die("log_to_stderr", "true");
-    g_conf->set_val_or_die("err_to_stderr", "true");
+    g_conf().set_val_or_die("log_to_stderr", "true");
+    g_conf().set_val_or_die("err_to_stderr", "true");
   }
-  g_conf->apply_changes(NULL);
+  g_conf().apply_changes(nullptr);
 
   if (vm.count("omap-path") == 0) {
     std::cerr << "Required argument --omap-path" << std::endl;
index 9b8b6d15bbe9ee65de7dc4359cd8c449482de954..3a4babd27dd58fbfcdfd1b39bdb5dd45ecc55dd0 100644 (file)
@@ -351,14 +351,14 @@ int MetadataDriver::inject_unlinked_inode(
   inode.inode.nlink = 1;
   inode.inode.truncate_size = -1ull;
   inode.inode.truncate_seq = 1;
-  inode.inode.uid = g_conf->mds_root_ino_uid;
-  inode.inode.gid = g_conf->mds_root_ino_gid;
+  inode.inode.uid = g_conf()->mds_root_ino_uid;
+  inode.inode.gid = g_conf()->mds_root_ino_gid;
 
   // Force layout to default: should we let users override this so that
   // they don't have to mount the filesystem to correct it?
   inode.inode.layout = file_layout_t::get_default();
   inode.inode.layout.pool_id = data_pool_id;
-  inode.inode.dir_layout.dl_dir_hash = g_conf->mds_default_dir_hash;
+  inode.inode.dir_layout.dl_dir_hash = g_conf()->mds_default_dir_hash;
 
   // Assume that we will get our stats wrong, and that we may
   // be ignoring dirfrags that exist
@@ -1644,12 +1644,12 @@ int MetadataDriver::inject_with_backtrace(
 
         ancestor_dentry.inode.dirstat.nfiles = 1;
         ancestor_dentry.inode.dir_layout.dl_dir_hash =
-                                               g_conf->mds_default_dir_hash;
+                                               g_conf()->mds_default_dir_hash;
 
         ancestor_dentry.inode.nlink = 1;
         ancestor_dentry.inode.ino = ino;
-        ancestor_dentry.inode.uid = g_conf->mds_root_ino_uid;
-        ancestor_dentry.inode.gid = g_conf->mds_root_ino_gid;
+        ancestor_dentry.inode.uid = g_conf()->mds_root_ino_uid;
+        ancestor_dentry.inode.gid = g_conf()->mds_root_ino_gid;
         ancestor_dentry.inode.version = 1;
         ancestor_dentry.inode.backtrace_version = 1;
         r = inject_linkage(parent_ino, dname, fragment, ancestor_dentry);
@@ -1974,8 +1974,8 @@ void MetadataTool::build_file_dentry(
   out->inode.ino = ino;
   out->inode.version = 1;
   out->inode.backtrace_version = 1;
-  out->inode.uid = g_conf->mds_root_ino_uid;
-  out->inode.gid = g_conf->mds_root_ino_gid;
+  out->inode.uid = g_conf()->mds_root_ino_uid;
+  out->inode.gid = g_conf()->mds_root_ino_gid;
 }
 
 void MetadataTool::build_dir_dentry(
@@ -1991,7 +1991,7 @@ void MetadataTool::build_dir_dentry(
   out->inode.ctime.tv.tv_sec = fragstat.mtime;
 
   out->inode.layout = layout;
-  out->inode.dir_layout.dl_dir_hash = g_conf->mds_default_dir_hash;
+  out->inode.dir_layout.dl_dir_hash = g_conf()->mds_default_dir_hash;
 
   out->inode.truncate_seq = 1;
   out->inode.truncate_size = -1ull;
@@ -2002,7 +2002,7 @@ void MetadataTool::build_dir_dentry(
   out->inode.ino = ino;
   out->inode.version = 1;
   out->inode.backtrace_version = 1;
-  out->inode.uid = g_conf->mds_root_ino_uid;
-  out->inode.gid = g_conf->mds_root_ino_gid;
+  out->inode.uid = g_conf()->mds_root_ino_uid;
+  out->inode.gid = g_conf()->mds_root_ino_gid;
 }
 
index a68c88441264b9ea57be28abea1fdc5f58b8729f..a2e36f0383251fea3f6098a2727347a0c3cff732 100644 (file)
@@ -152,7 +152,7 @@ int JournalScanner::scan_header()
 
 int JournalScanner::scan_events()
 {
-  uint64_t object_size = g_conf->mds_log_segment_size;
+  uint64_t object_size = g_conf()->mds_log_segment_size;
   if (object_size == 0) {
     // Default layout object size
     object_size = file_layout_t::get_default().object_size;
index 0bbb832ed594af48633ccf8e00266ec9fb76d85b..18f7a8183dd3782c8d2c813f9b273ff321cf8f2d 100644 (file)
@@ -1071,7 +1071,7 @@ int JournalTool::erase_region(JournalScanner const &js, uint64_t const pos, uint
 
   // Write log stream region to RADOS
   // FIXME: get object size somewhere common to scan_events
-  uint32_t object_size = g_conf->mds_log_segment_size;
+  uint32_t object_size = g_conf()->mds_log_segment_size;
   if (object_size == 0) {
     // Default layout object size
     object_size = file_layout_t::get_default().object_size;
index 80ce3c34934ebb91140cb2e969215986ad5ccc93..e9af80897b7949d2def8d1a22415f995d16bc91e 100644 (file)
@@ -49,7 +49,7 @@ MDSUtility::~MDSUtility()
 int MDSUtility::init()
 {
   // Initialize Messenger
-  int r = messenger->bind(g_conf->public_addr);
+  int r = messenger->bind(g_conf()->public_addr);
   if (r < 0)
     return r;
 
index 9573e6a6239e1b1f529ee40070078f6e2aa9c57c..b1d3658a05e9d25510af2e41ab04af1624e4c43f 100644 (file)
@@ -159,7 +159,7 @@ int Resetter::reset_hard()
 
   file_layout_t default_log_layout = MDCache::gen_default_log_layout(
       fsmap->get_filesystem(role.fscid)->mds_map);
-  journaler.create(&default_log_layout, g_conf->mds_journal_format);
+  journaler.create(&default_log_layout, g_conf()->mds_journal_format);
 
   C_SaferCond cond;
   {
index 60616c38e122ce836f8afe2d5682d5a9e1e57bef..ed768d37ee636a36ad768b1aa418b4154c4d67fd 100644 (file)
@@ -227,7 +227,7 @@ public:
     while(true) {
       std::map<std::string, bufferlist> values;
       int r = io->omap_get_vals(object_name, last_key,
-          g_conf->mds_sessionmap_keys_per_op, &values);
+          g_conf()->mds_sessionmap_keys_per_op, &values);
 
       if (r != 0) {
         derr << "error reading values: " << cpp_strerror(r) << dendl;
index ca87bfea0ef5025313aa63a7e3d95325ab8b6160..6b4ea3af67413f7269ee2825c439403d9c4b42e6 100644 (file)
@@ -5,7 +5,7 @@
 #include "tools/rbd/Shell.h"
 #include "tools/rbd/Utils.h"
 #include "include/rbd/features.h"
-#include "common/config.h"
+#include "common/config_proxy.h"
 #include "common/strtol.h"
 #include "common/Formatter.h"
 #include "global/global_context.h"
@@ -507,7 +507,7 @@ void validate(boost::any& v, const std::vector<std::string>& values,
 
   po::validators::check_first_occurrence(v);
   const std::string &s = po::validators::get_single_string(values);
-  g_conf->set_val_or_die("keyfile", s.c_str());
+  g_conf().set_val_or_die("keyfile", s.c_str());
   v = boost::any(s);
 }
 
index 6aedfb3467022ceb9a558f63a620c7aad9b7e713..e436a876ab6aff406593fb3a1b812c5ca5f70b91 100644 (file)
@@ -84,7 +84,7 @@ int read_string(int fd, unsigned max, std::string *out) {
 int extract_spec(const std::string &spec, std::string *pool_name,
                  std::string *namespace_name, std::string *name,
                  std::string *snap_name, SpecValidation spec_validation) {
-  if (!g_ceph_context->_conf->get_val<bool>("rbd_validate_names")) {
+  if (!g_ceph_context->_conf.get_val<bool>("rbd_validate_names")) {
     spec_validation = SPEC_VALIDATION_NONE;
   }
 
@@ -165,7 +165,7 @@ std::string get_positional_argument(const po::variables_map &vm, size_t index) {
 }
 
 std::string get_default_pool_name() {
-  return g_ceph_context->_conf->get_val<std::string>("rbd_default_pool");
+  return g_ceph_context->_conf.get_val<std::string>("rbd_default_pool");
 }
 
 std::string get_pool_name(const po::variables_map &vm, size_t *arg_index) {
@@ -538,14 +538,14 @@ int get_journal_options(const boost::program_options::variables_map &vm,
     }
     opts->set(RBD_IMAGE_OPTION_JOURNAL_ORDER, order);
 
-    int r = g_conf->set_val("rbd_journal_order", stringify(order));
+    int r = g_conf().set_val("rbd_journal_order", stringify(order));
     assert(r == 0);
   }
   if (vm.count(at::JOURNAL_SPLAY_WIDTH)) {
     opts->set(RBD_IMAGE_OPTION_JOURNAL_SPLAY_WIDTH,
              vm[at::JOURNAL_SPLAY_WIDTH].as<uint64_t>());
 
-    int r = g_conf->set_val("rbd_journal_splay_width",
+    int r = g_conf().set_val("rbd_journal_splay_width",
                            stringify(
                              vm[at::JOURNAL_SPLAY_WIDTH].as<uint64_t>()));
     assert(r == 0);
@@ -554,7 +554,7 @@ int get_journal_options(const boost::program_options::variables_map &vm,
     opts->set(RBD_IMAGE_OPTION_JOURNAL_POOL,
              vm[at::JOURNAL_POOL].as<std::string>());
 
-    int r = g_conf->set_val("rbd_journal_pool",
+    int r = g_conf().set_val("rbd_journal_pool",
                            vm[at::JOURNAL_POOL].as<std::string>());
     assert(r == 0);
   }
@@ -621,8 +621,8 @@ int get_formatter(const po::variables_map &vm,
 }
 
 void init_context() {
-  g_conf->set_val_or_die("rbd_cache_writethrough_until_flush", "false");
-  g_conf->apply_changes(NULL);
+  g_conf().set_val_or_die("rbd_cache_writethrough_until_flush", "false");
+  g_conf().apply_changes(nullptr);
   common_init_finish(g_ceph_context);
 }
 
@@ -670,7 +670,7 @@ int init_io_ctx(librados::Rados &rados, const std::string &pool_name,
 }
 
 void disable_cache() {
-  g_conf->set_val_or_die("rbd_cache", "false");
+  g_conf().set_val_or_die("rbd_cache", "false");
 }
 
 int open_image(librados::IoCtx &io_ctx, const std::string &image_name,
@@ -844,7 +844,7 @@ std::string timestr(time_t t) {
 }
 
 uint64_t get_rbd_default_features(CephContext* cct) {
-  auto features = cct->_conf->get_val<std::string>("rbd_default_features");
+  auto features = cct->_conf.get_val<std::string>("rbd_default_features");
   return boost::lexical_cast<uint64_t>(features);
 }
 
index daae502df9714d81b08e24a3108b873956de86f4..dd259f4ad405ed1ebbe49a5bba72315a36e6997e 100644 (file)
@@ -64,7 +64,7 @@ struct thick_provision_writer {
     assert(r >= 0);
     uint64_t order;
     if (info.order == 0) {
-      order = g_conf->get_val<int64_t>("rbd_default_order");
+      order = g_conf().get_val<int64_t>("rbd_default_order");
     } else {
       order = info.order;
     }
@@ -73,7 +73,7 @@ struct thick_provision_writer {
       chunk_size = image->get_stripe_unit();
     }
 
-    concurr = g_conf->get_val<int64_t>("rbd_concurrent_management_ops");
+    concurr = g_conf().get_val<int64_t>("rbd_concurrent_management_ops");
     io_status.in_flight = 0;
     io_status.io_error = 0;
   }
@@ -181,7 +181,7 @@ int thick_write(const std::string &image_name,librados::IoCtx &io_ctx,
   // To prevent writesame from discarding data, thick_write sets
   // the rbd_discard_on_zeroed_write_same option to false.
   assert(g_conf != nullptr);
-  r = g_conf->set_val("rbd_discard_on_zeroed_write_same", "false");
+  r = g_conf().set_val("rbd_discard_on_zeroed_write_same", "false");
   assert(r == 0);
   r = utils::open_image(io_ctx, image_name, false, &image);
   if (r < 0) {
index 53dfa9c6aafa5dfde2bbfda5b78f9a1a27259b27..8e9f80306c0027e56b559e6923211c6a22e3ecc0 100644 (file)
@@ -190,7 +190,7 @@ int do_export_diff_fd(librbd::Image& image, const char *fromsnapname,
     }
   }
   ExportDiffContext edc(&image, fd, info.size,
-                        g_conf->get_val<int64_t>("rbd_concurrent_management_ops"),
+                        g_conf().get_val<int64_t>("rbd_concurrent_management_ops"),
                         no_progress, export_format);
   r = image.diff_iterate2(fromsnapname, 0, info.size, true, whole_object,
                           &C_ExportDiff::export_diff_cb, (void *)&edc);
@@ -565,7 +565,7 @@ static int do_export(librbd::Image& image, const char *path, bool no_progress, i
     fd = STDOUT_FILENO;
     max_concurrent_ops = 1;
   } else {
-    max_concurrent_ops = g_conf->get_val<int64_t>("rbd_concurrent_management_ops");
+    max_concurrent_ops = g_conf().get_val<int64_t>("rbd_concurrent_management_ops");
     fd = open(path, O_WRONLY | O_CREAT | O_EXCL, 0644);
     if (fd < 0) {
       return -errno;
index 6b8a29459cad8c0f2865df50bad3a5da8b34427f..8f1f6078538d2ad808b4e7aa5966c1b186ab2c67 100644 (file)
@@ -37,7 +37,7 @@ struct ImportDiffContext {
   ImportDiffContext(librbd::Image *image, int fd, size_t size, bool no_progress)
     : image(image), fd(fd), size(size), pc("Importing image diff", no_progress),
       throttle((fd == STDIN_FILENO) ? 1 :
-                  g_conf->get_val<int64_t>("rbd_concurrent_management_ops"),
+                  g_conf().get_val<int64_t>("rbd_concurrent_management_ops"),
                false),
       last_offset(0) {
   }
@@ -744,7 +744,7 @@ static int do_import_v1(int fd, librbd::Image &image, uint64_t size,
     throttle.reset(new SimpleThrottle(1, false));
   } else {
     throttle.reset(new SimpleThrottle(
-      g_conf->get_val<int64_t>("rbd_concurrent_management_ops"), false));
+      g_conf().get_val<int64_t>("rbd_concurrent_management_ops"), false));
   }
 
   reqlen = min<uint64_t>(reqlen, size);
@@ -838,7 +838,7 @@ static int do_import(librados::Rados &rados, librbd::RBD &rbd,
 
   uint64_t order;
   if (opts.get(RBD_IMAGE_OPTION_ORDER, &order) != 0) {
-    order = g_conf->get_val<int64_t>("rbd_default_order");
+    order = g_conf().get_val<int64_t>("rbd_default_order");
   }
 
   // try to fill whole imgblklen blocks for sparsification
index 7e01cf1dac8324e47bc6e364ce71913e52a50192..ef2c8f30ff0860914454fc4d5849eb6c341de52a 100644 (file)
@@ -8,7 +8,7 @@
 #include "include/krbd.h"
 #include "include/stringify.h"
 #include "include/uuid.h"
-#include "common/config.h"
+#include "common/config_proxy.h"
 #include "common/errno.h"
 #include "common/safe_io.h"
 #include "common/strtol.h"
@@ -430,7 +430,7 @@ int execute_map(const po::variables_map &vm,
 
   // parse default options first so they can be overwritten by cli options
   r = parse_map_options(
-      g_conf->get_val<std::string>("rbd_default_map_options"));
+      g_conf().get_val<std::string>("rbd_default_map_options"));
   if (r < 0) {
     std::cerr << "rbd: couldn't parse default map options" << std::endl;
     return r;
index 65380f8987a27def77ae3969554fc59ce2aa983f..f6b26c032ca09be60dd028d74eb6936c4d4d296d 100644 (file)
@@ -297,7 +297,7 @@ int execute(const po::variables_map &vm,
   }
 
   r = do_list(pool_name, namespace_name, vm["long"].as<bool>(),
-              g_conf->get_val<int64_t>("rbd_concurrent_management_ops"),
+              g_conf().get_val<int64_t>("rbd_concurrent_management_ops"),
               formatter.get());
   if (r < 0) {
     std::cerr << "rbd: list: " << cpp_strerror(r) << std::endl;
index 01f1c990517f6c473580027b927304ac1a3d814f..6f4443d140caff933cb68643043cab14736ed92b 100644 (file)
@@ -481,7 +481,7 @@ public:
       m_factory(std::bind(ImageRequestAllocator<RequestT>(),
                           std::ref(m_io_ctx), std::ref(m_throttle),
                           std::placeholders::_1, std::forward<Args>(args)...)),
-      m_throttle(g_conf->get_val<int64_t>("rbd_concurrent_management_ops"),
+      m_throttle(g_conf().get_val<int64_t>("rbd_concurrent_management_ops"),
                  true) {
   }
 
index 44a075237f1be019dd96ae53b59aa40f8029de3d..23096957bf1d1227fabf67c85ef8aed4a7d748bc 100644 (file)
@@ -93,7 +93,7 @@ static int do_map(int argc, const char *argv[])
   auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
                          CODE_ENVIRONMENT_DAEMON,
                          CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS);
-  g_ceph_context->_conf->set_val_or_die("pid_file", "");
+  g_ceph_context->_conf.set_val_or_die("pid_file", "");
 
   if (global_init_prefork(g_ceph_context) >= 0) {
     std::string err;
@@ -116,7 +116,7 @@ static int do_map(int argc, const char *argv[])
   global_init_chdir(g_ceph_context);
 
   if (poolname.empty()) {
-    poolname = g_ceph_context->_conf->get_val<std::string>("rbd_default_pool");
+    poolname = g_ceph_context->_conf.get_val<std::string>("rbd_default_pool");
   }
 
   std::string devname = boost::starts_with(devpath, "/dev/") ?
@@ -200,7 +200,7 @@ static int do_map(int argc, const char *argv[])
 
   std::cout << "/dev/" << drv->get_devname() << std::endl;
 
-  if (g_conf->daemonize) {
+  if (g_conf()->daemonize) {
     forker.daemonize();
     global_init_postfork_start(g_ceph_context);
     global_init_postfork_finish(g_ceph_context);
index cb9474394d92f0e795ee48e6c880b0ccea35bb8a..271a913c4dee1e3e06b1c3261d367d74183cc279 100644 (file)
@@ -202,10 +202,10 @@ const char** ImageSyncThrottler<I>::get_tracked_conf_keys() const {
 }
 
 template <typename I>
-void ImageSyncThrottler<I>::handle_conf_change(const md_config_t *conf,
+void ImageSyncThrottler<I>::handle_conf_change(const ConfigProxy& conf,
                                       const set<string> &changed) {
   if (changed.count("rbd_mirror_concurrent_image_syncs")) {
-    set_max_concurrent_syncs(conf->get_val<uint64_t>("rbd_mirror_concurrent_image_syncs"));
+    set_max_concurrent_syncs(conf.get_val<uint64_t>("rbd_mirror_concurrent_image_syncs"));
   }
 }
 
index b5711472a2b5377ab9979ea6cae2d0c4ee185038..8f965bf7b7ec82613259686be1086c604e0a4e2c 100644 (file)
@@ -49,7 +49,7 @@ private:
   std::set<std::string> m_inflight_ops;
 
   const char **get_tracked_conf_keys() const override;
-  void handle_conf_change(const md_config_t *conf,
+  void handle_conf_change(const ConfigProxy& conf,
                           const std::set<std::string> &changed) override;
 };
 
index 84d7a9de6a46f3bb8239ddfde8dd279a23dda3c2..e93db4c4f8feba82abecc98068ce831be9cef68c 100644 (file)
@@ -46,7 +46,7 @@ int main(int argc, const char **argv)
                         CODE_ENVIRONMENT_DAEMON,
                         CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS);
 
-  if (g_conf->daemonize) {
+  if (g_conf()->daemonize) {
     global_init_daemonize(g_ceph_context);
   }
   g_ceph_context->enable_perf_counter();
@@ -62,7 +62,7 @@ int main(int argc, const char **argv)
   argv_to_vec(argc, argv, cmd_args);
 
   // disable unnecessary librbd cache
-  g_ceph_context->_conf->set_val_or_die("rbd_cache", "false");
+  g_ceph_context->_conf.set_val_or_die("rbd_cache", "false");
 
   mirror = new rbd::mirror::Mirror(g_ceph_context, cmd_args);
   int r = mirror->init();
index 97a46f3caf7a0e507d88544e8bc3aaba820b2e2a..64f13a691336a0721ee1c75d5e39c13d5ff6e1e1 100644 (file)
@@ -677,7 +677,7 @@ static int do_map(int argc, const char *argv[], Config *cfg)
   auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
                          CODE_ENVIRONMENT_DAEMON,
                          CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS);
-  g_ceph_context->_conf->set_val_or_die("pid_file", "");
+  g_ceph_context->_conf.set_val_or_die("pid_file", "");
 
   if (global_init_prefork(g_ceph_context) >= 0) {
     std::string err;
@@ -860,7 +860,7 @@ static int do_map(int argc, const char *argv[], Config *cfg)
 
     cout << cfg->devpath << std::endl;
 
-    if (g_conf->daemonize) {
+    if (g_conf()->daemonize) {
       global_init_postfork_finish(g_ceph_context);
       forker.daemonize();
     }