Create vlan network will get 500 error when enable network_segment_range service plugin

Bug #1914842 reported by yangjianfeng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Rodolfo Alonso

Bug Description

version: stable/ussuri
Confiure neutron to enable network_segment_range and support vlan tenant vlan

The execute the cmd below:
openstack network create test-vlan02 --provider-network-type vlan

The error I got:
Error while executing command: HttpException: 500, Request Failed: internal server error while processing your request.

Check neutron-server log file, the error info like below:
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation [req-47fa7919-8b0c-4a7e-934b-a9dc7945070f fa92f1c6cea54f59bc5c08538db58082 73153acfd693497bb76f6b6d5d9a40ee - default default] POST failed.: KeyError: 'physical_network'
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation Traceback (most recent call last):
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/pecan/core.py", line 683, in __call__
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation self.invoke_controller(controller, args, kwargs, state)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/pecan/core.py", line 574, in invoke_controller
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation result = controller(*args, **kwargs)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron_lib/db/api.py", line 139, in wrapped
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation setattr(e, '_RETRY_EXCEEDED', True)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 220, in __exit__
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/six.py", line 703, in reraise
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation raise value
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron_lib/db/api.py", line 135, in wrapped
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation return f(*args, **kwargs)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/oslo_db/api.py", line 154, in wrapper
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation ectxt.value = e.inner_exc
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 220, in __exit__
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/six.py", line 703, in reraise
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation raise value
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/oslo_db/api.py", line 142, in wrapper
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation return f(*args, **kwargs)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron_lib/db/api.py", line 183, in wrapped
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation LOG.debug("Retry wrapper got retriable exception: %s", e)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 220, in __exit__
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/six.py", line 703, in reraise
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation raise value
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron_lib/db/api.py", line 179, in wrapped
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation return f(*dup_args, **dup_kwargs)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron/pecan_wsgi/controllers/utils.py", line 76, in wrapped
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation return f(*args, **kwargs)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron/pecan_wsgi/controllers/resource.py", line 163, in post
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation return self.create(resources)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron/pecan_wsgi/controllers/resource.py", line 181, in create
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation return {key: creator(*creator_args, **creator_kwargs)}
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron/common/utils.py", line 687, in inner
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation return f(self, context, *args, **kwargs)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron_lib/db/api.py", line 233, in wrapped
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation return method(*args, **kwargs)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron_lib/db/api.py", line 139, in wrapped
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation setattr(e, '_RETRY_EXCEEDED', True)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 220, in __exit__
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/six.py", line 703, in reraise
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation raise value
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron_lib/db/api.py", line 135, in wrapped
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation return f(*args, **kwargs)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/oslo_db/api.py", line 154, in wrapper
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation ectxt.value = e.inner_exc
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 220, in __exit__
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/six.py", line 703, in reraise
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation raise value
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/oslo_db/api.py", line 142, in wrapper
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation return f(*args, **kwargs)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron_lib/db/api.py", line 183, in wrapped
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation LOG.debug("Retry wrapper got retriable exception: %s", e)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 220, in __exit__
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/six.py", line 703, in reraise
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation raise value
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron_lib/db/api.py", line 179, in wrapped
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation return f(*dup_args, **dup_kwargs)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron/plugins/ml2/plugin.py", line 1053, in create_network
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation result, mech_context = self._create_network_db(context, network)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron/plugins/ml2/plugin.py", line 1012, in _create_network_db
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation tenant_id)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron/plugins/ml2/managers.py", line 216, in create_network_segments
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation context, segment, filters=filters)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron/plugins/ml2/managers.py", line 301, in reserve_provider_segment
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation segment, filters)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron/plugins/ml2/drivers/type_vlan.py", line 276, in reserve_provider_segment
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation context, **filters)
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron/plugins/ml2/drivers/helpers.py", line 144, in allocate_partially_specified_segment
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation allocations = call()
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python3.6/site-packages/neutron/objects/network_segment_range.py", line 196, in get_segments_shared
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation _filters['physical_network'])
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation KeyError: 'physical_network'
2021-02-06 10:45:12.944 25 ERROR neutron.pecan_wsgi.hooks.translation

Changed in neutron:
assignee: nobody → Rodolfo Alonso (rodolfo-alonso-hernandez)
Revision history for this message
Rodolfo Alonso (rodolfo-alonso-hernandez) wrote :

Hello yangjianfeng:

1) When "network_segment_range" service plugin is required, you need to specify the provider physical network:

  $ openstack network create --provider-network-type vlan --provider-physical-network physnet2 net10

2) The code do not report correctly the wrong input. In case the physical network is not provided and the network type is VLAN, the server should not hit this code path. I'll push a patch to fix that.

In any case, you can skip this error providing the correct input in the network creation parameter.

Regards.

Revision history for this message
Rodolfo Alonso (rodolfo-alonso-hernandez) wrote :
Revision history for this message
yangjianfeng (yangjianfeng) wrote :

Hi rodolfo:
I don't think this is a good solution. The "provider-physical-network" is not required when "network_segment_range" service plugin is not enable. The patch [1] will result in incompatibility. I commit another patch [2] to fix this bug.

[1] https://review.opendev.org/c/openstack/neutron/+/774521
[2] https://review.opendev.org/c/openstack/neutron/+/774375

Revision history for this message
Rodolfo Alonso (rodolfo-alonso-hernandez) wrote :

