Can multiple l3-agent instances run on one host?

Asked by Lingxian Kong

Hi all:

When I read the code of the latest quantum master brantch, I found that the behavior of "add_network_to_dhcp_agent" and "add_router_to_l3_agent" is not the same. Because I have not the newest installation for now, so I came here to ask for help!

"add_network_to_dhcp_agent": after some verifacation, will directly add a record in the NetworkDhcpAgentBinding table;

"add_router_to_l3_agent": after some verifacation, method 'auto_schedule_routers' is called:
            result = self.auto_schedule_routers(context,
                                                agent_db.host,
                                                router_id)
the parameter 'agent_db.host' means that there are some l3-agent instances on the host(if not, I think this method will not make sense), then the code will pick one that may be different with the agent you want host the router, so strange!

I wander whether it's a bug. Please let me know if I am missing something here.

--Lingxian Kong

Question information

Language:
English Edit question
Status:
Solved
For:
neutron Edit question
Assignee:
No assignee Edit question
Solved by:
yong sheng gong
Solved:
Last query:
Last reply:
Revision history for this message
yong sheng gong (gongysh) said :
#1

To add route on l3 agent is more complicated, the algorithm is done in auto_schedule_routers. agent_db.host is specifying the agent, the router is the target. so it means add the router to the given l3 agent.

Revision history for this message
yong sheng gong (gongysh) said :
#2

regarding 'Can multiple l3-agent instances run on one host?", the answer is yes, but you should define the 'host' to different value in l3_agent.ini, and the namespace must be enalbed.

Revision history for this message
Lingxian Kong (kong) said :
#3

to yongsheng:

Thanks for your reply!

But I'm still confused. The algorithm in auto_schedule_routers may choose another l3-agent using the same 'host', right?code here:
...
query = context.session.query(agents_db.Agent)
            query = query.filter(agents_db.Agent.agent_type ==
                                 constants.AGENT_TYPE_L3,
                                 agents_db.Agent.host == host,
                                 agents_db.Agent.admin_state_up == True)
            try:
                l3_agent = query.one()
...

and if each l3-agent has different 'host' configuration, why not send message to the agent directly, rather than randomly choose one? I think it's contradictory.

--Lingxian Kong

Revision history for this message
Best yong sheng gong (gongysh) said :
#4

one host can have only one l3 agent. the host is defined by host configuration configuration file, not physical one.
what do u mean by send message to the agent directly? we need to schedule.

Revision history for this message
Lingxian Kong (kong) said :
#5

Thanks yong sheng gong, that solved my question.