[Kimchi-devel] [PATCH] [Kimchi] Bug fix: Remove storage volume file while removing the storage volume

Aline Manera alinefm at linux.vnet.ibm.com
Thu Mar 3 19:51:29 UTC 2016


Please, ignore this patch. I will send another soon.

On 03/03/2016 04:49 PM, Aline Manera wrote:
> When removing a storage volume, it was only removed from a libvirt
> perspective, ie, the storage volume file kept in the system.
> It may confuse user as he/she will not be able to create a new storage
> volume with the same name from the storage volume removed before as the file
> exists in the system.
> To avoid it, remove the file from the system after removing it from a
> libvirt perspective.
>
> This issue was identified due a failure in the test suite.
> 2 files related to storage volume tests were kept on the system causing
> errors when running the test suite multiple times.
>
> To verify this patch, please, make sure to do not have any leftovers in the
> 'default' storage pool directory (/var/lib/libvirt/images).
> After that, run the test suite mutliple times and you will see no
> leftovers will be in the system when the test completes.
>
> Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
> ---
>   model/storagevolumes.py | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/model/storagevolumes.py b/model/storagevolumes.py
> index d010bcd..d5fdff9 100644
> --- a/model/storagevolumes.py
> +++ b/model/storagevolumes.py
> @@ -373,6 +373,12 @@ class StorageVolumeModel(object):
>               raise OperationFailed("KCHVOL0010E",
>                                     {'name': name, 'err': e.get_error_message()})
>
> +        try:
> +            os.remove(pool_info['path'])
> +        except OSError, e:
> +            wok_log.error("Unable to delete storage volume file: %s."
> +                          "Details: %s" % (pool_info['path'], e.message))
> +
>       def resize(self, pool, name, size):
>           volume = StorageVolumeModel.get_storagevolume(pool, name, self.conn)
>




More information about the Kimchi-devel mailing list