summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-04-01 00:54:47 +0000
committerGerrit Code Review <review@openstack.org>2012-04-01 00:54:47 +0000
commit57b240d72ec49305dff18a7ca91304a4373344f7 (patch)
tree87605e75569e979a3a1740212895659621102d43
parent68063ae67ebdb7dfaa487b659b5565fac52e848f (diff)
parent28da69f716f2e8fc1b6af5048436f3e8482c868a (diff)
downloadnova-57b240d72ec49305dff18a7ca91304a4373344f7.tar.gz
Merge "A missing checksum does not mean the image is corrupt." into milestone-proposed
-rw-r--r--nova/tests/test_imagecache.py3
-rw-r--r--nova/virt/libvirt/imagecache.py7
2 files changed, 8 insertions, 2 deletions
diff --git a/nova/tests/test_imagecache.py b/nova/tests/test_imagecache.py
index 60a4f0ce3c..599d99ac9f 100644
--- a/nova/tests/test_imagecache.py
+++ b/nova/tests/test_imagecache.py
@@ -665,6 +665,9 @@ class ImageCacheManagerTestCase(test.TestCase):
fq_path('%s_10737418240' % hashed_1)]:
self.assertTrue(rem in image_cache_manager.removable_base_files)
+ # Ensure there are no "corrupt" images as well
+ self.assertTrue(len(image_cache_manager.corrupt_base_files), 0)
+
def test_verify_base_images_no_base(self):
self.flags(instances_path='/tmp/no/such/dir/name/please')
image_cache_manager = imagecache.ImageCacheManager()
diff --git a/nova/virt/libvirt/imagecache.py b/nova/virt/libvirt/imagecache.py
index 9aa1e75d26..d903c87fca 100644
--- a/nova/virt/libvirt/imagecache.py
+++ b/nova/virt/libvirt/imagecache.py
@@ -305,8 +305,11 @@ class ImageCacheManager(object):
if (base_file and os.path.exists(base_file)
and os.path.isfile(base_file)):
- # _verify_checksum returns True if the checksum is ok.
- image_bad = not self._verify_checksum(img_id, base_file)
+ # _verify_checksum returns True if the checksum is ok, and None if
+ # there is no checksum file
+ checksum_result = self._verify_checksum(img_id, base_file)
+ if not checksum_result is None:
+ image_bad = not checksum_result
instances = []
if img_id in self.used_images: