<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 01/24/2014 01:54 PM, Sheldon wrote:<br>
    </div>
    <blockquote cite="mid:52E28CBA.4090808@linux.vnet.ibm.com"
      type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">On 01/24/2014 12:48 PM, me,apporc
        wrote:<br>
      </div>
      <blockquote
cite="mid:CAOBTi0s05KetnJjkvdeuhqwEJLxkoFXsPOm0XtuD9PFKjSCdMw@mail.gmail.com"
        type="cite">
        <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>
        </div>
      </blockquote>
      <a moz-do-not-send="true" class="moz-txt-link-freetext"
        href="http://libvirt.org/html/libvirt-virterror.html#virErrorNumber">http://libvirt.org/html/libvirt-virterror.html#virErrorNumber</a><br>
      <br>
      Sure, maybe the the virErrorNumber can not distinguish all kinds
      of error.<br>
      Can we log all errors on a special file,&nbsp; kimchi_log.log?<br>
      <br>
      IMO, we just do not want to print these errors on stderr, but we
      really want some errors info?<br>
      &nbsp;<br>
      <a moz-do-not-send="true" class="moz-txt-link-freetext"
        href="http://libvirt.org/html/libvirt-virterror.html#virErrorLevel">http://libvirt.org/html/libvirt-virterror.html#virErrorLevel</a><br>
      we may just log error message. <br>
      <br>
    </blockquote>
    <br>
    I agree, Sheldon!<br>
    We can "return False" in all cases and log the error messages in the
    kimchi log.<br>
    <br>
    <blockquote cite="mid:52E28CBA.4090808@linux.vnet.ibm.com"
      type="cite">
      <blockquote
cite="mid:CAOBTi0s05KetnJjkvdeuhqwEJLxkoFXsPOm0XtuD9PFKjSCdMw@mail.gmail.com"
        type="cite">
        <div class="gmail_extra"><br>
          <div class="gmail_quote"> On Fri, Jan 24, 2014 at 11:04 AM,
            Aline Manera <span dir="ltr">&lt;<a moz-do-not-send="true"
                href="mailto:alinefm@linux.vnet.ibm.com" target="_blank">alinefm@linux.vnet.ibm.com</a>&gt;</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.&nbsp;
                      <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">&lt;<a
                              moz-do-not-send="true"
                              href="mailto:alinefm@linux.vnet.ibm.com"
                              target="_blank">alinefm@linux.vnet.ibm.com</a>&gt;</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 &lt;<a
                                    moz-do-not-send="true"
                                    href="mailto:appleorchard2000@gmail.com"
                                    target="_blank">appleorchard2000@gmail.com</a>&gt;<br>
                                  ---<br>
                                  &nbsp; src/kimchi/featuretests.py | &nbsp; 14
                                  ++++++++++++--<br>
                                  &nbsp; 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>
                                  &nbsp; &nbsp; &nbsp; @staticmethod<br>
                                  &nbsp; &nbsp; &nbsp; def
                                  libvirt_supports_iso_stream(protocol):<br>
                                  + &nbsp; &nbsp; &nbsp; &nbsp;def
                                  libvirt_errorhandler(userdata, error):<br>
                                  + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# A libvirt error handler
                                  to ignore annoying messages in stderr<br>
                                  + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pass<br>
                                  +<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xml = ISO_STREAM_XML %
                                  {'protocol': protocol}<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; conn = None<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:<br>
                                  + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Register the error
                                  handler to hide libvirt error in
                                  stderr<br>
                                  + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                  &nbsp;libvirt.registerErrorHandler(f=libvirt_errorhandler,
                                  ctx=None)<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; conn =
                                  libvirt.open('qemu:///system')<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dom =
                                  conn.defineXML(xml)<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dom.undefine()<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return True<br>
                                  - &nbsp; &nbsp; &nbsp; &nbsp;except libvirt.libvirtError:<br>
                                  - &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return False<br>
                                </blockquote>
                                <br>
                                <blockquote class="gmail_quote"
                                  style="margin:0 0 0
                                  .8ex;border-left:1px #ccc
                                  solid;padding-left:1ex"> + &nbsp; &nbsp; &nbsp;
                                  &nbsp;except libvirt.libvirtError, e:<br>
                                  + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if e.message == "internal
                                  error unknown protocol type '%s'" %
                                  protocol:<br>
                                  + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return False<br>
                                  + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else:<br>
                                  + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;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"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                  finally:<br>
                                  + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                  &nbsp;libvirt.registerErrorHandler(f=None,
                                  ctx=None)<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; conn is None or
                                  conn.close()<br>
                                  <br>
                                  &nbsp; &nbsp; &nbsp; @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>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
Kimchi-devel mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Kimchi-devel@ovirt.org">Kimchi-devel@ovirt.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a>
</pre>
      </blockquote>
      <br>
      <br>
      <pre class="moz-signature" cols="72">-- 
Thanks and best regards!

Sheldon Feng(&#20911;&#23569;&#21512;)<a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com">&lt;shaohef@linux.vnet.ibm.com&gt;</a>
IBM Linux Technology Center</pre>
    </blockquote>
    <br>
  </body>
</html>