<div dir="ltr"><div><div><div><div><div><div><div>Hi Li Ma,<br><br></div>I think its a good idea.<br></div>I suggest for first stage, pass the CONF as optional parameter in addition to the db_ip and db_port.<br></div>This way you will have minimum code changes at first patch.<br><br></div>If we see its working ok, we can later remove db_ip and db_port and adjust the other<br></div>drivers in another patch.<br><br></div>Thanks<br></div>Gal.<br><div><div><div><div><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 28, 2015 at 9:48 AM, Li Ma <span dir="ltr"><<a href="mailto:skywalker.nick@gmail.com" target="_blank">skywalker.nick@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">My intention is to pass db-host-list (maybe it is defined in the conf<br>
file) to db backend drivers. I find that there's '**args' available<br>
[1], but it seems not working due to [2].<br>
<br>
I suggest to use a simpler method to allow user-defined configuration that is<br>
removing db_ip and db_port parameters and directly passing cfg.CONF<br>
object to db backend driver.<br>
<br>
In db_api.py, it should be:<br>
def initialize(self, config):<br>
    self.config = config<br>
<br>
In api_nb.py, it should be:<br>
def initialize(self):<br>
        self.driver.initialize(cfg.CONF) <-- from oslo_config<br>
<br>
As a result, let db backend developers choose which parameter to use.<br>
<br>
[1] <a href="https://github.com/openstack/dragonflow/blob/master/dragonflow/db/db_api.py#L21" rel="noreferrer" target="_blank">https://github.com/openstack/dragonflow/blob/master/dragonflow/db/db_api.py#L21</a><br>
[2] <a href="https://github.com/openstack/dragonflow/blob/master/dragonflow/db/api_nb.py#L74-L75" rel="noreferrer" target="_blank">https://github.com/openstack/dragonflow/blob/master/dragonflow/db/api_nb.py#L74-L75</a><br>
<div class="HOEnZb"><div class="h5"><br>
On Mon, Dec 28, 2015 at 9:12 AM, shihanzhang <<a href="mailto:ayshihanzhang@126.com">ayshihanzhang@126.com</a>> wrote:<br>
><br>
> good suggestion!<br>
><br>
><br>
> At 2015-12-25 19:07:10, "Li Ma" <<a href="mailto:skywalker.nick@gmail.com">skywalker.nick@gmail.com</a>> wrote:<br>
>>Hi all, currently, we only support db_ip and db_port in the<br>
>>configuration file. Some DB SDK supports clustering, like Zookeeper.<br>
>>You can specify a list of nodes when client application starts to<br>
>>connect to servers.<br>
>><br>
>>I'd like to implement this feature, specifying ['ip1:port',<br>
>>'ip2:port', 'ip3:port'] list in the configuration file. If only one<br>
>>server exists, just set it to ['ip1:port'].<br>
>><br>
>>Any suggestions?<br>
>><br>
>>--<br>
>><br>
>>Li Ma (Nick)<br>
>>Email: <a href="mailto:skywalker.nick@gmail.com">skywalker.nick@gmail.com</a><br>
>><br>
>>__________________________________________________________________________<br>
>>OpenStack Development Mailing List (not for usage questions)<br>
>>Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
>><a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
><br>
><br>
><br>
><br>
><br>
><br>
> __________________________________________________________________________<br>
> OpenStack Development Mailing List (not for usage questions)<br>
> Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
> <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
><br>
<br>
<br>
<br>
--<br>
<br>
Li Ma (Nick)<br>
Email: <a href="mailto:skywalker.nick@gmail.com">skywalker.nick@gmail.com</a><br>
<br>
__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Best Regards ,<br><br>The G. </div>
</div>