[openstack-dev] [Neutron LBaaS] Need help with LBaaS drivers
Vijay Venkatachalam
Vijay.Venkatachalam at citrix.com
Wed Apr 2 04:10:57 UTC 2014
Answered Inline!
From: Vijay B [mailto:os.vbvs at gmail.com]
Sent: Wednesday, April 2, 2014 7:14 AM
To: OpenStack Development Mailing List (not for usage questions)
Subject: [openstack-dev] [Neutron LBaaS] Need help with LBaaS drivers
Hi,
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:
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. ):
and has empty __init__(), create_vip(), delete_vip() etc functions.
>>> Fine
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:
service_provider=LOADBALANCER:Dummy:neutron.services.loadbalancer.drivers.dummy.dummy_driver.DummyPluginDriver:default
>> Fine. You should see you driver getting loaded when the neutron service is started.
3) I created a /etc/neutron/services/loadbalancer/dummy/lbaas_agent.ini directory/file
I simply copied over the haproxy's lbaas_agent.ini file and changed [haproxy] to [dummy]
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
>> You have to do this only if you are planning on an Agent for your driver.
>> If you plan to run an agent, create a device_driver entry in the .ini file.
>> Like device_driver=neutron.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver
However, I see that the default HAProxyNS driver is still being loaded
When I put a breakpoint in loadbalancer/agent/agent_manager.py:86, I see this (relevant text marked in red):
2014-03-31 13:47:16.998 DEBUG neutron.common.utils [-] Reloading cached file /etc/neutron/policy.json from (pid=28405) read_cached_file /opt/stack/neutron/neutron/common/utils.py:53
2014-03-31 13:47:16.998 DEBUG neutron.policy [-] Loading policies from file: /etc/neutron/policy.json from (pid=28405) _set_rules /opt/stack/neutron/neutron/policy.py:89
> /opt/stack/neutron/neutron/services/loadbalancer/agent/agent_manager.py(86)_load_drivers()
-> self.device_drivers = {}
(Pdb) l
81 # pool_id->device_driver_name mapping used to store known instances
82 self.instance_mapping = {}
83
84 def _load_drivers(self):
85 import pdb; pdb.set_trace()
86 -> self.device_drivers = {}
87 for driver in self.conf.device_driver:
88 try:
89 driver_inst = importutils.import_object(
90 driver,
91 self.conf,
(Pdb) self.conf.device_driver
['neutron.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver']
(Pdb)
>> HaproxyNSDriver is default entry. You could check in "./neutron/neutron/services/loadbalancer/agent/agent_manager.py"
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?
Any help would be much appreciated!
Thanks,
Regards,
Vijay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140402/96dc8b2e/attachment.html>
More information about the OpenStack-dev
mailing list