]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Remove unused volume instance_uuid methods
authorWalter A. Boring IV <walter.boring@hp.com>
Thu, 24 Apr 2014 17:44:37 +0000 (10:44 -0700)
committerWalter A. Boring IV <walter.boring@hp.com>
Thu, 24 Apr 2014 17:44:37 +0000 (10:44 -0700)
This patch removes a db api call that is only
used in unit tests.

Change-Id: Ic686eacdee21d13f8c7c7a16d7353211abc7579a
Related-Bug: #1255925

cinder/db/api.py
cinder/db/sqlalchemy/api.py
cinder/tests/test_db_api.py

index 8881e80e9d47b8453225c993c151f0ed17d1f028..6d05ba7665d74f9e24a093693bac39e1d675cc3e 100644 (file)
@@ -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."""
index b3244577d90ec7dafea5ae167afe42d8b70153e0..45aa9597b32ca07ae36a33246ff6abd1b3fd6a34 100644 (file)
@@ -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):
index ddd0726fd7815b4ac6393871af7f3893b62f1e60..58340d6b5d0eb0146639331555540629b7e92095 100644 (file)
@@ -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):