diff --git a/cinder/image/cache.py b/cinder/image/cache.py index bbea32fe752..ba90c1579d7 100644 --- a/cinder/image/cache.py +++ b/cinder/image/cache.py @@ -133,6 +133,7 @@ class ImageVolumeCache(object): # Assume the entries are ordered by most recently used to least used. entries = self.db.image_volume_cache_get_all( + context, **self._get_query_filters(volume)) current_count = len(entries) diff --git a/cinder/tests/unit/image/test_cache.py b/cinder/tests/unit/image/test_cache.py index f459536b4e3..2e19a4b7b14 100644 --- a/cinder/tests/unit/image/test_cache.py +++ b/cinder/tests/unit/image/test_cache.py @@ -254,6 +254,8 @@ class ImageVolumeCacheTestCase(test.TestCase): self.assertEqual(2, mock_delete.call_count) mock_delete.assert_any_call(self.context, entry2) mock_delete.assert_any_call(self.context, entry3) + self.mock_db.image_volume_cache_get_all.assert_called_with( + self.context, cluster_name=self.volume_ovo.cluster_name) def test_ensure_space_need_count(self): cache = self._build_cache(max_gb=30, max_count=2)