From f759915ab0c30ebba6d3d970943b596b5c245599 Mon Sep 17 00:00:00 2001 From: Thomas Bachman Date: Wed, 23 Sep 2020 14:34:36 +0000 Subject: [PATCH] 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 68625686a40b3eb75502c8116f23d2297e288ca1 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 --- neutron/db/db_base_plugin_v2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neutron/db/db_base_plugin_v2.py b/neutron/db/db_base_plugin_v2.py index 7fd2e37d978..ca430b2cd57 100644 --- a/neutron/db/db_base_plugin_v2.py +++ b/neutron/db/db_base_plugin_v2.py @@ -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')}