Hello yangjianfeng:

Please check [1]. There we are enforcing "provider-physical-network" only when the plugin is enabled. So the patch is valid.

However, your patch is valid too and there is not need to enforce this parameter.

Regards.

[1]https://review.opendev.org/c/openstack/neutron/+/774521

Changed in neutron:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

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

commit fa7c7282f019d3e0dd4d492f5ff2c47bd45b0ce7
Author: yangjianfeng <email address hidden>
Date: Sun Feb 7 09:59:07 2021 +0000

    Make phynet paramter also is optional when network_segment_range enabled

    When network_segment_range plugin is not enabled, we can create a provider
    network without physical_network parameter. In order to compatibility,
    We should support to not provide physical_network parameter when create
    provider network with network_segment_range plugin enabled.

    Closes-Bug: #1914842
    Change-Id: If19a6a9b0f2910baefba9d7ea9955b1f0ad7d252

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/wallaby)

Fix proposed to branch: stable/wallaby
Review: https://review.opendev.org/c/openstack/neutron/+/795277

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/victoria)

Fix proposed to branch: stable/victoria
Review: https://review.opendev.org/c/openstack/neutron/+/795278

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/ussuri)

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/c/openstack/neutron/+/795279

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/train)

Fix proposed to branch: stable/train
Review: https://review.opendev.org/c/openstack/neutron/+/795280

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/wallaby)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/795277
Committed: https://opendev.org/openstack/neutron/commit/9c9ffea8d5fab316d2c2a0bb800aa8b9acc10a6e
Submitter: "Zuul (22348)"
Branch: stable/wallaby

commit 9c9ffea8d5fab316d2c2a0bb800aa8b9acc10a6e
Author: yangjianfeng <email address hidden>
Date: Sun Feb 7 09:59:07 2021 +0000

    Make phynet paramter also is optional when network_segment_range enabled

    When network_segment_range plugin is not enabled, we can create a provider
    network without physical_network parameter. In order to compatibility,
    We should support to not provide physical_network parameter when create
    provider network with network_segment_range plugin enabled.

    Closes-Bug: #1914842
    Change-Id: If19a6a9b0f2910baefba9d7ea9955b1f0ad7d252
    (cherry picked from commit fa7c7282f019d3e0dd4d492f5ff2c47bd45b0ce7)

tags: added: in-stable-wallaby
tags: added: neutron-proactive-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/victoria)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/795278
Committed: https://opendev.org/openstack/neutron/commit/29857aa6b08359ca76444b601e526c2217c7014a
Submitter: "Zuul (22348)"
Branch: stable/victoria

commit 29857aa6b08359ca76444b601e526c2217c7014a
Author: yangjianfeng <email address hidden>
Date: Sun Feb 7 09:59:07 2021 +0000

    Make phynet paramter also is optional when network_segment_range enabled

    When network_segment_range plugin is not enabled, we can create a provider
    network without physical_network parameter. In order to compatibility,
    We should support to not provide physical_network parameter when create
    provider network with network_segment_range plugin enabled.

    Closes-Bug: #1914842
    Change-Id: If19a6a9b0f2910baefba9d7ea9955b1f0ad7d252
    (cherry picked from commit fa7c7282f019d3e0dd4d492f5ff2c47bd45b0ce7)

tags: added: in-stable-victoria
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/train)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/795280
Committed: https://opendev.org/openstack/neutron/commit/4dc65804ae760d7cf05a65e50b63b337ac9151e5
Submitter: "Zuul (22348)"
Branch: stable/train

commit 4dc65804ae760d7cf05a65e50b63b337ac9151e5
Author: yangjianfeng <email address hidden>
Date: Sun Feb 7 09:59:07 2021 +0000

    Make phynet paramter also is optional when network_segment_range enabled

    When network_segment_range plugin is not enabled, we can create a provider
    network without physical_network parameter. In order to compatibility,
    We should support to not provide physical_network parameter when create
    provider network with network_segment_range plugin enabled.

    Closes-Bug: #1914842
    Change-Id: If19a6a9b0f2910baefba9d7ea9955b1f0ad7d252
    (cherry picked from commit fa7c7282f019d3e0dd4d492f5ff2c47bd45b0ce7)

tags: added: in-stable-train
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/ussuri)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/795279
Committed: https://opendev.org/openstack/neutron/commit/d27421d5823a525af654b640df06214d4c0c74a8
Submitter: "Zuul (22348)"
Branch: stable/ussuri

commit d27421d5823a525af654b640df06214d4c0c74a8
Author: yangjianfeng <email address hidden>
Date: Sun Feb 7 09:59:07 2021 +0000

    Make phynet paramter also is optional when network_segment_range enabled

    When network_segment_range plugin is not enabled, we can create a provider
    network without physical_network parameter. In order to compatibility,
    We should support to not provide physical_network parameter when create
    provider network with network_segment_range plugin enabled.

    Closes-Bug: #1914842
    Change-Id: If19a6a9b0f2910baefba9d7ea9955b1f0ad7d252
    (cherry picked from commit fa7c7282f019d3e0dd4d492f5ff2c47bd45b0ce7)

tags: added: in-stable-ussuri
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 16.4.0

This issue was fixed in the openstack/neutron 16.4.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 17.2.0

This issue was fixed in the openstack/neutron 17.2.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 18.1.0

This issue was fixed in the openstack/neutron 18.1.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 19.0.0.0rc1

This issue was fixed in the openstack/neutron 19.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron train-eol

This issue was fixed in the openstack/neutron train-eol release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.