Update of segmentation id for network don't works

Bug #1832985 reported by Slawek Kaplonski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Slawek Kaplonski

Bug Description

Update of segmentation ID for vlan networks was introduced by RFE: https://bugs.launchpad.net/neutron/+bug/1806052

When I'm trying to update segmentation_id of network now, I got internal server error return.

Steps to reproduce:

1. Create vlan network like:

[00:35:45] vagrant@devstack-centos-ovs:/opt/stack/tempest$ neutron net-show test-vlan
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | nova |
| created_at | 2019-06-13T22:17:10Z |
| description | test network |
| id | 34032aa4-f596-4a3e-8d00-7a2e03b0867a |
| ipv4_address_scope | |
| ipv6_address_scope | |
| mtu | 1500 |
| name | test-vlan |
| port_security_enabled | True |
| project_id | 889441eb7f234c9890ee8406045fdb87 |
| provider:network_type | vlan |
| provider:physical_network | public |
| provider:segmentation_id | 1000 |
| qos_policy_id | |
| revision_number | 2 |
| router:external | False |
| shared | False |
| status | ACTIVE |
| subnets | b00f977a-6f13-4906-b126-c173652f1973 |
| tags | |
| tenant_id | 889441eb7f234c9890ee8406045fdb87 |
| updated_at | 2019-06-13T22:22:40Z |
+---------------------------+--------------------------------------+

2. Try to update segmentation_id like:

[00:38:50] vagrant@devstack-centos-ovs:/opt/stack/tempest$ neutron net-update test-vlan --provider:segmentation_id 2000
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Request Failed: internal server error while processing your request.
Neutron server returns request_ids: ['req-2b8ebe5e-791a-497b-a5ec-24a3d6071f7d']

3. In neutron server logs I see error like:

cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation [None req-2b8ebe5e-791a-497b-a5ec-24a3d6071f7d demo admin] PUT failed.: AttributeError: 'Context' object has no attribute 'current'
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation Traceback (most recent call last):
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/pecan/core.py", line 683, in __call__
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation self.invoke_controller(controller, args, kwargs, state)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/pecan/core.py", line 574, in invoke_controller
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation result = controller(*args, **kwargs)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/neutron_lib/db/api.py", line 139, in wrapped
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation setattr(e, '_RETRY_EXCEEDED', True)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/neutron_lib/db/api.py", line 135, in wrapped
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation return f(*args, **kwargs)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_db/api.py", line 154, in wrapper
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation ectxt.value = e.inner_exc
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_db/api.py", line 142, in wrapper
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation return f(*args, **kwargs)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/neutron_lib/db/api.py", line 183, in wrapped
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation LOG.debug("Retry wrapper got retriable exception: %s", e)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/neutron_lib/db/api.py", line 179, in wrapped
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation return f(*dup_args, **dup_kwargs)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/pecan_wsgi/controllers/utils.py", line 76, in wrapped
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation return f(*args, **kwargs)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/pecan_wsgi/controllers/resource.py", line 70, in put
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation return {self.resource: self.plugin_updater(*updater_args)}
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/common/utils.py", line 681, in inner
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation return f(self, context, *args, **kwargs)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/neutron_lib/db/api.py", line 233, in wrapped
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation return method(*args, **kwargs)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/neutron_lib/db/api.py", line 139, in wrapped
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation setattr(e, '_RETRY_EXCEEDED', True)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/neutron_lib/db/api.py", line 135, in wrapped
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation return f(*args, **kwargs)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_db/api.py", line 154, in wrapper
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation ectxt.value = e.inner_exc
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_db/api.py", line 142, in wrapper
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation return f(*args, **kwargs)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/neutron_lib/db/api.py", line 183, in wrapped
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation LOG.debug("Retry wrapper got retriable exception: %s", e)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/neutron_lib/db/api.py", line 179, in wrapped
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation return f(*dup_args, **dup_kwargs)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/plugins/ml2/plugin.py", line 1082, in update_network
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation context, original_network, net_data)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/plugins/ml2/plugin.py", line 887, in _update_provider_network_attributes
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation self._update_segmentation_id(context, network, net_data)
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/plugins/ml2/plugin.py", line 850, in _update_segmentation_id
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation context, agent, segments[0]))
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py", line 137, in get_vif_type
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation if (context.current.get(portbindings.VNIC_TYPE) ==
cze 14 00:39:15 devstack-centos-ovs neutron-server[23663]: ERROR neutron.pecan_wsgi.hooks.translation AttributeError: 'Context' object has no attribute 'current'

Tags: api
Revision history for this message
Slawek Kaplonski (slaweq) wrote :

There is also second problem with updating segmentation_id.

In ML2 plugin, in https://github.com/openstack/neutron/blob/1654bc1179bb34b4a9729bf5b3fd65363e4cf872/neutron/plugins/ml2/plugin.py#L852 there is neutron_lib.objects.utils.NotIn filter class used but it don't works properly here as to get number of ports, Port object's method isn't used at all.
So this also should be fixed as currently there is warning like:

1292, u"Truncated incorrect DOUBLE value: 'ovs'"

and this is removed from filters. That makes update of segmentation id impossible if there is ANY port in network already created.

Changed in neutron:
status: New → Confirmed
Revision history for this message
Slawek Kaplonski (slaweq) wrote :

Initial issue described in this bug report, looks that is caused by https://review.opendev.org/#/c/658784/

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

Fix proposed to branch: master
Review: https://review.opendev.org/665548

Changed in neutron:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.opendev.org/665623

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to neutron (master)

Reviewed: https://review.opendev.org/665548
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=352f5ac674dde0d76ebe92d80b2cb02638b80ade
Submitter: Zuul
Branch: master

commit 352f5ac674dde0d76ebe92d80b2cb02638b80ade
Author: Slawek Kaplonski <email address hidden>
Date: Fri Jun 14 10:35:46 2019 +0200

    Fix update of network's segmentation id

    In patch [1] there was added usage of context parameter in method
    get_vif_type in openvswitch mech_driver.
    This exposed that previously "wrong" context was passed to this method
    in _update_segmentation_id() method in ml2 plugin and that caused
    raising AttributeError as "Context" object didn't have attribute
    'current'.

    This patch adds new method "get_supported_vif_type" to mechanism
    drivers and this method don't need context to return what vif_types
    are supported regarding agent type.

    [1] https://review.opendev.org/#/c/658784/

    Change-Id: Ic6c738db28208e5009f78bb52598eb3c141f639f
    Related-Bug: #1832985

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

Reviewed: https://review.opendev.org/665623
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=3367e2081bfd57030a3a3427eec630aa2f483d25
Submitter: Zuul
Branch: master

commit 3367e2081bfd57030a3a3427eec630aa2f483d25
Author: Slawek Kaplonski <email address hidden>
Date: Fri Jun 14 10:40:03 2019 +0200

    Fix update of network's segmentation id for network with ports

    Filter neutron_lib.objects.utils.NotIn, designed to work with OVO objects
    was used in db query and because of that ports belong to network wasn't
    filtered by vif_type thus if there were any ports in network, it was not
    possible to change its segmentation id.

    Change-Id: I6ad2047c310e111bffe0942af12af1f642963b18
    Closes-Bug: #1832985

Changed in neutron:
status: In Progress → Fix Released
tags: added: neutron-proactive-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 15.0.0.0b1

This issue was fixed in the openstack/neutron 15.0.0.0b1 development milestone.

tags: removed: neutron-proactive-backport-potential
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.