<div dir="ltr">Sorry, Please ignore this patch, it's wrong.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 23, 2014 at 6:08 PM, apporc <span dir="ltr"><<a href="mailto:appleorchard2000@gmail.com" target="_blank">appleorchard2000@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">When running feature tests, we get bunch of error messages as below:<br>
<br>
*** Running feature tests ***<br>
libvirt: Domain Config error : internal error unknown protocol type 'http'<br>
libvirt: Domain Config error : internal error unknown protocol type 'https'<br>
libvirt: Domain Config error : internal error unknown protocol type 'ftp'<br>
libvirt: Domain Config error : internal error unknown protocol type 'ftps'<br>
libvirt: Domain Config error : internal error unknown protocol type 'tftp'<br>
*** Feature tests completed ***<br>
<br>
By replacing default error handler of libvirt, this patch succeeded to<br>
avoid the error. After Featuretest, the default error handler will be restored.<br>
The default error handler(in libvirtmod.so) just do one thing, it prints the error message to<br>
stderr before we catch the exception in python.<br>
<br>
Signed-off-by: apporc <<a href="mailto:appleorchard2000@gmail.com">appleorchard2000@gmail.com</a>><br>
---<br>
src/kimchi/featuretests.py | 14 ++++++++++++--<br>
src/kimchi/model.py | 2 --<br>
2 files changed, 12 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/kimchi/featuretests.py b/src/kimchi/featuretests.py<br>
index a5755a2..d68fcb8 100644<br>
--- a/src/kimchi/featuretests.py<br>
+++ b/src/kimchi/featuretests.py<br>
@@ -57,16 +57,26 @@ class FeatureTests(object):<br>
<br>
@staticmethod<br>
def libvirt_supports_iso_stream(protocol):<br>
+ def libvirt_errorhandler(userdata, error):<br>
+ # A libvirt error handler to ignore annoying messages in stderr<br>
+ pass<br>
+<br>
xml = ISO_STREAM_XML % {'protocol': protocol}<br>
conn = None<br>
try:<br>
+ # Register the error handler to hide libvirt error in stderr<br>
+ libvirt.registerErrorHandler(f=libvirt_errorhandler, ctx=None)<br>
conn = libvirt.open('qemu:///system')<br>
dom = conn.defineXML(xml)<br>
dom.undefine()<br>
return True<br>
- except libvirt.libvirtError:<br>
- return False<br>
+ except libvirt.libvirtError, e:<br>
+ if e.message == "internal error unknown protocol type '%s'" % protocol:<br>
+ return False<br>
+ else:<br>
+ raise e<br>
finally:<br>
+ libvirt.registerErrorHandler(f=None, ctx=None)<br>
conn is None or conn.close()<br>
<br>
@staticmethod<br>
diff --git a/src/kimchi/model.py b/src/kimchi/model.py<br>
index ea528c6..f4f8224 100644<br>
--- a/src/kimchi/model.py<br>
+++ b/src/kimchi/model.py<br>
@@ -225,7 +225,6 @@ class Model(object):<br>
sys.exit(1)<br>
<br>
def _set_capabilities(self):<br>
- <a href="http://kimchi_log.info" target="_blank">kimchi_log.info</a>("*** Running feature tests ***")<br>
self.qemu_stream = FeatureTests.qemu_supports_iso_stream()<br>
self.qemu_stream_dns = FeatureTests.qemu_iso_stream_dns()<br>
<br>
@@ -234,7 +233,6 @@ class Model(object):<br>
if FeatureTests.libvirt_supports_iso_stream(p):<br>
self.libvirt_stream_protocols.append(p)<br>
<br>
- <a href="http://kimchi_log.info" target="_blank">kimchi_log.info</a>("*** Feature tests completed ***")<br>
_set_capabilities.priority = 90<br>
<br>
def get_capabilities(self):<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.9.5<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Regards,<div>apporc</div></div>
</div>