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
This commit is contained in:
Dong Jun
2017-04-18 22:30:25 +08:00
parent 9c0129f1c8
commit e44de1a8bf

View File

@@ -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,