[Kimchi-devel] [PATCH] Fix ISO error messages

Ramon Medeiros ramonn at linux.vnet.ibm.com
Wed Nov 25 18:28:46 UTC 2015


Make distinct "no ISO found" and "invalid iso format".

Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
---
 src/wok/plugins/kimchi/vmtemplate.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/wok/plugins/kimchi/vmtemplate.py b/src/wok/plugins/kimchi/vmtemplate.py
index 283d94d..0c35611 100644
--- a/src/wok/plugins/kimchi/vmtemplate.py
+++ b/src/wok/plugins/kimchi/vmtemplate.py
@@ -130,11 +130,15 @@ class VMTemplate(object):
         iso_prefixes = ['/', 'http', 'https', 'ftp', 'ftps', 'tftp']
         if len(filter(iso.startswith, iso_prefixes)) == 0:
             raise InvalidParameter("KCHTMPL0006E", {'param': iso})
+        else:
+            if not os.path.exists(iso):
+                raise InvalidParameter("KCHISO0001E", {'filename': iso})
+
         try:
             iso_img = IsoImage(iso)
             return iso_img.probe()
         except IsoFormatError:
-            raise InvalidParameter("KCHISO0001E", {'filename': iso})
+            raise InvalidParameter("KCHISO0007E", {'filename': iso})
 
     def _get_cdrom_xml(self, libvirt_stream_protocols):
         if 'cdrom' not in self.info:
-- 
2.1.0




More information about the Kimchi-devel mailing list