NeutronBindNetworkPlugin: fix multi segment mtu
Neutron mtu value for network allocation is taken from share network, so the share network needs to be updated with the mtu before the allocation is created. This prevents the mtu being empty on the first network allocation in a share network. Change-Id: I89de02af7d739bbe70f1d893cc2b6ced0157d120 Closes-Bug: #1822099
This commit is contained in:
parent
2609950d1e
commit
bc87926e60
@ -566,18 +566,37 @@ class NeutronBindNetworkPlugin(NeutronNetworkPlugin):
|
||||
|
||||
In case of dynamic multi segments the segment is determined while
|
||||
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
|
||||
then store network information (see allocate_network()).
|
||||
"""
|
||||
if self._is_neutron_multi_segment(share_network):
|
||||
# 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
|
||||
super(NeutronBindNetworkPlugin, self)._save_neutron_network_data(
|
||||
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,
|
||||
**kwargs):
|
||||
ports = super(NeutronBindNetworkPlugin, self).allocate_network(
|
||||
|
@ -166,7 +166,7 @@ fake_share_network_multi = {
|
||||
'ip_version': None,
|
||||
'cidr': 'fake_cidr',
|
||||
'gateway': 'fake_gateway',
|
||||
'mtu': fake_neutron_network_multi['mtu'],
|
||||
'mtu': fake_neutron_network_multi['mtu'] - 1,
|
||||
}
|
||||
|
||||
fake_network_allocation_multi = {
|
||||
@ -181,7 +181,7 @@ fake_network_allocation_multi = {
|
||||
'ip_version': fake_neutron_subnet['ip_version'],
|
||||
'cidr': fake_neutron_subnet['cidr'],
|
||||
'gateway': fake_neutron_subnet['gateway_ip'],
|
||||
'mtu': fake_share_network_multi['mtu'],
|
||||
'mtu': fake_neutron_network_multi['mtu'],
|
||||
}
|
||||
|
||||
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