mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-08 15:13:11 -06:00
virtinst: Run register_libvirt_error_handler on import
We basically want this everywhere, and transparently, so run it on import like we do for gettext setup
This commit is contained in:
parent
ca10e4094b
commit
7d17d5d03b
@ -103,7 +103,6 @@ class _URIs(object):
|
||||
generally every test uses a fresh virConnect, or undoes the
|
||||
persistent changes it makes.
|
||||
"""
|
||||
virtinst.util.register_libvirt_error_handler()
|
||||
is_testdriver_xml = "/testdriver.xml" in uri
|
||||
|
||||
if not (is_testdriver_xml and self._testdriver_error):
|
||||
|
@ -21,7 +21,23 @@ def _setup_i18n():
|
||||
gettext.install("virt-manager", _CLIConfig.gettext_dir)
|
||||
gettext.bindtextdomain("virt-manager", _CLIConfig.gettext_dir)
|
||||
|
||||
|
||||
def _set_libvirt_error_handler():
|
||||
"""
|
||||
Ignore libvirt error reporting, we just use exceptions
|
||||
"""
|
||||
import libvirt
|
||||
|
||||
def libvirt_callback(userdata, err):
|
||||
ignore = userdata
|
||||
ignore = err
|
||||
ctx = None
|
||||
libvirt.registerErrorHandler(libvirt_callback, ctx)
|
||||
|
||||
|
||||
_setup_i18n()
|
||||
_set_libvirt_error_handler()
|
||||
|
||||
|
||||
from virtinst import util
|
||||
from virtinst.uri import URI
|
||||
|
@ -185,8 +185,6 @@ def setupLogging(appname, debug_stdout, do_quiet, cli_app=True):
|
||||
if streamHandler:
|
||||
rootLogger.addHandler(streamHandler)
|
||||
|
||||
util.register_libvirt_error_handler()
|
||||
|
||||
# Log uncaught exceptions
|
||||
def exception_log(typ, val, tb):
|
||||
logging.debug("Uncaught exception:\n%s",
|
||||
|
@ -162,16 +162,6 @@ def get_cache_dir():
|
||||
return os.path.join(ret, "virt-manager")
|
||||
|
||||
|
||||
def register_libvirt_error_handler():
|
||||
"""
|
||||
Ignore libvirt error reporting, we just use exceptions
|
||||
"""
|
||||
def libvirt_callback(userdata, err):
|
||||
ignore = userdata
|
||||
ignore = err
|
||||
libvirt.registerErrorHandler(f=libvirt_callback, ctx=None)
|
||||
|
||||
|
||||
def ensure_meter(meter):
|
||||
if meter:
|
||||
return meter
|
||||
|
Loading…
Reference in New Issue
Block a user