[Kimchi-devel] [PATCH] mock: Do not write file when downloading a volume

Crístian Viana vianac at linux.vnet.ibm.com
Mon Sep 22 12:53:49 UTC 2014


The storage volumes created via download in mockmodel are being written
to the filesystem. As it is a mock environment, there's no real need to
write that file.
After running the current tests, the storage pool at "/var/lib/libvirt/images/"
has the volume "anyurl.wor.kz" left because of that behaviour.

Remove the file writing implementation when creating a volume via
download.

Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
---
 src/kimchi/mockmodel.py | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index 8b58c36..904d335 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -575,13 +575,9 @@ class MockModel(object):
 
         pool = self._get_storagepool(pool_name)
 
-        file_path = os.path.join(pool.info['path'], name)
-
-        with open(file_path, 'w') as file:
-            file.write(url)
-
-        params['path'] = file_path
+        params['path'] = os.path.join(pool.info['path'], name)
         params['type'] = 'file'
+        params['base'] = url
 
         volume = MockStorageVolume(pool, name, params)
         pool._volumes[name] = volume
-- 
1.9.3




More information about the Kimchi-devel mailing list