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
... it is clear that _create_qos_rules() should be more careful with what's in qos_options since according to the OVO definition max_kbps and max_burst_kbps are optional.
(Side question: What is a bandwidth limit rule without max_kbps?!)
To my understanding of OVO even the defaulted fields may not be present unless we call .obj_set_defaults() on the rule object.
So _create_qos_rules should not make these assumptions:
* that qos_options['direction'] exists, line 704
* that qos_options['qos_burst'] exists, line 718
For qos_options['direction'] alternatively we may do something like this (did not test this yet) since this would make the defaulted rule fields actually present for all users of qos rule objects:
neutron/objects/qos/rule.py
class QosRule(base.NeutronDbObject):
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': server[ 8429]: ERROR neutron. plugins. ml2.managers [None req-4c0f75c2- b509-43db- af4b-49c072229a 67 admin admin] Mechanism driver 'ovn' failed in create_ port_postcommit : KeyError: 'qos_burst' server[ 8429]: ERROR neutron. plugins. ml2.managers Traceback (most recent call last): server[ 8429]: ERROR neutron. plugins. ml2.managers File "/opt/stack/ neutron/ neutron/ plugins/ ml2/managers. py", line 475, in _call_on_drivers server[ 8429]: ERROR neutron. plugins. ml2.managers getattr(driver.obj, method_ name)(context) 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 server[ 8429]: ERROR neutron. plugins. ml2.managers self._ovn_ client. create_ port(port) 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 server[ 8429]: ERROR neutron. plugins. ml2.managers port, lswitch_name) 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 server[ 8429]: ERROR neutron. plugins. ml2.managers burst=int( qos_options[ 'qos_burst' ]), server[ 8429]: ERROR neutron. plugins. ml2.managers KeyError: 'qos_burst'
febr 12 16:28:08 devstack0 neutron-
febr 12 16:28:08 devstack0 neutron-
febr 12 16:28:08 devstack0 neutron-
febr 12 16:28:08 devstack0 neutron-
febr 12 16:28:08 devstack0 neutron-
febr 12 16:28:08 devstack0 neutron-
febr 12 16:28:08 devstack0 neutron-
febr 12 16:28:08 devstack0 neutron-
febr 12 16:28:08 devstack0 neutron-
febr 12 16:28:08 devstack0 neutron-
febr 12 16:28:08 devstack0 neutron-
Reading the relevant code... /opendev. org/openstack/ neutron/ src/commit/ a026b39617f4c2d 29f2903909fb65f 7adb327fa7/ neutron/ plugins/ ml2/drivers/ ovn/mech_ driver/ ovsdb/ovn_ client. py#L701- L729 /opendev. org/openstack/ neutron/ src/commit/ a026b39617f4c2d 29f2903909fb65f 7adb327fa7/ neutron/ services/ qos/drivers/ ovn/driver. py#L117- L136 /opendev. org/openstack/ neutron/ src/commit/ a026b39617f4c2d 29f2903909fb65f 7adb327fa7/ neutron/ services/ qos/drivers/ ovn/driver. py#L97- L115 /opendev. org/openstack/ neutron/ src/commit/ a026b39617f4c2d 29f2903909fb65f 7adb327fa7/ neutron/ objects/ qos/rule. py#L127- L141
https:/
https:/
https:/
https:/
... it is clear that _create_qos_rules() should be more careful with what's in qos_options since according to the OVO definition max_kbps and max_burst_kbps are optional.
(Side question: What is a bandwidth limit rule without max_kbps?!)
To my understanding of OVO even the defaulted fields may not be present unless we call .obj_set_defaults() on the rule object.
So _create_qos_rules should not make these assumptions:
* that qos_options[ 'direction' ] exists, line 704 'qos_burst' ] exists, line 718
* that qos_options[
For qos_options[ 'direction' ] alternatively we may do something like this (did not test this yet) since this would make the defaulted rule fields actually present for all users of qos rule objects:
neutron/ objects/ qos/rule. py base.NeutronDbO bject):
class QosRule(
+ def obj_load_attr(self, attrname): set_defaults( attrname)
+ self.obj_