<br><br><div class="gmail_quote">On Thu, Feb 21, 2013 at 10:03 AM, Mark McLoughlin <span dir="ltr"><<a href="mailto:markmc@redhat.com" target="_blank">markmc@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Wed, 2013-02-20 at 15:07 +0100, Julien Danjou wrote:<br>
> On Wed, Feb 20 2013, Mark McLoughlin wrote:<br>
><br>
> > I don't know exactly what you're trying to achieve here, but if you need<br>
> > different RPC configuration for ceilometer code in nova-compute then you<br>
> > need a separate configuration file and a separate ConfigOpts object<br>
> ><br>
> > Basically, there should be a way to pass an object other than<br>
> > oslo.confg.cfg.CONF to the RPC calls.<br>
><br>
> Ok, but the underlying problem is that we don't control what<br>
> openstack.common.rpc does, and it registers its options at import time.<br>
><br>
> So how can we, Ceilometer, fix this case:<br>
><br>
> >>> import nova.openstack.common.rpc<br>
> >>> import ceilometer.openstack.common.rpc<br>
><br>
> on our own?<br>
><br>
> (Hint: the answer "don't do that" isn't valid :-))<br>
<br>
</div>Ok, I took a poke at this and hacked up a patch that's probably broken<br>
in a million different ways.<br>
<br>
The tl;dr is that we can add an rpc.get_impl() function quite easily but<br>
ceilometer will require quite a bit of conf to ensure no code run by<br>
nova_notifer uses cfg.CONF:<br>
<br>
<a href="https://github.com/markmc/ceilometer/commits/non-global-conf" target="_blank">https://github.com/markmc/ceilometer/commits/non-global-conf</a><br>
<br>
Allow nova_notifier use non-global config<br>
<br>
The nova_notifer code runs in the context of nova, so if we use cfg.CONF<br>
then we are reading options from nova.conf. Instead, we want to read<br>
config options from ceilometer.conf.<br>
<br>
To achieve that, all of ceilometers code which is used by nova_notifier<br>
needs to accept a ConfigOpts object created by nova_notifier. The code<br>
needs to both register and read config options from this object.<br>
<br>
When we get down to meter_publish, the calls to the oslo RPC code also<br>
need to be passed this ConfigOpts object. To facilitate this, we add<br>
a new rpc.get_impl() function which needs to be proposed to<br>
oslo-incubator.<br>
<br>
I've also filed this bug:<br>
<br>
<a href="https://bugs.launchpad.net/oslo/+bug/1131233" target="_blank">https://bugs.launchpad.net/oslo/+bug/1131233</a></blockquote><div><br></div><div>I filed <a href="https://bugs.launchpad.net/ceilometer/+bug/1130952">https://bugs.launchpad.net/ceilometer/+bug/1130952</a> and have started working on a new implementation for the notifier that minimizes the amount of ceilometer code that it imports as a side-effect.</div>
<div><br></div><div>I still think we should do what we can to start moving away from global state for the config, but these changes will give us more time to think about how to do that cleanly.</div><div><br></div><div>Doug</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<div class="HOEnZb"><div class="h5"><br>
Cheers,<br>
Mark.<br>
<br>
<br>
_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</div></div></blockquote></div><br>