← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1896933] Re: Exception when plugin creates a network without specifying the MTU

 

Reviewed:  https://review.opendev.org/c/openstack/neutron/+/753717
Committed: https://opendev.org/openstack/neutron/commit/f759915ab0c30ebba6d3d970943b596b5c245599
Submitter: "Zuul (22348)"
Branch:    master

commit f759915ab0c30ebba6d3d970943b596b5c245599
Author: Thomas Bachman <tbachman@xxxxxxxxx>
Date:   Wed Sep 23 14:34:36 2020 +0000

    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


** Changed in: neutron
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1896933

Title:
  Exception when plugin creates a network without specifying the MTU

Status in neutron:
  Fix Released

Bug description:
  This was found as a UT regression failure in the x/group-based-policy
  project, but I think the same issue applies to the auto-allocated-
  topology workflow (or any feature that creates a network at the plugin
  or DB layer instead of at the REST layer). The exception seen is this:

    File "/home/zuul/src/opendev.org/x/group-based-policy/.tox/py36/lib/python3.6/site-packages/neutron/plugins/ml2/plugin.py", line 1053, in create_network
      result, mech_context = self._create_network_db(context, network)
    File "/home/zuul/src/opendev.org/x/group-based-policy/gbpservice/neutron/plugins/ml2plus/plugin.py", line 333, in _create_network_db
      context, network)
    File "/home/zuul/src/opendev.org/x/group-based-policy/.tox/py36/lib/python3.6/site-packages/neutron/plugins/ml2/plugin.py", line 1013, in _create_network_db
      net_db.mtu = self._get_network_mtu(net_db)
    File "/home/zuul/src/opendev.org/x/group-based-policy/.tox/py36/lib/python3.6/site-packages/neutron/plugins/ml2/plugin.py", line 995, in _get_network_mtu
      raise exc.InvalidInput(error_message=msg)
  neutron_lib.exceptions.InvalidInput: Invalid input for operation: Requested MTU is too big, maximum is 1000.

  The UT limits the network MTU using configuration file settings:
  https://opendev.org/x/group-based-policy/src/branch/master/gbpservice/neutron/tests/unit/services/grouppolicy/test_aim_mapping_driver.py#L2951-L2952

  The regression happens because a default MTU for the DB layer was
  introduced in this patch: https://review.opendev.org/#/c/679399/

  The default value used is the DEFAULT_NETWORK_MTU constant from
  neutron-lib (1500). This is different than the default value installed
  by the REST layer (0). When the network MTU is constrained using
  configuration files, it gets to this code path:

  https://opendev.org/openstack/neutron/src/branch/master/neutron/plugins/ml2/plugin.py#L992-L1002

  Since the DB layer has set the default to 1500 instead of 0, this
  exception gets triggered, even though the caller at the plugin layer
  didn't specify a value for the MTU.

  One possible fix is to have the DB layer use a value of 0 for the
  default instead of DEFAULT_NETWORK_MTU.

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1896933/+subscriptions



References