]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: Add config observer for Objecter instance. 4293/head
authorAlistair Strachan <alistair.strachan@imgtec.com>
Tue, 7 Apr 2015 20:45:09 +0000 (13:45 -0700)
committerAlistair Strachan <alistair.strachan@imgtec.com>
Tue, 7 Apr 2015 21:21:55 +0000 (14:21 -0700)
The Objecter instance used by librados does not currently have
add_observer() called on it. This means that the Objecter instance
it creates does not receive any notification of changes to the
'crush_location' parameter.

This can cause performance problems if commands using librados
(e.g. 'rbd') are run with localized reads on arbitrary (non-
cluster) hosts, as the client instance cannot self-determine
its locality, causing it to randomly select osds.

Change the Objecter instance to instead register its own observer
(as the other classes inheriting md_config_obs_t do) and ensure
that the configuration change propagates through to the librados
Objecter instance by calling call_all_observers() at the end of
init.

The 'crush location' setting can now be specified in either the
[global] or [client] sections of ceph.conf and will be respected.

Signed-off-by: Alistair Strachan <alistair.strachan@imgtec.com>
src/librados/RadosClient.cc
src/osdc/Objecter.cc

index 8e63fce886cd41ef358acbc3fd41c3a7de464554..03f2b3c881c1d34c28159f33938a6f4472a0c12e 100644 (file)
@@ -271,6 +271,8 @@ int librados::RadosClient::connect()
 
   lock.Unlock();
 
+  cct->_conf->call_all_observers();
+
   ldout(cct, 1) << "init done" << dendl;
   err = 0;
 
index 229da137a9cae197be2ce40f19dba703d5147a3a..4987a92d75c5bb52f97264ba159503a5823ac12a 100644 (file)
@@ -288,6 +288,8 @@ void Objecter::init()
   timer.init();
   timer_lock.Unlock();
 
+  cct->_conf->add_observer(this);
+
   initialized.set(1);
 }