Merge "NeutronBindNetworkPlugin: fix multi segment mtu"
This commit is contained in:
commit
19d169e083
@ -566,18 +566,37 @@ class NeutronBindNetworkPlugin(NeutronNetworkPlugin):
|
|||||||
|
|
||||||
In case of dynamic multi segments the segment is determined while
|
In case of dynamic multi segments the segment is determined while
|
||||||
binding the port. Therefore this method will return for multi segments
|
binding the port. Therefore this method will return for multi segments
|
||||||
network without storing network information.
|
network without storing network information (apart from mtu).
|
||||||
|
|
||||||
Instead, multi segments network will wait until ports are bound and
|
Instead, multi segments network will wait until ports are bound and
|
||||||
then store network information (see allocate_network()).
|
then store network information (see allocate_network()).
|
||||||
"""
|
"""
|
||||||
if self._is_neutron_multi_segment(share_network):
|
if self._is_neutron_multi_segment(share_network):
|
||||||
# In case of dynamic multi segment the segment is determined while
|
# In case of dynamic multi segment the segment is determined while
|
||||||
# binding the port
|
# binding the port, only mtu is known and already needed
|
||||||
|
self._save_neutron_network_mtu(context, share_network)
|
||||||
return
|
return
|
||||||
super(NeutronBindNetworkPlugin, self)._save_neutron_network_data(
|
super(NeutronBindNetworkPlugin, self)._save_neutron_network_data(
|
||||||
context, share_network)
|
context, share_network)
|
||||||
|
|
||||||
|
def _save_neutron_network_mtu(self, context, share_network):
|
||||||
|
"""Store the Neutron network mtu.
|
||||||
|
|
||||||
|
In case of dynamic multi segments only the mtu needs storing before
|
||||||
|
binding the port.
|
||||||
|
"""
|
||||||
|
net_info = self.neutron_api.get_network(
|
||||||
|
share_network['neutron_net_id'])
|
||||||
|
|
||||||
|
mtu_dict = {
|
||||||
|
'mtu': net_info['mtu'],
|
||||||
|
}
|
||||||
|
share_network.update(mtu_dict)
|
||||||
|
|
||||||
|
if self.label != 'admin':
|
||||||
|
self.db.share_network_update(
|
||||||
|
context, share_network['id'], mtu_dict)
|
||||||
|
|
||||||
def allocate_network(self, context, share_server, share_network=None,
|
def allocate_network(self, context, share_server, share_network=None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
ports = super(NeutronBindNetworkPlugin, self).allocate_network(
|
ports = super(NeutronBindNetworkPlugin, self).allocate_network(
|
||||||
|
@ -166,7 +166,7 @@ fake_share_network_multi = {
|
|||||||
'ip_version': None,
|
'ip_version': None,
|
||||||
'cidr': 'fake_cidr',
|
'cidr': 'fake_cidr',
|
||||||
'gateway': 'fake_gateway',
|
'gateway': 'fake_gateway',
|
||||||
'mtu': fake_neutron_network_multi['mtu'],
|
'mtu': fake_neutron_network_multi['mtu'] - 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
fake_network_allocation_multi = {
|
fake_network_allocation_multi = {
|
||||||
@ -181,7 +181,7 @@ fake_network_allocation_multi = {
|
|||||||
'ip_version': fake_neutron_subnet['ip_version'],
|
'ip_version': fake_neutron_subnet['ip_version'],
|
||||||
'cidr': fake_neutron_subnet['cidr'],
|
'cidr': fake_neutron_subnet['cidr'],
|
||||||
'gateway': fake_neutron_subnet['gateway_ip'],
|
'gateway': fake_neutron_subnet['gateway_ip'],
|
||||||
'mtu': fake_share_network_multi['mtu'],
|
'mtu': fake_neutron_network_multi['mtu'],
|
||||||
}
|
}
|
||||||
|
|
||||||
fake_binding_profile = {
|
fake_binding_profile = {
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Update share networks with MTU before creating network allocations so that
|
||||||
|
the first allocation in a share network is correct.
|
Loading…
Reference in New Issue
Block a user