Fix default value for MTUs, when not provided

When networks are created using REST APIs, if the MTU isn't specified
in the request, then a default value of 0 is used. Some use cases, such
as the auto-allocated-topology workflow, call the plugin directly to
create networks, bypassing the layer that inserts this default value.
Commit 68625686a4 introduced a different
default value at the DB layer, defined by a constant in neutron-lib.
If the maximum MTU size has been configured lower than this constant,
then the user receives an exception, even though they didn't provide
a value for MTU.

This patch changes the default value used in the DB layer, so that
it's consistent with the workflow seen via REST APIs.

Change-Id: Ica21e891cd2559942abb0ab2b12132e7f6cdd835
Closes-Bug: #1896933
This commit is contained in:
Thomas Bachman 2020-09-23 14:34:36 +00:00 committed by Rodolfo Alonso
parent c9708e692f
commit f759915ab0
1 changed files with 1 additions and 1 deletions

View File

@ -409,7 +409,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
args = {'tenant_id': project_id,
'id': n.get('id') or uuidutils.generate_uuid(),
'name': n['name'],
'mtu': n.get('mtu', constants.DEFAULT_NETWORK_MTU),
'mtu': n.get('mtu', 0),
'admin_state_up': n['admin_state_up'],
'status': n.get('status', constants.NET_STATUS_ACTIVE),
'description': n.get('description')}