util: Catch libxml2 stderr messages

Similar to what we do with libvirt. Was never really relevant before,
but some of the namespace XML stuff can be a bit noisy even though it
doesn't have any functional impact that I can tell
This commit is contained in:
Cole Robinson 2017-03-06 22:00:23 -05:00
parent 38c10f70f8
commit e7e9369989
2 changed files with 5 additions and 8 deletions

View File

@ -17,9 +17,6 @@
import difflib
import os
import logging
import libvirt
import virtinst
import virtinst.cli
@ -143,11 +140,6 @@ def open_test_remote():
return openconn(uri_test_remote)
def _libvirt_callback(ignore, err):
logging.warn("libvirt errmsg: %s", err[2])
libvirt.registerErrorHandler(f=_libvirt_callback, ctx=None)
def test_create(testconn, xml, define_func="defineXML"):
xml = virtinst.uri.sanitize_xml_for_test_define(xml)

View File

@ -324,7 +324,12 @@ def register_libvirt_error_handler():
def libvirt_callback(userdata, err):
ignore = userdata
ignore = err
def libxml2_callback(userdata, err):
ignore = userdata
logging.debug("libxml2 callback error: %s", err)
libvirt.registerErrorHandler(f=libvirt_callback, ctx=None)
import libxml2
libxml2.registerErrorHandler(f=libxml2_callback, ctx=None)
def ensure_meter(meter):