Python libvirt.registerErrorHandler() Examples

The following are 3 code examples of libvirt.registerErrorHandler(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module libvirt , or try the search function .
Example #1
Source File: app.py    From qubes-core-admin with GNU Lesser General Public License v2.1 6 votes vote down vote up
def init_vmm_connection(self):
        """Initialise connection

        This method is automatically called when getting"""
        if self._libvirt_conn is not None:
            # Already initialized
            return
        if self._offline_mode:
            # Do not initialize in offline mode
            raise qubes.exc.QubesException(
                'VMM operations disabled in offline mode')

        if 'xen.lowlevel.xs' in sys.modules:
            self._xs = xen.lowlevel.xs.xs()
        if 'xen.lowlevel.xc' in sys.modules:
            self._xc = xen.lowlevel.xc.xc()
        self._libvirt_conn = VirConnectWrapper(
            qubes.config.defaults['libvirt_uri'],
            reconnect_cb=self._libvirt_reconnect_cb)
        libvirt.registerErrorHandler(self._libvirt_error_handler, None) 
Example #2
Source File: app.py    From qubes-core-admin with GNU Lesser General Public License v2.1 5 votes vote down vote up
def close(self):
        libvirt.registerErrorHandler(None, None)
        if self._xs:
            self._xs.close()
            self._xs = None
        if self._libvirt_conn:
            self._libvirt_conn.close()
            self._libvirt_conn = None
        self._xc = None  # and pray it will get garbage-collected 
Example #3
Source File: libvirtd.py    From virt-who with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, logger, config, dest, terminate_event=None,
                 interval=None, oneshot=False, registerEvents=True):
        super(Libvirtd, self).__init__(logger, config, dest,
                                       terminate_event=terminate_event,
                                       interval=interval,
                                       oneshot=oneshot)
        self.changedCallback = None
        self.registerEvents = registerEvents
        self._host_capabilities_xml = None
        self._host_socket_count = None
        self._host_uuid = None
        self._host_name = None
        self.eventLoopThread = None
        libvirt.registerErrorHandler(lambda ctx, error: None, None)