If a storage volume is being downloaded by Kimchi and an error occurs
(e.g. timeout, network down, no available disk space), whatever has been
downloaded so far is kept on the storage pool.
Remove the partially downloaded storage volume if an error occurs during
the operation.
Signed-off-by: Crístian Viana <vianac(a)linux.vnet.ibm.com>
---
src/kimchi/model/storagevolumes.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/kimchi/model/storagevolumes.py b/src/kimchi/model/storagevolumes.py
index f9f226f..ac6887a 100644
--- a/src/kimchi/model/storagevolumes.py
+++ b/src/kimchi/model/storagevolumes.py
@@ -204,6 +204,8 @@ class StorageVolumesModel(object):
downloaded_size += len(chunk_data)
cb('%s/%s' % (downloaded_size, remote_size))
except Exception, e:
+ if os.path.isfile(file_path):
+ os.remove(file_path)
raise OperationFailed('KCHVOL0007E', {'name': name,
'pool': pool_name,
'err': e.message})
--
1.9.3