When a storage volume is created with the parameter 'capacity', the
parameter 'ref_cnt' is set on the storage pool path instead of the
storage volume path. 'ref_cnt's are only related to storage volumes, not
pools.
Use the storage volume path instead of the storage pool path when
setting 'ref_cnt' on a new volume.
Signed-off-by: CrÃstian Deives <cristiandeives(a)gmail.com>
---
src/kimchi/model/storagevolumes.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/kimchi/model/storagevolumes.py b/src/kimchi/model/storagevolumes.py
index f02efca..cf4611d 100644
--- a/src/kimchi/model/storagevolumes.py
+++ b/src/kimchi/model/storagevolumes.py
@@ -182,12 +182,14 @@ class StorageVolumesModel(object):
{'name': name, 'pool': pool,
'err': e.get_error_message()})
- path = StoragePoolModel(
- conn=self.conn, objstore=self.objstore).lookup(pool_name)['path']
+ vol_info = StorageVolumeModel(conn=self.conn,
+ objstore=self.objstore).lookup(pool_name,
+ name)
try:
with self.objstore as session:
- session.store('storagevolume', path, {'ref_cnt': 0})
+ session.store('storagevolume', vol_info['path'],
+ {'ref_cnt': 0})
except Exception as e:
# If the storage volume was created flawlessly, then lets hide this
# error to avoid more error in the VM creation process
--
2.1.0