[Kimchi-devel] [PATCH v3 5/5] Set 'used_by' to [] when creating some volumes

Aline Manera alinefm at linux.vnet.ibm.com
Fri May 15 15:29:29 UTC 2015


Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>

On 12/05/2015 11:58, Crístian Deives wrote:
> 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):




More information about the Kimchi-devel mailing list