diff options
| author | Michael Still <mikal@stillhq.com> | 2012-03-27 14:30:37 +1100 |
|---|---|---|
| committer | Michael Still <mikal@stillhq.com> | 2012-03-27 14:37:46 +1100 |
| commit | f8f69dc2edd0da19e2726a5e2068dd22e7ced0a2 (patch) | |
| tree | 32d650fbcadede24e36edda193754424f6fcd4a3 /nova | |
| parent | 2483dbfe42a43ce372876afbd7c40c3c8daede6f (diff) | |
| download | nova-f8f69dc2edd0da19e2726a5e2068dd22e7ced0a2.tar.gz nova-f8f69dc2edd0da19e2726a5e2068dd22e7ced0a2.tar.xz nova-f8f69dc2edd0da19e2726a5e2068dd22e7ced0a2.zip | |
A missing checksum does not mean the image is corrupt.
This is a logic error in the code. A missing checksum should not
imply that the image is corrupt. Note that corrupt images are only
logged, not removed, so there is no data loss for users with this
bug.
Change-Id: Ic644517d3b8e9646fe943e5cef485c4168ebb5b5
Diffstat (limited to 'nova')
| -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 c748abbae..09f5f9fce 100644 --- a/nova/tests/test_imagecache.py +++ b/nova/tests/test_imagecache.py @@ -660,6 +660,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 25455a07c..07bab5cd3 100644 --- a/nova/virt/libvirt/imagecache.py +++ b/nova/virt/libvirt/imagecache.py @@ -303,8 +303,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: |
