[PATCH 0/2] bug fix: Do not probe ISO file while checking template integrity

From: Aline Manera <alinefm@br.ibm.com> Aline Manera (2): vmtemplate: Remove useless imports bug fix: Do not probe ISO file while checking template integrity src/kimchi/vmtemplate.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- 1.7.10.4

From: Aline Manera <alinefm@br.ibm.com> urllib2 and kimchi.isoinfo are not used in the vmtemplate.py code So there is no need to import those modules. Signed-off-by: Aline Manera <alinefm@br.ibm.com> --- src/kimchi/vmtemplate.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py index 3e52be5..a3be21b 100644 --- a/src/kimchi/vmtemplate.py +++ b/src/kimchi/vmtemplate.py @@ -20,11 +20,9 @@ import os import string import socket -import urllib import urlparse -from kimchi import isoinfo from kimchi import osinfo from kimchi.exception import InvalidParameter, IsoFormatError from kimchi.isoinfo import IsoImage -- 1.7.10.4

Reviewed-by: Royce Lv<lvroyce@linux.vnet.ibm.com> On 2014年03月01日 00:24, Aline Manera wrote:
From: Aline Manera <alinefm@br.ibm.com>
urllib2 and kimchi.isoinfo are not used in the vmtemplate.py code So there is no need to import those modules.
Signed-off-by: Aline Manera <alinefm@br.ibm.com> --- src/kimchi/vmtemplate.py | 2 -- 1 file changed, 2 deletions(-)
diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py index 3e52be5..a3be21b 100644 --- a/src/kimchi/vmtemplate.py +++ b/src/kimchi/vmtemplate.py @@ -20,11 +20,9 @@ import os import string import socket -import urllib import urlparse
-from kimchi import isoinfo from kimchi import osinfo from kimchi.exception import InvalidParameter, IsoFormatError from kimchi.isoinfo import IsoImage

From: Aline Manera <alinefm@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@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 -- 1.7.10.4

Reviewed-by: Royce Lv<lvroyce@linux.vnet.ibm.com> On 2014年03月01日 00:24, Aline Manera wrote:
From: Aline Manera <alinefm@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@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

Reviewed-by: Crístian Viana <vianac@linux.vnet.ibm.com> Am 28-02-2014 13:24, schrieb Aline Manera:
From: Aline Manera <alinefm@br.ibm.com>
Aline Manera (2): vmtemplate: Remove useless imports bug fix: Do not probe ISO file while checking template integrity
src/kimchi/vmtemplate.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
participants (3)
-
Aline Manera
-
Crístian Viana
-
Royce Lv