<div style="font-family: Helvetica; font-size: 12px; ">I added a flag in my branch which uses a flag defined in the ZeroMQ driver.<div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>The easiest solutions I see are:</div><div>A. load fake_flags.py, then rpc.register_opts, then run a fake_rpc_flags.py.</div><div>B. import rpc, add rpc.register_opts to fake_flags.py, then add any flags we want.</div><div>C. not support testing flags on RPC drivers, have a common "testing" flag.</div></div>
                <div><div><br></div>-- <br>Eric Windisch<div><br></div></div>
                 
                <p style="color: #A0A0A8;">On Friday, May 4, 2012 at 6:08 PM, Russell Bryant wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><div>On 05/04/2012 11:53 AM, Eric Windisch wrote:</div><blockquote type="cite"><div><div>Russell,</div><div><br></div><div>FYI, with the flags patch, it is no longer possible to set</div><div>rpc-implementation dependent flags in fake_flags.</div><div><br></div><div>Even Rabbit has a flag in there (fake_rabbit), but Rabbit flags are</div><div>currently global, so it works. That won't be true for long… We're going</div><div>to have to fix this.</div><div><br></div><div>One option is to initialize the RPC layer from fake_flags.py and then</div><div>set the options.</div></div></blockquote><div><br></div><div>Each place that fake_flags is imported, rpc gets initialized first.  See</div><div>these lines of code, and the fake_flags import shortly after:</div><div><br></div><div><a href="https://github.com/openstack/nova/blob/master/nova/tests/__init__.py#L63">https://github.com/openstack/nova/blob/master/nova/tests/__init__.py#L63</a></div><div><a href="https://github.com/openstack/nova/blob/master/bin/nova-dhcpbridge#L103">https://github.com/openstack/nova/blob/master/bin/nova-dhcpbridge#L103</a></div><div><br></div><blockquote type="cite"><div><div>Another option, for now, might just be to push this problem into the</div><div>implementations and have a global "testing" flag that is</div><div>implementation/backend independent. This is uglier on the</div><div>implementation/driver side, but cleaner on the unit tests.  This is</div><div>basically what 'fake_rabbit' is now, anyway.</div></div></blockquote><div><br></div><div>As far as I can tell, this isn't actually a problem with the uses of</div><div>fake_flags right now.  What problem did you hit?</div><div><br></div><div>-- </div><div>Russell Bryant</div></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>