[Kimchi-devel] [PATCH v3 5/5] Set 'used_by' to [] when creating some volumes
Crístian Deives
cristiandeives at gmail.com
Tue May 12 14:58:42 UTC 2015
When a storage volume is created, its 'used_by' field should be set to
empty. However, some functions don't set that field.
Set the field 'used_by' to [] when creating a storage volume by
'url' or 'file'.
Signed-off-by: Crístian Deives <cristiandeives at gmail.com>
---
src/kimchi/model/storagevolumes.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/kimchi/model/storagevolumes.py b/src/kimchi/model/storagevolumes.py
index 56525d1..d3a9ad9 100644
--- a/src/kimchi/model/storagevolumes.py
+++ b/src/kimchi/model/storagevolumes.py
@@ -149,6 +149,8 @@ class StorageVolumesModel(object):
# Refresh to make sure volume can be found in following lookup
StoragePoolModel.get_storagepool(pool_name, self.conn).refresh(0)
+ set_disk_used_by(self.objstore, file_path, [])
+
cb('OK', True)
def _create_volume_with_capacity(self, cb, params):
@@ -268,6 +270,11 @@ class StorageVolumesModel(object):
finally:
os.remove(file_path)
+ vol_info = StorageVolumeModel(conn=self.conn,
+ objstore=self.objstore).lookup(pool_name,
+ name)
+ set_disk_used_by(self.objstore, vol_info['path'], [])
+
cb('OK', True)
def get_list(self, pool_name):
--
2.1.0
More information about the Kimchi-devel
mailing list