<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Menlo;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Answered Inline!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> Vijay B [mailto:os.vbvs@gmail.com]
<br>
<b>Sent:</b> Wednesday, April 2, 2014 7:14 AM<br>
<b>To:</b> OpenStack Development Mailing List (not for usage questions)<br>
<b>Subject:</b> [openstack-dev] [Neutron LBaaS] Need help with LBaaS drivers<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-family:"Arial","sans-serif";color:#232323">Hi,</span><span style="color:#232323"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="color:#232323"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-family:"Arial","sans-serif";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:</span><o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="color:#232323"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-family:"Arial","sans-serif";color:#232323">1) I created a new directory neutron/services/loadbalancer/drivers/dummy/, and in that directory I put in a new file dummy_driver.py, which basically has
 a class class DummyPluginDriver(abstract_driver.       ):</span><span style="color:#232323"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-family:"Arial","sans-serif";color:#232323">and has empty __init__(), create_vip(), delete_vip() etc functions.<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">>>> Fine<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="color:#232323"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-family:"Arial","sans-serif";color:#232323">2) 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><span style="color:#232323"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="color:#232323"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-family:"Arial","sans-serif";color:#232323">service_provider=LOADBALANCER:Dummy:neutron.services.loadbalancer.drivers.dummy.dummy_driver.DummyPluginDriver:default</span><span style="color:#232323"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="color:#1F497D">>> Fine. You should see you driver getting loaded when the neutron service is started.</span><span style="color:#232323"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="color:#232323"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-family:"Arial","sans-serif";color:#232323">3) I created a /etc/neutron/services/loadbalancer/dummy/lbaas_agent.ini directory/file</span><span style="color:#232323"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-family:"Arial","sans-serif";color:#232323">I simply copied over the haproxy's lbaas_agent.ini file and changed [haproxy] to [dummy]</span><span style="color:#232323"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-family:"Arial","sans-serif";color:#232323">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</span><span style="color:#232323"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">>>  You have to do this only if you are planning on an Agent for your driver.<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">>> If you plan to run an agent, create a device_driver entry in the .ini file.
<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">>> Like device_driver=neutron.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="color:#232323"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-family:"Arial","sans-serif";color:#232323">However, I see that the default HAProxyNS driver is still being loaded</span><span style="color:#232323"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-family:"Arial","sans-serif";color:#232323">When I put a breakpoint in loadbalancer/agent/agent_manager.py:86, I see this (relevant text marked in
</span><span style="font-family:"Arial","sans-serif";color:red">red</span><span style="font-family:"Arial","sans-serif";color:#232323">):</span><o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="color:#232323"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="color:#232323"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black">2014-03-31 13:47:16.998
</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#34BD26">DEBUG neutron.common.utils [</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#34BBC7">-</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#34BD26">]
 Reloading cached file /etc/neutron/policy.json</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black">
</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#AFAD24">from (pid=28405) read_cached_file /opt/stack/neutron/neutron/common/utils.py:53<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black">2014-03-31 13:47:16.998
</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#34BD26">DEBUG neutron.policy [</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#34BBC7">-</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#34BD26">]
 Loading policies from file: /etc/neutron/policy.json</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black">
</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#AFAD24">from (pid=28405) _set_rules /opt/stack/neutron/neutron/policy.py:89</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#34BD26"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif"">> /opt/stack/neutron/neutron/services/loadbalancer/agent/agent_manager.py(86)_load_drivers()<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif"">-> self.device_drivers = {}<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif"">(Pdb) l<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif""> 81             # pool_id->device_driver_name mapping used to store known instances<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif""> 82             self.instance_mapping = {}<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif""> 83     <o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif""> 84         def _load_drivers(self):<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif""> 85             import pdb; pdb.set_trace()<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif""> 86  ->         self.device_drivers = {}<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif""> 87             for driver in self.conf.device_driver:<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif""> 88                 try:<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif""> 89                     driver_inst = importutils.import_object(<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif""> 90                         driver,<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif""> 91                         self.conf,<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif"">(Pdb) self.conf.device_driver<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif";color:red">['neutron.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver']</span><span style="font-size:8.5pt;font-family:"Menlo","serif""><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif"">(Pdb) <o:p></o:p></span></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p style="margin:0in;margin-bottom:.0001pt"><span style="color:#1F497D">>> HaproxyNSDriver is default entry. You could check in "./neutron/neutron/services/loadbalancer/agent/agent_manager.py"<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="color:#232323"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-family:"Arial","sans-serif";color:#232323">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? </span><span style="color:#232323"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="color:#232323"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-family:"Arial","sans-serif";color:#232323">Any help would be much appreciated!</span><span style="color:#232323"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="color:#232323"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="color:#232323"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-family:"Arial","sans-serif";color:#232323">Thanks,</span><span style="color:#232323"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-family:"Arial","sans-serif";color:#232323">Regards,</span><span style="color:#232323"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-family:"Arial","sans-serif";color:#232323">Vijay</span><span style="color:#232323"><o:p></o:p></span></p>
</div>
</div>
</body>
</html>