From e44de1a8bf5cc2a8cccabc824f525de472831a3a Mon Sep 17 00:00:00 2001 From: Dong Jun Date: Tue, 18 Apr 2017 22:30:25 +0800 Subject: [PATCH] Correct SUPPORTED_RULES of QoS driver Type of supported_rules should be dict type instead of list, there will be an exception[1] when associating qos policy to port. This patch corrects SUPPORTED_RULES. This param type description in DriverBase() is incorrect and misleading, I submitted a patch in neutron to correct it as well. get_description is remnants of old QoS driver, get rid of it. [1]Callback neutron.services.qos.qos_plugin.QoSPlugin. _validate_update_port_callback--9223372036847773271 failed with "'list' object has no attribute 'get'" Change-Id: I74a3041cd38fdf8d0e17f35fce223393e198b563 --- networking_odl/qos/qos_driver_v2.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/networking_odl/qos/qos_driver_v2.py b/networking_odl/qos/qos_driver_v2.py index 37ae8f2e5..1ba03c5ee 100644 --- a/networking_odl/qos/qos_driver_v2.py +++ b/networking_odl/qos/qos_driver_v2.py @@ -12,6 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. +from neutron.common import constants as n_consts from neutron.services.qos.drivers import base from neutron.services.qos import qos_consts from neutron_lib.api.definitions import portbindings @@ -25,7 +26,15 @@ from networking_odl.qos import qos_utils LOG = logging.getLogger(__name__) # TODO(manjeets) fetch these from Neutron NB -SUPPORTED_RULES = [qos_consts.RULE_TYPE_BANDWIDTH_LIMIT] +# Only bandwidth limit is supported so far. +SUPPORTED_RULES = { + qos_consts.RULE_TYPE_BANDWIDTH_LIMIT: { + qos_consts.MAX_KBPS: { + 'type:range': [0, n_consts.DB_INTEGER_MAX_VALUE]}, + qos_consts.MAX_BURST: { + 'type:range': [0, n_consts.DB_INTEGER_MAX_VALUE]} + }, +} VIF_TYPES = [portbindings.VIF_TYPE_OVS, portbindings.VIF_TYPE_VHOST_USER] VNIC_TYPES = [portbindings.VNIC_NORMAL] @@ -53,10 +62,6 @@ class OpenDaylightQosDriver(base.DriverBase): LOG.debug("Initializing OpenDaylight Qos driver") self.journal = journal.OpendaylightJournalThread() - def get_description(self): - """Returns string description of driver""" - return "QoS ODL driver" - def _record_in_journal(self, context, op_const, qos_policy): data = qos_utils.convert_rules_format(qos_policy.to_dict()) journal.record(context, odl_const.ODL_QOS_POLICY,