[Openstack] multiple external networks not working

Nick Ma skywalker.nick at gmail.com
Thu Feb 13 07:26:40 UTC 2014


I have a multiple external networks environment:

| 6fd43d02-221a-44fe-8088-dc5915512c14  |   Ext-Net-2   |
1a530334-9dd7-45f3-aa6a-2bb1a5dad562 192.168.1.0/24 |
| a2946b29-6be5-4285-9eb9-99625ec2a283 |    Ext-Net      |
dfbc7f6c-c3dd-4c56-a142-48964e2e474c 192.168.2.0/24 |

Each of the external network is served by a single L3-agent. I also
declare "gateway_external_network_id" in each l3_agent.ini, and set
external_network_bridge.

Then, I set up tenants, routers and gateways as follows:

TenantA <--> TenantA-Router <--> Ext-Net <--> Internet
TenantB <--> TenantB-Router <--> Ext-Net-2 <--> Internet

I find that both qrouter-xxx is associated with only one L3-agent, not
as expected.

I debugged l3-agent-router-scheduler component to see how it works. I
found that:

Before the router is scheduled, I print agent objects out:

<neutron.db.agents_db.Agent[object at 2ba9150] {...
configurations=u'{"router_id": "", "gateway_external_network_id":
"6fd43d02-221a-44fe-8088-dc5915512c14", ...>

The gateway_external_network_id is actual there.

And I print router object out:

Router: {'status': u'ACTIVE', 'external_gateway_info': None, 'name':
u'TenantA-R1', 'gw_port_id': None, 'admin_state_up': True, 'tenant_id':
u'b181fd2406784da5895a966da4b74126', 'routes': [], 'id':
u'14ff540e-13c6-4aec-8064-a74320f62a0d'}

The external_gateway_info is None.

Finally, I run "neutron router-show":

7ab3f8f4-89c8-4735-a5c2-4c0a09103bf1 | TenantA-R1 | {"network_id":
"6fd43d02-221a-44fe-8088-dc5915512c14", "enable_snat": true}

The external_gateway_info is there.

So, I guess that:

The router scheduler works before I associate with external gateway to
that router.

in neutron/db/l3_agentschedulers_db.py:
def get_l3_agent_candidates(self, sync_router, l3_agents)
    gateway_external_network_id = agent_conf.get(
                'gateway_external_network_id', None)
    ex_net_id = (sync_router['external_gateway_info'] or {}).get(
                'network_id')

It compares the two variables to see if they are equal, the l3-agent is
candidate.

Forget to tell that it happens for HAVANA stable release. I haven't
tested master branch yet.

1. A bug or by design?
2. How to run multiple external networks?

-- 

Nick Ma
skywalker.nick at gmail.com





More information about the Openstack mailing list