Switch to new engine facade for QoS

* QosCoreResourceExtension
* QoSPlugin

Partially-Implements blueprint: enginefacade-switch

Change-Id: I034cad8d5290b416e55acdaeea69c5a130308afe
This commit is contained in:
Rodolfo Alonso Hernandez 2019-05-28 08:11:35 +00:00
parent c3a05cc129
commit 51dd91df5b
2 changed files with 6 additions and 6 deletions

View File

@ -88,7 +88,7 @@ class QosCoreResourceExtension(base.CoreResourceExtension):
network[qos_consts.QOS_POLICY_ID] = qos_policy_id network[qos_consts.QOS_POLICY_ID] = qos_policy_id
def _exec(self, method_name, context, kwargs): def _exec(self, method_name, context, kwargs):
with db_api.autonested_transaction(context.session): with db_api.CONTEXT_WRITER.using(context):
return getattr(self, method_name)(context=context, **kwargs) return getattr(self, method_name)(context=context, **kwargs)
def process_fields(self, context, resource_type, event_type, def process_fields(self, context, resource_type, event_type,

View File

@ -408,7 +408,7 @@ class QoSPlugin(qos.QoSPluginBase):
rule_type = rule_cls.rule_type rule_type = rule_cls.rule_type
rule_data = rule_data[rule_type + '_rule'] rule_data = rule_data[rule_type + '_rule']
with db_api.autonested_transaction(context.session): with db_api.CONTEXT_WRITER.using(context):
# Ensure that we have access to the policy. # Ensure that we have access to the policy.
policy = policy_object.QosPolicy.get_policy_obj(context, policy_id) policy = policy_object.QosPolicy.get_policy_obj(context, policy_id)
checker.check_bandwidth_rule_conflict(policy, rule_data) checker.check_bandwidth_rule_conflict(policy, rule_data)
@ -447,7 +447,7 @@ class QoSPlugin(qos.QoSPluginBase):
rule_type = rule_cls.rule_type rule_type = rule_cls.rule_type
rule_data = rule_data[rule_type + '_rule'] rule_data = rule_data[rule_type + '_rule']
with db_api.autonested_transaction(context.session): with db_api.CONTEXT_WRITER.using(context):
# Ensure we have access to the policy. # Ensure we have access to the policy.
policy = policy_object.QosPolicy.get_policy_obj(context, policy_id) policy = policy_object.QosPolicy.get_policy_obj(context, policy_id)
# Ensure the rule belongs to the policy. # Ensure the rule belongs to the policy.
@ -512,7 +512,7 @@ class QoSPlugin(qos.QoSPluginBase):
:returns: None :returns: None
""" """
with db_api.autonested_transaction(context.session): with db_api.CONTEXT_WRITER.using(context):
# Ensure we have access to the policy. # Ensure we have access to the policy.
policy = policy_object.QosPolicy.get_policy_obj(context, policy_id) policy = policy_object.QosPolicy.get_policy_obj(context, policy_id)
rule = policy.get_rule_by_id(rule_id) rule = policy.get_rule_by_id(rule_id)
@ -561,7 +561,7 @@ class QoSPlugin(qos.QoSPluginBase):
:returns: a QoS policy rule object :returns: a QoS policy rule object
:raises: qos_exc.QosRuleNotFound :raises: qos_exc.QosRuleNotFound
""" """
with db_api.autonested_transaction(context.session): with db_api.CONTEXT_READER.using(context):
# Ensure we have access to the policy. # Ensure we have access to the policy.
policy_object.QosPolicy.get_policy_obj(context, policy_id) policy_object.QosPolicy.get_policy_obj(context, policy_id)
rule = rule_cls.get_object(context, id=rule_id) rule = rule_cls.get_object(context, id=rule_id)
@ -604,7 +604,7 @@ class QoSPlugin(qos.QoSPluginBase):
:returns: QoS policy rule objects meeting the search criteria :returns: QoS policy rule objects meeting the search criteria
""" """
with db_api.autonested_transaction(context.session): with db_api.CONTEXT_READER.using(context):
# Ensure we have access to the policy. # Ensure we have access to the policy.
policy_object.QosPolicy.get_policy_obj(context, policy_id) policy_object.QosPolicy.get_policy_obj(context, policy_id)
filters = filters or dict() filters = filters or dict()