[Openstack] fake_flags + common breakout

Eric Windisch eric at cloudscaling.com
Fri May 4 16:16:36 UTC 2012


I added a flag in my branch which uses a flag defined in the ZeroMQ driver.

This was fine before, but is a problem now, because tests/__init__.py doesn't do rpc.register_opts. Instead, it does FLAGS.register_opts(rpc.rpc_opts), which only loads the common RPC flags.

Of course, the flags file *defines* the RPC driver to be used, so there would be no benefit of running rpc.register_opts until after fake_flags is loaded.

The easiest solutions I see are:
A. load fake_flags.py, then rpc.register_opts, then run a fake_rpc_flags.py.
B. import rpc, add rpc.register_opts to fake_flags.py, then add any flags we want.
C. not support testing flags on RPC drivers, have a common "testing" flag.


--  
Eric Windisch


On Friday, May 4, 2012 at 6:08 PM, Russell Bryant wrote:

> On 05/04/2012 11:53 AM, Eric Windisch wrote:
> > Russell,
> >  
> > FYI, with the flags patch, it is no longer possible to set
> > rpc-implementation dependent flags in fake_flags.
> >  
> > Even Rabbit has a flag in there (fake_rabbit), but Rabbit flags are
> > currently global, so it works. That won't be true for long… We're going
> > to have to fix this.
> >  
> > One option is to initialize the RPC layer from fake_flags.py and then
> > set the options.
> >  
>  
>  
> Each place that fake_flags is imported, rpc gets initialized first. See
> these lines of code, and the fake_flags import shortly after:
>  
> https://github.com/openstack/nova/blob/master/nova/tests/__init__.py#L63
> https://github.com/openstack/nova/blob/master/bin/nova-dhcpbridge#L103
>  
> > Another option, for now, might just be to push this problem into the
> > implementations and have a global "testing" flag that is
> > implementation/backend independent. This is uglier on the
> > implementation/driver side, but cleaner on the unit tests. This is
> > basically what 'fake_rabbit' is now, anyway.
> >  
>  
>  
> As far as I can tell, this isn't actually a problem with the uses of
> fake_flags right now. What problem did you hit?
>  
> --  
> Russell Bryant
>  
>  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20120504/9c4e9b3e/attachment.html>


More information about the Openstack mailing list