<div dir="ltr"><p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif">Hi,</font></p><p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif"><br></font></p><p style="margin:0px">
<font face="arial, helvetica, sans-serif"><font color="#232323">I'm trying to understand how LBaaS drivers work and so am attempting to write a dummy driver that does nothing for now, but instead of loading my dummy driver, neutron always loads the HAProxy namespace driver. These are the steps I followed:</font></font></p>
<p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif"><br></font></p><p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif">1) I created a new directory neutron/services/loadbalancer/drivers/dummy/, and i</font><span style="font-family:arial,helvetica,sans-serif">n that directory I put in a new file dummy_driver.py, </span><span style="font-family:arial,helvetica,sans-serif">which basically has a class class DummyPluginDriver(abstract_driver.LoadBalancerAbstractDriver):</span></p>

<p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif">and has empty __init__(), create_vip(), delete_vip() etc functions.</font></p><p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif"><br>
</font></p><p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif">2) </font><span style="font-family:arial,helvetica,sans-serif">I'm testing using a devstack setup, so I also edited the /etc/neutron/neutron.conf file, commenting out the default loadbalancer driver entry for HAProxy, and added a line for my dummy driver as follows:</span></p>
<p style="margin:0px;color:rgb(35,35,35)"><span style="font-family:arial,helvetica,sans-serif"><br></span></p>
<p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif">service_provider=LOADBALANCER:Dummy:neutron.services.loadbalancer.drivers.dummy.dummy_driver.DummyPluginDriver:default</font></p><p style="margin:0px;color:rgb(35,35,35)">
<font face="arial, helvetica, sans-serif"><br></font></p><p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif"><br></font></p>
<p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif">3) I created a /etc/neutron/services/loadbalancer/dummy/lbaas_agent.ini directory/file</font></p>
<p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif">I simply copied over the haproxy's lbaas_agent.ini file and changed [haproxy] to [dummy]</font></p>
<p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif">and then I restarted the q-lbaas service using cd /opt/stack/neutron && python /usr/local/bin/neutron-lbaas-agent --config-file /etc/neutron/neutron.conf --config-file=/etc/neutron/services/loadbalancer/dummy/lbaas_agent.ini</font></p>
<p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif"><br></font></p><p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif"><br></font></p>
<p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif">However, I see that the default HAProxyNS driver is still being loaded</font></p>
<p style="margin:0px"><font face="arial, helvetica, sans-serif"><font color="#232323">When I put a breakpoint in loadbalancer/agent/agent_manager.py:86, I see this (relevant text marked in </font><font color="#ff0000">red</font><font color="#232323">):</font></font></p>

<p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif"><span style="background-color:rgb(0,230,229)"><br></span></font></p><p style="margin:0px;color:rgb(35,35,35)"><br></p><p style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(175,173,36)">
<span style="color:rgb(0,0,0)">2014-03-31 13:47:16.998 </span><span style="color:rgb(52,189,38)">DEBUG neutron.common.utils [</span><span style="color:rgb(52,187,199)">-</span><span style="color:rgb(52,189,38)">] Reloading cached file /etc/neutron/policy.json</span><span style="color:rgb(0,0,0)"> </span>from (pid=28405) read_cached_file /opt/stack/neutron/neutron/common/utils.py:53</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(52,189,38)"><span style="color:rgb(0,0,0)">2014-03-31 13:47:16.998 </span>DEBUG neutron.policy [<span style="color:rgb(52,187,199)">-</span>] Loading policies from file: /etc/neutron/policy.json<span style="color:rgb(0,0,0)"> </span><span style="color:rgb(175,173,36)">from (pid=28405) _set_rules /opt/stack/neutron/neutron/policy.py:89</span></p>
<p style="margin:0px;font-size:11px;font-family:Menlo">> /opt/stack/neutron/neutron/services/loadbalancer/agent/agent_manager.py(86)_load_drivers()</p><p style="margin:0px;font-size:11px;font-family:Menlo">-> self.device_drivers = {}</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">(Pdb) l</p><p style="margin:0px;font-size:11px;font-family:Menlo"> 81             # pool_id->device_driver_name mapping used to store known instances</p><p style="margin:0px;font-size:11px;font-family:Menlo">
 82             self.instance_mapping = {}</p><p style="margin:0px;font-size:11px;font-family:Menlo"> 83     </p><p style="margin:0px;font-size:11px;font-family:Menlo"> 84         def _load_drivers(self):</p><p style="margin:0px;font-size:11px;font-family:Menlo">
 85             import pdb; pdb.set_trace()</p><p style="margin:0px;font-size:11px;font-family:Menlo"> 86  ->         self.device_drivers = {}</p><p style="margin:0px;font-size:11px;font-family:Menlo"> 87             for driver in self.conf.device_driver:</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"> 88                 try:</p><p style="margin:0px;font-size:11px;font-family:Menlo"> 89                     driver_inst = importutils.import_object(</p><p style="margin:0px;font-size:11px;font-family:Menlo">
 90                         driver,</p><p style="margin:0px;font-size:11px;font-family:Menlo"> 91                         self.conf,</p><p style="margin:0px;font-size:11px;font-family:Menlo">(Pdb) self.conf.device_driver</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><font color="#ff0000">['neutron.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver']</font></p><p style="margin:0px;color:rgb(35,35,35)">

















</p><p style="margin:0px;font-size:11px;font-family:Menlo">(Pdb) </p><div><br></div>
<p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif"><br></font></p><p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif">I'm not sure what I'm doing wrong - am I missing something that needs to be done within the dummy driver itself? (in dummy_driver.py?). Should I register some opts or similar? </font></p>
<p style="margin:0px;color:rgb(35,35,35)"><font face="arial, helvetica, sans-serif"><br></font></p><p style="margin:0px;color:rgb(35,35,35)"><span style="font-family:arial,helvetica,sans-serif">Any help would be much appreciated!</span></p>
<p style="margin:0px;color:rgb(35,35,35)"><span style="font-family:arial,helvetica,sans-serif"><br></span></p><p style="margin:0px;color:rgb(35,35,35)"><span style="font-family:arial,helvetica,sans-serif"><br></span></p><p style="margin:0px;color:rgb(35,35,35)">
<span style="font-family:arial,helvetica,sans-serif">Thanks,</span></p><p style="margin:0px;color:rgb(35,35,35)"><span style="font-family:arial,helvetica,sans-serif">Regards,</span></p><p style="margin:0px;color:rgb(35,35,35)">
<span style="font-family:arial,helvetica,sans-serif">Vijay</span></p></div>