← Back to team overview

yahoo-eng-team team mailing list archive

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

 

Public bug reported:

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.

** Affects: neutron
     Importance: Undecided
     Assignee: Thomas Bachman (bachman)
         Status: In Progress

-- 
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:
  In Progress

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


Follow ups