From ff0a4445267da908376d14d1b4fa398f2ecfb2b8 Mon Sep 17 00:00:00 2001 From: Lajos Katona Date: Fri, 1 Mar 2019 14:39:13 +0100 Subject: [PATCH] Fix QoS rule update QoS rule (QosBandwidthLimitRule and QosMinimumBandwidthRule) update now expects to have direction field in the API request for checking for duplicates. This patch changes this by using the rule fetched from the policy and the update will work on that rule object instead of a newly created object which for minimum_bandwidth rule has no default direction, which causes the update to fail. Change-Id: Ib8f95bf14193a50f22102668bed9208a93d1caba Closes-Bug: #1815618 (cherry picked from commit c1999a2b2268a4f5477247974363e31cb54e0e6b) --- neutron/services/qos/qos_plugin.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/neutron/services/qos/qos_plugin.py b/neutron/services/qos/qos_plugin.py index 6dc56aab39b..5ed9aef24ba 100644 --- a/neutron/services/qos/qos_plugin.py +++ b/neutron/services/qos/qos_plugin.py @@ -354,8 +354,7 @@ class QoSPlugin(qos.QoSPluginBase): policy = self._get_policy_obj(context, policy_id) # Ensure the rule belongs to the policy. checker.check_bandwidth_rule_conflict(policy, rule_data) - policy.get_rule_by_id(rule_id) - rule = rule_cls(context, id=rule_id) + rule = policy.get_rule_by_id(rule_id) rule.update_fields(rule_data, reset_changes=True) checker.check_rules_conflict(policy, rule) rule.update()