[Kimchi-devel] [PATCH v4 2/2] Set 'used_by' to [] when creating some volumes

Crístian Deives cristiandeives at gmail.com
Thu May 28 15:09:17 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 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/kimchi/model/storagevolumes.py b/src/kimchi/model/storagevolumes.py
index ab032e3..9165946 100644
--- a/src/kimchi/model/storagevolumes.py
+++ b/src/kimchi/model/storagevolumes.py
@@ -239,6 +239,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.4.1




More information about the Kimchi-devel mailing list