From: Alistair Strachan Date: Tue, 7 Apr 2015 20:45:09 +0000 (-0700) Subject: librados: Add config observer for Objecter instance. X-Git-Tag: v9.0.2~192^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9fed56443140892f6ff7bf8f2157291a7e8dd561;p=ceph.git librados: Add config observer for Objecter instance. 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 --- diff --git a/src/librados/RadosClient.cc b/src/librados/RadosClient.cc index 8e63fce886cd..03f2b3c881c1 100644 --- a/src/librados/RadosClient.cc +++ b/src/librados/RadosClient.cc @@ -271,6 +271,8 @@ int librados::RadosClient::connect() lock.Unlock(); + cct->_conf->call_all_observers(); + ldout(cct, 1) << "init done" << dendl; err = 0; diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 229da137a9ca..4987a92d75c5 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -288,6 +288,8 @@ void Objecter::init() timer.init(); timer_lock.Unlock(); + cct->_conf->add_observer(this); + initialized.set(1); }