diff options
| -rw-r--r-- | nova/tests/test_imagecache.py | 4 | ||||
| -rw-r--r-- | nova/virt/libvirt/imagecache.py | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/nova/tests/test_imagecache.py b/nova/tests/test_imagecache.py index 373f8478b..599d99ac9 100644 --- a/nova/tests/test_imagecache.py +++ b/nova/tests/test_imagecache.py @@ -563,6 +563,10 @@ class ImageCacheManagerTestCase(test.TestCase): self.stubs.Set(os.path, 'exists', lambda x: exists(x)) + # We need to stub utime as well + orig_utime = os.utime + self.stubs.Set(os, 'utime', lambda x, y: None) + # Fake up some instances in the instances directory orig_listdir = os.listdir diff --git a/nova/virt/libvirt/imagecache.py b/nova/virt/libvirt/imagecache.py index 092ab1d05..d903c87fc 100644 --- a/nova/virt/libvirt/imagecache.py +++ b/nova/virt/libvirt/imagecache.py @@ -354,6 +354,8 @@ class ImageCacheManager(object): LOG.debug(_('%(id)s (%(base_file)s): image is in use'), {'id': img_id, 'base_file': base_file}) + if os.path.exists(base_file): + os.utime(base_file, None) def verify_base_images(self, context): """Verify that base images are in a reasonable state.""" |
