From 9cb31b1e2595a25b5ca1eb47bdb44e52b28e0f82 Mon Sep 17 00:00:00 2001 From: Ann Kamyshnikova Date: Thu, 10 Nov 2016 12:57:24 +0300 Subject: [PATCH] Use new enginefacade for servicetype_db Use reader and writer for db operations with servicetype. Partially-Implements blueprint: enginefacade-switch Change-Id: I7cf29890d4d498c241a7c6e99edfbfc258b8cb60 --- neutron/db/servicetype_db.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/neutron/db/servicetype_db.py b/neutron/db/servicetype_db.py index d873d49f102..d378ea856ef 100644 --- a/neutron/db/servicetype_db.py +++ b/neutron/db/servicetype_db.py @@ -18,6 +18,7 @@ from itertools import chain from oslo_log import log as logging from neutron.common import _deprecate +from neutron.db import api as db_api from neutron.db.models import servicetype as st_model from neutron.services import provider_configuration as pconf @@ -86,7 +87,7 @@ class ServiceTypeManager(object): raise pconf.ServiceProviderNotFound(provider=provider_name, service_type=service_type) - with context.session.begin(subtransactions=True): + with db_api.context_manager.writer.using(context): # we don't actually need service type for association. # resource_id is unique and belongs to specific service # which knows its type @@ -105,7 +106,7 @@ class ServiceTypeManager(object): def del_resource_associations(self, context, resource_ids): if not resource_ids: return - with context.session.begin(subtransactions=True): + with db_api.context_manager.writer.using(context): (context.session.query(st_model.ProviderResourceAssociation). filter( st_model.ProviderResourceAssociation.resource_id.in_(