db: Migrate "volume", "volume attachment" APIs to enginefacade

Migrate volume- and volume attachment-related APIs from the legacy
enginefacade to the modern context-based enginefacade.

Change-Id: I1aaff94190ccbe82d231b3064aec3753d8be945e
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2022-02-17 10:14:31 +00:00
parent bc9397073e
commit 4ffe3139cf
3 changed files with 762 additions and 526 deletions

View File

@ -514,11 +514,9 @@ def volume_attachment_get(context, attachment_id):
return IMPL.volume_attachment_get(context, attachment_id)
def volume_attachment_get_all_by_volume_id(context, volume_id,
session=None):
def volume_attachment_get_all_by_volume_id(context, volume_id):
return IMPL.volume_attachment_get_all_by_volume_id(context,
volume_id,
session)
volume_id)
def volume_attachment_get_all_by_host(context, host, filters=None):

File diff suppressed because it is too large Load Diff

View File

@ -2411,10 +2411,7 @@ class DBAPIVolumeTypeTestCase(BaseTest):
'extra_specs': vt_extra_specs})
volume_ref = db.volume_create(self.ctxt, {'volume_type_id': vt.id})
session = sqlalchemy_api.get_session()
volume = sqlalchemy_api._volume_get(self.ctxt, volume_ref.id,
session=session)
session.close()
volume = sqlalchemy_api._volume_get(self.ctxt, volume_ref.id)
actual_specs = {}
for spec in volume.volume_type.extra_specs: