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

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Tue Feb 18 10:20:28 UTC 2014


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,
-- 
1.8.1.2




More information about the Kimchi-devel mailing list