summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-03-29 18:53:39 +0000
committerGerrit Code Review <review@openstack.org>2012-03-29 18:53:39 +0000
commitb5e92a337b783d787cb551877f8a6f8cbc0a5a6e (patch)
tree643a578e9c3a55770a57da9ca2da54ee510963e6
parent65cc21d58b4c29cdbfe0ec3a55b43b2a9fd76425 (diff)
parent2c5112e5938e3d567504748f923fb198fad3117e (diff)
downloadnova-b5e92a337b783d787cb551877f8a6f8cbc0a5a6e.tar.gz
nova-b5e92a337b783d787cb551877f8a6f8cbc0a5a6e.tar.xz
nova-b5e92a337b783d787cb551877f8a6f8cbc0a5a6e.zip
Merge "Touch in use image files when they're checked."
-rw-r--r--nova/tests/test_imagecache.py4
-rw-r--r--nova/virt/libvirt/imagecache.py2
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."""