[Grizzly]how to config multiple l3 agent for quantum ? I wanna run multiple l3 agent on one network node, because I wanna multiple external network.

Asked by happyidea

[Grizzly]how to config multiple l3 agent for quantum ? I wanna run multiple l3 agent on one network node, because I wanna multiple external network.

Question information

Language:
English Edit question
Status:
Solved
For:
neutron Edit question
Assignee:
No assignee Edit question
Solved by:
happyidea
Solved:
Last query:
Last reply:
Revision history for this message
ZhiQiang Fan (aji-zqfan) said :
#1

currently, you cannot run multiple l3-agent in a **same host**, and multi external network is not supported yet.

for i.e. l3-agent need to get_external_network_id via l3_rpc_base, and it invokes the plugin's method, which is defined in quantum/db/l3_db.py (grizzly):

    def get_external_network_id(self, context):
        nets = self.get_networks(context, {external_net.EXTERNAL: [True]})
        if len(nets) > 1:
            raise q_exc.TooManyExternalNetworks()
        else:
            return nets[0]['id'] if nets else None

so you can not directly run multiple external net in quantum, even you modify this part and all other related part, you still cannot support multiple external network, the l3-agent is designed to be unique in **single host**, there are many code based on this design. (you can see the init process of l3-agent, that will show you something, especially the ns destroy and create), so even multiple ext nets are created and multiple l3-agents are started (after some effort to modify), but they may still not work well (but you can try, nothing is impossible)

moreover, i think this feature will not be added to grizzly (even havana), since it is already in stable branch.

There already a few discussion about this topic in bugs comment and reviews, but sorry i cannot remember the links.

Revision history for this message
ZhiQiang Fan (aji-zqfan) said :
#2

and there is another similar question solved by yong sheng gong: https://answers.launchpad.net/neutron/+question/230239

Revision history for this message
happyidea (guolongcang-work) said :
#3

to ZhiQiang:

    Thank you for your reply.
    I have solved this problem, successfully run multiple l3 agent on one network node, and created 2 external networks, all of them are running normally. I don't know which version of openstack code you refer , I use Grizzly.
    And my Configuration Steps:
    1、 enable network namespace on quantum.conf, dhcp-agent.ini , l3-agent.ini
    2、 create two external network, then refer to http://docs.openstack.org/grizzly/openstack-network/admin/content/adv_cfg_l3_agent_multi_extnet.html
    3、 add an option named 'host' in each l3-agent.ini file, looks like
            first l3-agent.ini:
             host = first-l3
            second l3-agent.ini:
             host = second-l3
    4、 change the network node and controller node's /etc/hosts file, supose your network node's ip address is 10.10.1.4, then add two lines to it:
            10.10.1.4 first-l3
            10.10.1.4 second-l3
    5、 create two router through cli ,and all router's default l3-agent is the first one , change one router's l3 agent to the second one .
    6、 set two external network as corresponding router's gateway.
    7、 done.

Revision history for this message
happyidea (guolongcang-work) said :
#4

Problem Solved.

Revision history for this message
ZhiQiang Fan (aji-zqfan) said :
#5

i think maybe you can update this to the official manual, it's really useful

Revision history for this message
happyidea (guolongcang-work) said :
#6

to ZhiQiang:
     Thanks for your advice . I will do that later.

Revision history for this message
david luis (lqhoa1207) said :
#7

hi happyidea,
Could you explain more at step 5? how to config all router's default l3-agent is the first one , change one router's l3 agent to the second one?

Revision history for this message
david luis (lqhoa1207) said :
#8

hi happyidea,
Could you explain more at step 5? how to config all router's default l3-agent is the first one , change one router's l3 agent to the second one?

Revision history for this message
Li Ma (nick-ma-z) said :
#9

hi happyidea,

How do you set these l3_agent.ini for different l3-agent on the same node? I'm doing the same experiment and find it difficult to set these l3-agents properly.

thanks.

Revision history for this message
Robert Kukura (rkukura) said :
#10

Just want to point out that since https://review.openstack.org/#/c/59359/ was merged, a single l3-agent can handle multiple external networks (using provider networks rather than external_network_bridge), so running multiple l3-agents on the same node should no longer be necessary.

Revision history for this message
happyidea (guolongcang-work) said :
#11

to Robert Kukura:
       Thank you for your infomation , it's really useful.

to Li Ma:
       Please refer to Robert Kukura's reply.

Revision history for this message
Li Ma (nick-ma-z) said :
#12

I've tried the patch before. It doesn't work. I'm not sure how to set provider network in my environment. I'm using OVS+VxLAN tunneling. AFAIK, provider network is mainly designed for physical VLANs. Could you guys provide more details about it? Thanks a lot.

Revision history for this message
Asma (elhitmi-asma) said :
#13

would you please explain how could you install two L3-agent instances on the same host machine ?? because once i install the first instance and i want to install the second one, i get the message annoucing that the program already exists

Revision history for this message
Li Ma (nick-ma-z) said :
#14

1. install neutron-l3-agent package via rpm/deb/source code.
2. cp /etc/neutron/l3-agent.ini to
/etc/neutron/l3-agent-1.ini
/etc/neutron/l3-agent-2.ini
3. modify each conf file to reflect different host
in l3-agent-1.ini: host=l3-agent-1
in l3-agent-2.ini: host=l3-agent-2
4. run the two l3-agent by hand
neutron-l3-agent --conf-file /etc/neutron/neutron.conf --conf-file /etc/neutron/l3-agent-1.ini &
neutron-l3-agent --conf-file /etc/neutron/neutron.conf --conf-file /etc/neutron/l3-agent-2.ini &

Note: I haven't tested it yet, but I think it gonna work.

Revision history for this message
Hua Zhang (zhhuabj) said :
#15

I agree with ZhiQiang Fan in #1 that we can't run multiple l3-agent in a same host because one l3-agent will delete the namespace of another l3-agent when it started due to following code. so I don't think the approach of #3 and #14 can work actually.
b/quantum/agent/l3_agent.py
class L3NATAgent(manager.Manager):
 root_ip = ip_lib.IPWrapper(self.root_helper)
 for ns in root_ip.get_namespaces(self.root_helper):
     if ns.startswith(NS_PREFIX):
         if only_router_id and not ns.endswith(only_router_id):
             continue

Revision history for this message
Asma (elhitmi-asma) said :
#16

from my side i can confirm what nick-ma-z has said, i have succefully run the two l3 agent instances