summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/tests/test_imagecache.py5
-rw-r--r--nova/virt/libvirt/imagecache.py1
2 files changed, 6 insertions, 0 deletions
diff --git a/nova/tests/test_imagecache.py b/nova/tests/test_imagecache.py
index 599d99ac9..9cf400320 100644
--- a/nova/tests/test_imagecache.py
+++ b/nova/tests/test_imagecache.py
@@ -436,6 +436,7 @@ class ImageCacheManagerTestCase(test.TestCase):
self.assertEquals(image_cache_manager.corrupt_base_files, [])
def test_handle_base_image_used(self):
+ self.stubs.Set(virtutils, 'chown', lambda x, y: None)
img = '123'
with self._make_base_file() as fname:
@@ -496,6 +497,8 @@ class ImageCacheManagerTestCase(test.TestCase):
self.assertEquals(image_cache_manager.corrupt_base_files, [])
def test_handle_base_image_checksum_fails(self):
+ self.stubs.Set(virtutils, 'chown', lambda x, y: None)
+
img = '123'
with self._make_base_file() as fname:
@@ -563,6 +566,8 @@ class ImageCacheManagerTestCase(test.TestCase):
self.stubs.Set(os.path, 'exists', lambda x: exists(x))
+ self.stubs.Set(virtutils, 'chown', lambda x, y: None)
+
# We need to stub utime as well
orig_utime = os.utime
self.stubs.Set(os, 'utime', lambda x, y: None)
diff --git a/nova/virt/libvirt/imagecache.py b/nova/virt/libvirt/imagecache.py
index d903c87fc..f92376a17 100644
--- a/nova/virt/libvirt/imagecache.py
+++ b/nova/virt/libvirt/imagecache.py
@@ -355,6 +355,7 @@ class ImageCacheManager(object):
{'id': img_id,
'base_file': base_file})
if os.path.exists(base_file):
+ virtutils.chown(base_file, os.getuid())
os.utime(base_file, None)
def verify_base_images(self, context):