<div dir="ltr">huh, i have checked that the error code is just 1, which is "internal error". This is a generic error, and we can not depend on it here.<div>Any ideas?</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Fri, Jan 24, 2014 at 11:04 AM, Aline Manera <span dir="ltr"><<a href="mailto:alinefm@linux.vnet.ibm.com" target="_blank">alinefm@linux.vnet.ibm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><div class="im">
<div>On 01/24/2014 12:22 AM, me,apporc
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>I mean a 'False' can't tell us whether it's because of
'protocol type error' or not, Maybe it's another error from
libvirt, for example, the ISO_STREAM_XML is deprecated and can
not work with new version of ibvirt. So i don't think the
backend can handle this correctly.</div>
<div><br>
</div>
<div>Frist, this exception got raised is not a 'protocol type
error' and we don't know what it is. Second, the error handler
of libvirt is got replaced, and the error message will not
show now, then we won't see it.</div>
As Cristian pointed out, it's good to just hide the "protocol"
error", but not them all.
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
</div>
</blockquote>
<br></div>
Ok ok.<br>
But please, check the error code instead of comparing strings.<div><div class="h5"><br>
<br>
<blockquote type="cite">
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Jan 24, 2014 at 2:23 AM, Aline
Manera <span dir="ltr"><<a href="mailto:alinefm@linux.vnet.ibm.com" target="_blank">alinefm@linux.vnet.ibm.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>On 01/23/2014 08:16 AM, apporc 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" target="_blank">appleorchard2000@gmail.com</a>><br>
---<br>
src/kimchi/featuretests.py | 14 ++++++++++++--<br>
1 file changed, 12 insertions(+), 2 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>
</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ except libvirt.libvirtError, e:<br>
+ if e.message == "internal error unknown
protocol type '%s'" % protocol:<br>
+ return False<br>
+ else:<br>
+ raise e<br>
</blockquote>
<br>
</div>
</div>
Independent of the exception we should not raise it.<br>
It is a feature test, so if something failed we just return
'False' and backend will handle it correctly.
<div>
<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
finally:<br>
+ libvirt.registerErrorHandler(f=None,
ctx=None)<br>
conn is None or conn.close()<br>
<br>
@staticmethod<br>
</blockquote>
<br>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr">Regards,
<div>apporc</div>
</div>
</div>
</blockquote>
<br>
</div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Regards,<div>apporc</div></div>
</div>