From d09f0d44707fe0aaa087b603dc6d8a29318f4a40 Mon Sep 17 00:00:00 2001 From: "Walter A. Boring IV" Date: Thu, 24 Apr 2014 10:44:37 -0700 Subject: [PATCH] Remove unused volume instance_uuid methods This patch removes a db api call that is only used in unit tests. Change-Id: Ic686eacdee21d13f8c7c7a16d7353211abc7579a Related-Bug: #1255925 --- cinder/db/api.py | 5 ----- cinder/db/sqlalchemy/api.py | 15 --------------- cinder/tests/test_db_api.py | 18 ------------------ 3 files changed, 38 deletions(-) diff --git a/cinder/db/api.py b/cinder/db/api.py index 8881e80e9..6d05ba766 100644 --- a/cinder/db/api.py +++ b/cinder/db/api.py @@ -217,11 +217,6 @@ def volume_get_all_by_host(context, host): return IMPL.volume_get_all_by_host(context, host) -def volume_get_all_by_instance_uuid(context, instance_uuid): - """Get all volumes belonging to a instance.""" - return IMPL.volume_get_all_by_instance_uuid(context, instance_uuid) - - def volume_get_all_by_project(context, project_id, marker, limit, sort_key, sort_dir, filters=None): """Get all volumes belonging to a project.""" diff --git a/cinder/db/sqlalchemy/api.py b/cinder/db/sqlalchemy/api.py index b3244577d..45aa9597b 100644 --- a/cinder/db/sqlalchemy/api.py +++ b/cinder/db/sqlalchemy/api.py @@ -1139,21 +1139,6 @@ def volume_get_all_by_host(context, host): return _volume_get_query(context).filter_by(host=host).all() -@require_admin_context -def volume_get_all_by_instance_uuid(context, instance_uuid): - result = model_query(context, models.Volume, read_deleted="no").\ - options(joinedload('volume_metadata')).\ - options(joinedload('volume_admin_metadata')).\ - options(joinedload('volume_type')).\ - filter_by(instance_uuid=instance_uuid).\ - all() - - if not result: - return [] - - return result - - @require_context def volume_get_all_by_project(context, project_id, marker, limit, sort_key, sort_dir, filters=None): diff --git a/cinder/tests/test_db_api.py b/cinder/tests/test_db_api.py index ddd0726fd..58340d6b5 100644 --- a/cinder/tests/test_db_api.py +++ b/cinder/tests/test_db_api.py @@ -380,24 +380,6 @@ class DBAPIVolumeTestCase(BaseTest): db.volume_get_all_by_host( self.ctxt, 'h%d' % i)) - def test_volume_get_all_by_instance_uuid(self): - instance_uuids = [] - volumes = [] - for i in xrange(3): - instance_uuid = str(uuidutils.uuid.uuid1()) - instance_uuids.append(instance_uuid) - volumes.append([db.volume_create(self.ctxt, - {'instance_uuid': instance_uuid}) - for j in xrange(3)]) - for i in xrange(3): - self._assertEqualListsOfObjects(volumes[i], - db.volume_get_all_by_instance_uuid( - self.ctxt, instance_uuids[i])) - - def test_volume_get_all_by_instance_uuid_empty(self): - self.assertEqual([], db.volume_get_all_by_instance_uuid(self.ctxt, - 'empty')) - def test_volume_get_all_by_project(self): volumes = [] for i in xrange(3): -- 2.45.2