[OVN]Updating a QoS policy for a port will cause a KeyEerror

Bug #1862893 reported by zhanghao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
In Progress
Low
zhanghao

Bug Description

Reproduce this bug:
1.create a port with no qos policy.
2.update this port with a qos policy.

Since 'qos_options' does not have the 'direction' key, this bug is caused.

Tags: ovn qos
zhanghao (zhanghao2)
Changed in neutron:
assignee: nobody → zhanghao (zhanghao2)
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/707352

Changed in neutron:
status: New → In Progress
Akihiro Motoki (amotoki)
tags: added: ovn qos
Changed in neutron:
importance: Undecided → Low
Revision history for this message
Bence Romsics (bence-romsics) wrote :
Download full text (4.1 KiB)

What are the exact commands to reproduce this bug?

As I read _create_qos_rules() I'm quite sure there is a problem here, but I can't seem to find how to reproduce it.

This succeeds for me:
openstack network qos policy create qp0
openstack network qos rule create --type bandwidth-limit --max-kbps 1000 qp0
openstack port create port0 --network private
openstack port set port0 --qos-policy qp0

And this too:
openstack network qos policy create qp0
openstack port create port0 --network private
openstack port set port0 --qos-policy qp0

On the other hand I found this to fail:
openstack network qos policy create qp0
openstack network qos rule create --type bandwidth-limit --max-kbps 1000 qp0
openstack port create port0 --network private --qos-policy qp0

But this one fails with KeyError: 'qos_burst':
febr 12 16:28:08 devstack0 neutron-server[8429]: ERROR neutron.plugins.ml2.managers [None req-4c0f75c2-b509-43db-af4b-49c072229a67 admin admin] Mechanism driver 'ovn' failed in create_port_postcommit: KeyError: 'qos_burst'
febr 12 16:28:08 devstack0 neutron-server[8429]: ERROR neutron.plugins.ml2.managers Traceback (most recent call last):
febr 12 16:28:08 devstack0 neutron-server[8429]: ERROR neutron.plugins.ml2.managers File "/opt/stack/neutron/neutron/plugins/ml2/managers.py", line 475, in _call_on_drivers
febr 12 16:28:08 devstack0 neutron-server[8429]: ERROR neutron.plugins.ml2.managers getattr(driver.obj, method_name)(context)
febr 12 16:28:08 devstack0 neutron-server[8429]: ERROR neutron.plugins.ml2.managers File "/opt/stack/neutron/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py", line 530, in create_port_postcommit
febr 12 16:28:08 devstack0 neutron-server[8429]: ERROR neutron.plugins.ml2.managers self._ovn_client.create_port(port)
febr 12 16:28:08 devstack0 neutron-server[8429]: ERROR neutron.plugins.ml2.managers File "/opt/stack/neutron/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py", line 418, in create_port
febr 12 16:28:08 devstack0 neutron-server[8429]: ERROR neutron.plugins.ml2.managers port, lswitch_name)
febr 12 16:28:08 devstack0 neutron-server[8429]: ERROR neutron.plugins.ml2.managers File "/opt/stack/neutron/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py", line 718, in _create_qos_rules
febr 12 16:28:08 devstack0 neutron-server[8429]: ERROR neutron.plugins.ml2.managers burst=int(qos_options['qos_burst']),
febr 12 16:28:08 devstack0 neutron-server[8429]: ERROR neutron.plugins.ml2.managers KeyError: 'qos_burst'

Reading the relevant code...
https://opendev.org/openstack/neutron/src/commit/a026b39617f4c2d29f2903909fb65f7adb327fa7/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py#L701-L729
https://opendev.org/openstack/neutron/src/commit/a026b39617f4c2d29f2903909fb65f7adb327fa7/neutron/services/qos/drivers/ovn/driver.py#L117-L136
https://opendev.org/openstack/neutron/src/commit/a026b39617f4c2d29f2903909fb65f7adb327fa7/neutron/services/qos/drivers/ovn/driver.py#L97-L115
https://open...

Read more...

Revision history for this message
zhanghao (zhanghao2) wrote :

Hi Bence, you need to specify both 'max-kbps' and 'max-burst-kbps' to see the KeyError caused by the direction. The problem you reported also exists.

Revision history for this message
Akihiro Motoki (amotoki) wrote :

zhanghao, why don't you provide the exact command line? Bence requested the exact command line, but you just tried to explain it. If you provide the exact command-line, the situation would be much simpler and Bence did not need to explore possible cases. Next time you file a bug, I would strongly suggest to provide the exact way to reproduce the bug (for example with command-line examples).

Revision history for this message
Bence Romsics (bence-romsics) wrote :

Hi zhanghao,

This one also succeeds for me:

openstack network qos policy create qp0
openstack network qos rule create --type bandwidth-limit --max-kbps 1000 --max-burst-kbits 800 qp0
openstack port create port0 --network private
openstack port set port0 --qos-policy qp0

I fully believe this bug exists, however I still don't know how to reproduce it from the command line.

Revision history for this message
Bence Romsics (bence-romsics) wrote :

For my previous comment about "OVO defaulted fields may not be present": I realized that we call .obj_set_defaults() in NeutronObject.__init__(), therefore the rule's OVO is going to always have the defaulted fields. Please ignore that part of comment #2.

Revision history for this message
zhanghao (zhanghao2) wrote :

Hi Bence, I I execute the same command lines as you.

The command lines do not prompt errors, check your neutron-server log,and if your network has a qos policy.

this is my neutron-server.log:
2020-02-19 22:00:18.490 32226 ERROR neutron.plugins.ml2.managers Traceback (most recent call last):
2020-02-19 22:00:18.490 32226 ERROR neutron.plugins.ml2.managers File "/usr/lib/python2.7/site-packages/neutron/plugins/ml2/managers.py", line 426, in _call_on_drivers
2020-02-19 22:00:18.490 32226 ERROR neutron.plugins.ml2.managers getattr(driver.obj, method_name)(context)
2020-02-19 22:00:18.490 32226 ERROR neutron.plugins.ml2.managers File "/usr/lib/python2.7/site-packages/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py", line 604, in update_port_postcommit
2020-02-19 22:00:18.490 32226 ERROR neutron.plugins.ml2.managers self._ovn_client.update_port(port, port_object=original_port)
2020-02-19 22:00:18.490 32226 ERROR neutron.plugins.ml2.managers File "/usr/lib/python2.7/site-packages/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py", line 674, in update_port
2020-02-19 22:00:18.490 32226 ERROR neutron.plugins.ml2.managers if_delete=True)
2020-02-19 22:00:18.490 32226 ERROR neutron.plugins.ml2.managers File "/usr/lib/python2.7/site-packages/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py", line 711, in _create_qos_rules
2020-02-19 22:00:18.490 32226 ERROR neutron.plugins.ml2.managers direction = 'from-lport' if qos_options['direction'] ==\
2020-02-19 22:00:18.490 32226 ERROR neutron.plugins.ml2.managers KeyError: 'direction'

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by "Rodolfo Alonso <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/707352
Reason: Superseded by https://review.opendev.org/c/openstack/neutron/+/711317

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.