Re: [openstack-dev] multiple external networks not working

2014-02-13 Thread Yongsheng Gong
in order that the router is scheduled to a l3 agent with a given external
network,  we should create the router and set its gateway interface on that
external network just after the router creation.


On Thu, Feb 13, 2014 at 3:26 PM, Nick Ma skywalker.n...@gmail.com wrote:

 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.n...@gmail.com


 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] multiple external networks not working

2014-02-13 Thread Nick Ma
Thanks for your quick reply. I'll try it later.

On 2/13/2014 3:54 PM, Yongsheng Gong wrote:
 in order that the router is scheduled to a l3 agent with a given
 external network,  we should create the router and set its gateway
 interface on that external network just after the router creation.


 On Thu, Feb 13, 2014 at 3:26 PM, Nick Ma skywalker.n...@gmail.com
 mailto:skywalker.n...@gmail.com wrote:

 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
 http://192.168.1.0/24 |
 | a2946b29-6be5-4285-9eb9-99625ec2a283 |Ext-Net  |
 dfbc7f6c-c3dd-4c56-a142-48964e2e474c 192.168.2.0/24
 http://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.n...@gmail.com mailto:skywalker.n...@gmail.com


 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 mailto:OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev




 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

-- 

Nick Ma
skywalker.n...@gmail.com


___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


[openstack-dev] multiple external networks not working

2014-02-12 Thread Nick Ma
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.n...@gmail.com


___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev