Reviewed-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
On 2014年03月01日 00:24, Aline Manera wrote:
From: Aline Manera <alinefm(a)br.ibm.com>
When a template is created, the ISO file is probed to get information
about it: if it is bootable, OS name, OS version, etc.
While checking template integrity we just need to know the ISO file
is still accessible. Which can be done by os.path.isfile() to check
local ISO files and kimchi.utils.check_url_path() for remote ones.
That way we don't need to read the ISO content to check ISO information which
is causing a high latency issue when there is a lot of remote templates
created in kimchi.
Signed-off-by: Aline Manera <alinefm(a)br.ibm.com>
---
src/kimchi/vmtemplate.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index a3be21b..e2d78a4 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -26,6 +26,7 @@ import urlparse
from kimchi import osinfo
from kimchi.exception import InvalidParameter, IsoFormatError
from kimchi.isoinfo import IsoImage
+from kimchi.utils import check_url_path
QEMU_NAMESPACE =
"xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'"
@@ -354,9 +355,7 @@ class VMTemplate(object):
# validate iso integrity
# FIXME when we support multiples cdrom devices
iso = self.info['cdrom']
- try:
- self.get_iso_info(iso)
- except Exception:
+ if not (os.path.isfile(iso) or check_url_path(iso)):
invalid['cdrom'] = [iso]
self.info['invalid'] = invalid