[Kimchi-devel] [PATCH] Fix encode and decode in storagevolumes.py

Sheldon shaohef at linux.vnet.ibm.com
Tue Feb 18 13:37:18 UTC 2014


Reviewed-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

On 02/18/2014 06:20 PM, lvroyce at linux.vnet.ibm.com wrote:
> From: Royce Lv <lvroyce at linux.vnet.ibm.com>
>
> Storage volume list return value and lookup parameter is not properly
> encode and decode, fix it.
>
> Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> ---
>   src/kimchi/model/storagevolumes.py | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/kimchi/model/storagevolumes.py b/src/kimchi/model/storagevolumes.py
> index e3f00ca..20c65b9 100644
> --- a/src/kimchi/model/storagevolumes.py
> +++ b/src/kimchi/model/storagevolumes.py
> @@ -79,7 +79,7 @@ class StorageVolumesModel(object):
>               raise InvalidOperation("KCHVOL0006E", {'pool': pool_name})
>           try:
>               pool.refresh(0)
> -            return pool.listVolumes()
> +            return sorted(map(lambda x: x.decode('utf-8'), pool.listVolumes()))
>           except libvirt.libvirtError as e:
>               raise OperationFailed("KCHVOL0008E",
>                                     {'pool': pool_name,
> @@ -95,7 +95,7 @@ class StorageVolumeModel(object):
>           if not pool.isActive():
>               raise InvalidOperation("KCHVOL0006E", {'name': pool})
>           try:
> -            return pool.storageVolLookupByName(name)
> +            return pool.storageVolLookupByName(name.encode("utf-8"))
>           except libvirt.libvirtError as e:
>               if e.get_error_code() == libvirt.VIR_ERR_NO_STORAGE_VOL:
>                   raise NotFoundError("KCHVOL0002E", {'name': name,


-- 
Thanks and best regards!

Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center




More information about the Kimchi-devel mailing list