On 06/05/2014 10:07 PM, Rodrigo Trujillo wrote:
During ISO search (Template creation window), kimchi search volumes
in
storagepools and it encodes every file name found. If some file has
unsupported characters, an error is raised and none ISO is presented to
user.
This patch fixes this error.
I think, that's because some iso with non-acsii
name .
I have send a patch, and it is merged today, not sure it can fix your
issue.
bug fix: decode volume name in IsoVolumesModel.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/model/storagevolumes.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/kimchi/model/storagevolumes.py b/src/kimchi/model/storagevolumes.py
index d58fd0b..ab8e2fa 100644
--- a/src/kimchi/model/storagevolumes.py
+++ b/src/kimchi/model/storagevolumes.py
@@ -114,6 +114,10 @@ class StorageVolumeModel(object):
raise InvalidOperation("KCHVOL0006E", {'name': pool})
try:
return pool.storageVolLookupByName(name.encode("utf-8"))
+ except UnicodeDecodeError as e:
+ msg = 'Unable to encode file name "%s" from pool
"%s":\n %s'
+ kimchi_log.warn(msg %(name, poolname, str(e)))
+ return None
except libvirt.libvirtError as e:
if e.get_error_code() == libvirt.VIR_ERR_NO_STORAGE_VOL:
raise NotFoundError("KCHVOL0002E", {'name': name,
@@ -151,6 +155,8 @@ class StorageVolumeModel(object):
def lookup(self, pool, name):
vol = self._get_storagevolume(pool, name)
+ if not vol:
+ return None
path = vol.path()
info = vol.info()
xml = vol.XMLDesc(0)
@@ -240,6 +246,8 @@ class IsoVolumesModel(object):
for volume in volumes:
res = self.storagevolume.lookup(pool_name, volume)
+ if res is None:
+ continue
if res['format'] == 'iso':
res['name'] = '%s' % volume
iso_volumes.append(res)
--
Thanks and best regards!
Sheldon Feng(冯少合)<shaohef(a)linux.vnet.ibm.com>
IBM Linux Technology Center