diff options
author | Jenkins <jenkins@review.openstack.org> | 2012-04-01 00:54:47 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2012-04-01 00:54:47 +0000 |
commit | 57b240d72ec49305dff18a7ca91304a4373344f7 (patch) | |
tree | 87605e75569e979a3a1740212895659621102d43 | |
parent | 68063ae67ebdb7dfaa487b659b5565fac52e848f (diff) | |
parent | 28da69f716f2e8fc1b6af5048436f3e8482c868a (diff) | |
download | nova-57b240d72ec49305dff18a7ca91304a4373344f7.tar.gz |
Merge "A missing checksum does not mean the image is corrupt." into milestone-proposed
-rw-r--r-- | nova/tests/test_imagecache.py | 3 | ||||
-rw-r--r-- | nova/virt/libvirt/imagecache.py | 7 |
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: |