'Update a QoS policy.
:param context: neutron api request context
:type context: neutron.context.Context
:param policy_id: the id of the QosPolicy to update
:param policy_id: str uuid
:param policy: new policy data to be applied
:type policy: dict
:returns: a QosPolicy object'

@db_base_plugin_common.convert_result_to_dict
def update_policy(self, context, policy_id, policy):

    policy_data = policy['policy']
    with db_api.context_manager.writer.using(context):
        policy_obj = self._get_policy_obj(context, policy_id)
        policy_obj.update_fields(policy_data, reset_changes=True)
        policy_obj.update()
        self.driver_manager.call(qos_consts.UPDATE_POLICY_PRECOMMIT, context, policy_obj)
    self.driver_manager.call(qos_consts.UPDATE_POLICY, context, policy_obj)
    return policy_obj
