diff --git a/vmware_nsx/services/qos/nsx_v3/utils.py b/vmware_nsx/services/qos/nsx_v3/utils.py index 18ec4f7a8f..1b950f9d37 100644 --- a/vmware_nsx/services/qos/nsx_v3/utils.py +++ b/vmware_nsx/services/qos/nsx_v3/utils.py @@ -15,7 +15,6 @@ # under the License. from neutron.api.rpc.callbacks import events as callbacks_events -from neutron import context as n_context from neutron.objects.qos import policy as qos_policy from neutron.services.qos import qos_consts from neutron_lib.api import validators @@ -38,16 +37,16 @@ MAX_BURST_MAX_VALUE = int((2 ** 31 - 1) / 128) def handle_qos_notification(context, resource_type, policies_list, event_type): for policy_obj in policies_list: - handle_qos_policy_notification(policy_obj, event_type) + handle_qos_policy_notification(context, policy_obj, event_type) -def handle_qos_policy_notification(policy_obj, event_type): +def handle_qos_policy_notification(context, policy_obj, event_type): handler = QosNotificationsHandler() - context = n_context.get_admin_context() # Reload the policy as admin so we will have a context if (event_type != callbacks_events.DELETED): - policy = qos_policy.QosPolicy.get_object(context, id=policy_obj.id) + policy = qos_policy.QosPolicy.get_object(context.elevated(), + id=policy_obj.id) # Check if QoS policy rule was created/deleted/updated if (event_type == callbacks_events.CREATED):