xref: /qemu/python/qemu/qmp/__init__.py (revision b2a3cbb8)
1"""
2QEMU Monitor Protocol (QMP) development library & tooling.
3
4This package provides a fairly low-level class for communicating
5asynchronously with QMP protocol servers, as implemented by QEMU, the
6QEMU Guest Agent, and the QEMU Storage Daemon.
7
8`QMPClient` provides the main functionality of this package. All errors
9raised by this library derive from `QMPError`, see `qmp.error` for
10additional detail. See `qmp.events` for an in-depth tutorial on
11managing QMP events.
12"""
13
14# Copyright (C) 2020-2022 John Snow for Red Hat, Inc.
15#
16# Authors:
17#  John Snow <jsnow@redhat.com>
18#
19# Based on earlier work by Luiz Capitulino <lcapitulino@redhat.com>.
20#
21# This work is licensed under the terms of the GNU LGPL, version 2 or
22# later. See the COPYING file in the top-level directory.
23
24import logging
25
26from .error import QMPError
27from .events import EventListener
28from .message import Message
29from .protocol import (
30    ConnectError,
31    Runstate,
32    SocketAddrT,
33    StateError,
34)
35from .qmp_client import ExecInterruptedError, ExecuteError, QMPClient
36
37
38# Suppress logging unless an application engages it.
39logging.getLogger('qemu.qmp').addHandler(logging.NullHandler())
40
41
42# The order of these fields impact the Sphinx documentation order.
43__all__ = (
44    # Classes, most to least important
45    'QMPClient',
46    'Message',
47    'EventListener',
48    'Runstate',
49
50    # Exceptions, most generic to most explicit
51    'QMPError',
52    'StateError',
53    'ConnectError',
54    'ExecuteError',
55    'ExecInterruptedError',
56
57    # Type aliases
58    'SocketAddrT',
59)
60