Use new enginefacade for servicetype_db

Use reader and writer for db operations with servicetype.

Partially-Implements blueprint: enginefacade-switch

Change-Id: I7cf29890d4d498c241a7c6e99edfbfc258b8cb60
This commit is contained in:
Ann Kamyshnikova 2016-11-10 12:57:24 +03:00 committed by Ann Taraday
parent c4c3fbdb5e
commit 9cb31b1e25
1 changed files with 3 additions and 2 deletions

View File

@ -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_(