Following up patch of 7d0f8ab360
It should be dbapi instance, a mistake when renaming instances to servers. Change-Id: I5a9ca3720c7b261737dacb2cfbb671a0849de051
This commit is contained in:
parent
164ca9844e
commit
52449d4019
@ -35,7 +35,7 @@ class DBHook(hooks.PecanHook):
|
||||
"""Attach the dbapi object to the request so controllers can get to it."""
|
||||
|
||||
def before(self, state):
|
||||
state.request.dbapi = dbapi.get_server()
|
||||
state.request.dbapi = dbapi.get_instance()
|
||||
|
||||
|
||||
class EngineAPIHook(hooks.PecanHook):
|
||||
|
@ -28,8 +28,8 @@ IMPL = db_api.DBAPI.from_config(cfg.CONF, backend_mapping=_BACKEND_MAPPING,
|
||||
lazy=True)
|
||||
|
||||
|
||||
def get_server():
|
||||
"""Return a DB API server."""
|
||||
def get_instance():
|
||||
"""Return a DB API instance."""
|
||||
return IMPL
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@ class BaseEngineManager(periodic_task.PeriodicTasks):
|
||||
raise RuntimeError(_('Attempt to start an already running '
|
||||
'engine manager'))
|
||||
|
||||
self.dbapi = dbapi.get_server()
|
||||
self.dbapi = dbapi.get_instance()
|
||||
|
||||
self._worker_pool = greenpool.GreenPool(
|
||||
size=CONF.engine.workers_pool_size)
|
||||
|
@ -26,7 +26,7 @@ class ComputeDisk(base.MoganObject, object_base.VersionedObjectDictCompat):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
||||
dbapi = dbapi.get_server()
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
fields = {
|
||||
'id': object_fields.IntegerField(read_only=True),
|
||||
@ -81,7 +81,7 @@ class ComputeDiskList(object_base.ObjectListBase, base.MoganObject,
|
||||
|
||||
VERSION = '1.0'
|
||||
|
||||
dbapi = dbapi.get_server()
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
fields = {
|
||||
'objects': object_fields.ListOfObjectsField('ComputeDisk')
|
||||
|
@ -27,7 +27,7 @@ class ComputeNode(base.MoganObject, object_base.VersionedObjectDictCompat):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
||||
dbapi = dbapi.get_server()
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
fields = {
|
||||
'id': object_fields.IntegerField(read_only=True),
|
||||
@ -100,7 +100,7 @@ class ComputeNodeList(object_base.ObjectListBase, base.MoganObject,
|
||||
|
||||
VERSION = '1.0'
|
||||
|
||||
dbapi = dbapi.get_server()
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
fields = {
|
||||
'objects': object_fields.ListOfObjectsField('ComputeNode')
|
||||
|
@ -26,7 +26,7 @@ class ComputePort(base.MoganObject, object_base.VersionedObjectDictCompat):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
||||
dbapi = dbapi.get_server()
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
fields = {
|
||||
'id': object_fields.IntegerField(read_only=True),
|
||||
@ -88,7 +88,7 @@ class ComputePortList(object_base.ObjectListBase, base.MoganObject,
|
||||
|
||||
VERSION = '1.0'
|
||||
|
||||
dbapi = dbapi.get_server()
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
fields = {
|
||||
'objects': object_fields.ListOfObjectsField('ComputePort')
|
||||
|
@ -29,7 +29,7 @@ class Flavor(base.MoganObject, object_base.VersionedObjectDictCompat):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
||||
dbapi = dbapi.get_server()
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
fields = {
|
||||
'uuid': object_fields.UUIDField(nullable=True),
|
||||
|
@ -30,7 +30,7 @@ class KeyPair(base.MoganObject):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
||||
dbapi = dbapi.get_server()
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
fields = {
|
||||
'id': fields.IntegerField(),
|
||||
@ -85,7 +85,7 @@ class KeyPairList(object_base.ObjectListBase, base.MoganObject):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
||||
dbapi = dbapi.get_server()
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
fields = {
|
||||
'objects': fields.ListOfObjectsField('KeyPair'),
|
||||
|
@ -38,7 +38,7 @@ class Quota(base.MoganObject, object_base.VersionedObjectDictCompat):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
||||
dbapi = dbapi.get_server()
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
fields = {
|
||||
'id': object_fields.IntegerField(),
|
||||
@ -164,7 +164,7 @@ class DbQuotaDriver(object):
|
||||
The default driver utilizes the local database.
|
||||
"""
|
||||
|
||||
dbapi = dbapi.get_server()
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
def get_project_quotas(self, context, resources, project_id, usages=True):
|
||||
"""Retrieve quotas for a project.
|
||||
|
@ -33,7 +33,7 @@ class Server(base.MoganObject, object_base.VersionedObjectDictCompat):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
||||
dbapi = dbapi.get_server()
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
fields = {
|
||||
'id': object_fields.IntegerField(),
|
||||
|
@ -30,7 +30,7 @@ class ServerFault(base.MoganObject, object_base.VersionedObjectDictCompat):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
||||
dbapi = dbapi.get_server()
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
fields = {
|
||||
'id': object_fields.IntegerField(),
|
||||
@ -82,7 +82,7 @@ class ServerFaultList(base.MoganObject, object_base.VersionedObjectDictCompat):
|
||||
|
||||
VERSION = '1.0'
|
||||
|
||||
dbapi = dbapi.get_server()
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
fields = {
|
||||
'objects': object_fields.ListOfObjectsField('ServerFault')
|
||||
|
@ -27,7 +27,7 @@ class ServerNic(base.MoganObject, object_base.VersionedObjectDictCompat):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
||||
dbapi = dbapi.get_server()
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
fields = {
|
||||
'port_id': object_fields.UUIDField(nullable=False),
|
||||
@ -72,7 +72,7 @@ class ServerNics(object_base.ObjectListBase, base.MoganObject,
|
||||
|
||||
VERSION = '1.0'
|
||||
|
||||
dbapi = dbapi.get_server()
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
fields = {
|
||||
'objects': object_fields.ListOfObjectsField('ServerNic')}
|
||||
|
@ -66,7 +66,7 @@ class DbTestCase(base.TestCase):
|
||||
def setUp(self):
|
||||
super(DbTestCase, self).setUp()
|
||||
|
||||
self.dbapi = dbapi.get_server()
|
||||
self.dbapi = dbapi.get_instance()
|
||||
|
||||
global _DB_CACHE
|
||||
if not _DB_CACHE:
|
||||
|
@ -40,7 +40,7 @@ class DbQuotaUsageTestCase(base.DbTestCase):
|
||||
|
||||
def test_quota_usage_reserve(self):
|
||||
utils.create_test_quota()
|
||||
dbapi = db_api.get_server()
|
||||
dbapi = db_api.get_instance()
|
||||
r = dbapi.quota_reserve(self.context, self.resources,
|
||||
{'servers': 10},
|
||||
{'servers': 1},
|
||||
@ -51,7 +51,7 @@ class DbQuotaUsageTestCase(base.DbTestCase):
|
||||
|
||||
def test_reserve_commit(self):
|
||||
utils.create_test_quota()
|
||||
dbapi = db_api.get_server()
|
||||
dbapi = db_api.get_instance()
|
||||
rs = dbapi.quota_reserve(self.context, self.resources,
|
||||
{'servers': 10},
|
||||
{'servers': 1},
|
||||
@ -67,7 +67,7 @@ class DbQuotaUsageTestCase(base.DbTestCase):
|
||||
|
||||
def test_reserve_rollback(self):
|
||||
utils.create_test_quota()
|
||||
dbapi = db_api.get_server()
|
||||
dbapi = db_api.get_instance()
|
||||
rs = dbapi.quota_reserve(self.context, self.resources,
|
||||
{'servers': 10},
|
||||
{'servers': 1},
|
||||
|
@ -80,7 +80,7 @@ def create_test_server(context={}, **kw):
|
||||
# Let DB generate ID if it isn't specified explicitly
|
||||
if 'id' not in kw:
|
||||
del server['id']
|
||||
dbapi = db_api.get_server()
|
||||
dbapi = db_api.get_instance()
|
||||
|
||||
return dbapi.server_create(context, server)
|
||||
|
||||
@ -121,7 +121,7 @@ def create_test_compute_node(context={}, **kw):
|
||||
# specified explicitly just delete it.
|
||||
if 'ports' not in kw:
|
||||
del node['ports']
|
||||
dbapi = db_api.get_server()
|
||||
dbapi = db_api.get_instance()
|
||||
|
||||
return dbapi.compute_node_create(context, node)
|
||||
|
||||
@ -155,7 +155,7 @@ def create_test_compute_port(context={}, **kw):
|
||||
# Let DB generate ID if it isn't specified explicitly
|
||||
if 'id' not in kw:
|
||||
del port['id']
|
||||
dbapi = db_api.get_server()
|
||||
dbapi = db_api.get_instance()
|
||||
|
||||
return dbapi.compute_port_create(context, port)
|
||||
|
||||
@ -189,7 +189,7 @@ def create_test_compute_disk(context={}, **kw):
|
||||
# Let DB generate ID if it isn't specified explicitly
|
||||
if 'id' not in kw:
|
||||
del disk['id']
|
||||
dbapi = db_api.get_server()
|
||||
dbapi = db_api.get_instance()
|
||||
|
||||
return dbapi.compute_disk_create(context, disk)
|
||||
|
||||
@ -216,7 +216,7 @@ def create_test_flavor(context={}, **kw):
|
||||
|
||||
"""
|
||||
flavor = get_test_flavor(**kw)
|
||||
dbapi = db_api.get_server()
|
||||
dbapi = db_api.get_instance()
|
||||
|
||||
return dbapi.flavor_create(context, flavor)
|
||||
|
||||
@ -243,7 +243,7 @@ def create_test_server_fault(context={}, **kw):
|
||||
|
||||
"""
|
||||
server_fault = get_test_server_fault(**kw)
|
||||
dbapi = db_api.get_server()
|
||||
dbapi = db_api.get_instance()
|
||||
|
||||
return dbapi.server_fault_create(context, server_fault)
|
||||
|
||||
@ -275,6 +275,6 @@ def create_test_quota(context={}, **kw):
|
||||
# Let DB generate ID if it isn't specified explicitly
|
||||
if 'id' not in kw:
|
||||
del quota['id']
|
||||
dbapi = db_api.get_server()
|
||||
dbapi = db_api.get_instance()
|
||||
|
||||
return dbapi.quota_create(context, quota)
|
||||
|
Loading…
Reference in New Issue
Block a user