maqet 0.0.1.4__py3-none-any.whl → 0.0.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maqet/__init__.py +50 -6
- maqet/__main__.py +96 -0
- maqet/__version__.py +3 -0
- maqet/api/__init__.py +35 -0
- maqet/api/decorators.py +184 -0
- maqet/api/metadata.py +147 -0
- maqet/api/registry.py +182 -0
- maqet/cli.py +71 -0
- maqet/config/__init__.py +26 -0
- maqet/config/merger.py +237 -0
- maqet/config/parser.py +198 -0
- maqet/config/validators.py +519 -0
- maqet/config_handlers.py +684 -0
- maqet/constants.py +200 -0
- maqet/exceptions.py +226 -0
- maqet/formatters.py +294 -0
- maqet/generators/__init__.py +12 -0
- maqet/generators/base_generator.py +101 -0
- maqet/generators/cli_generator.py +635 -0
- maqet/generators/python_generator.py +247 -0
- maqet/generators/rest_generator.py +58 -0
- maqet/handlers/__init__.py +12 -0
- maqet/handlers/base.py +108 -0
- maqet/handlers/init.py +147 -0
- maqet/handlers/stage.py +196 -0
- maqet/ipc/__init__.py +29 -0
- maqet/ipc/retry.py +265 -0
- maqet/ipc/runner_client.py +285 -0
- maqet/ipc/unix_socket_server.py +239 -0
- maqet/logger.py +160 -55
- maqet/machine.py +884 -0
- maqet/managers/__init__.py +7 -0
- maqet/managers/qmp_manager.py +333 -0
- maqet/managers/snapshot_coordinator.py +327 -0
- maqet/managers/vm_manager.py +683 -0
- maqet/maqet.py +1120 -0
- maqet/os_interactions.py +46 -0
- maqet/process_spawner.py +395 -0
- maqet/qemu_args.py +76 -0
- maqet/qmp/__init__.py +10 -0
- maqet/qmp/commands.py +92 -0
- maqet/qmp/keyboard.py +311 -0
- maqet/qmp/qmp.py +17 -0
- maqet/snapshot.py +473 -0
- maqet/state.py +958 -0
- maqet/storage.py +702 -162
- maqet/validation/__init__.py +9 -0
- maqet/validation/config_validator.py +170 -0
- maqet/vm_runner.py +523 -0
- maqet-0.0.5.dist-info/METADATA +237 -0
- maqet-0.0.5.dist-info/RECORD +55 -0
- {maqet-0.0.1.4.dist-info → maqet-0.0.5.dist-info}/WHEEL +1 -1
- maqet-0.0.5.dist-info/entry_points.txt +2 -0
- maqet-0.0.5.dist-info/licenses/LICENSE +21 -0
- {maqet-0.0.1.4.dist-info → maqet-0.0.5.dist-info}/top_level.txt +0 -1
- maqet/core.py +0 -411
- maqet/functions.py +0 -104
- maqet-0.0.1.4.dist-info/METADATA +0 -6
- maqet-0.0.1.4.dist-info/RECORD +0 -33
- qemu/machine/__init__.py +0 -36
- qemu/machine/console_socket.py +0 -142
- qemu/machine/machine.py +0 -954
- qemu/machine/py.typed +0 -0
- qemu/machine/qtest.py +0 -191
- qemu/qmp/__init__.py +0 -59
- qemu/qmp/error.py +0 -50
- qemu/qmp/events.py +0 -717
- qemu/qmp/legacy.py +0 -319
- qemu/qmp/message.py +0 -209
- qemu/qmp/models.py +0 -146
- qemu/qmp/protocol.py +0 -1057
- qemu/qmp/py.typed +0 -0
- qemu/qmp/qmp_client.py +0 -655
- qemu/qmp/qmp_shell.py +0 -618
- qemu/qmp/qmp_tui.py +0 -655
- qemu/qmp/util.py +0 -219
- qemu/utils/__init__.py +0 -162
- qemu/utils/accel.py +0 -84
- qemu/utils/py.typed +0 -0
- qemu/utils/qemu_ga_client.py +0 -323
- qemu/utils/qom.py +0 -273
- qemu/utils/qom_common.py +0 -175
- qemu/utils/qom_fuse.py +0 -207
qemu/machine/console_socket.py
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
QEMU Console Socket Module:
|
3
|
-
|
4
|
-
This python module implements a ConsoleSocket object,
|
5
|
-
which can drain a socket and optionally dump the bytes to file.
|
6
|
-
"""
|
7
|
-
# Copyright 2020 Linaro
|
8
|
-
#
|
9
|
-
# Authors:
|
10
|
-
# Robert Foley <robert.foley@linaro.org>
|
11
|
-
#
|
12
|
-
# This code is licensed under the GPL version 2 or later. See
|
13
|
-
# the COPYING file in the top-level directory.
|
14
|
-
#
|
15
|
-
|
16
|
-
from collections import deque
|
17
|
-
import socket
|
18
|
-
import threading
|
19
|
-
import time
|
20
|
-
from typing import Deque, Optional
|
21
|
-
|
22
|
-
|
23
|
-
class ConsoleSocket(socket.socket):
|
24
|
-
"""
|
25
|
-
ConsoleSocket represents a socket attached to a char device.
|
26
|
-
|
27
|
-
:param address: An AF_UNIX path or address.
|
28
|
-
:param sock_fd: Optionally, an existing socket file descriptor.
|
29
|
-
One of address or sock_fd must be specified.
|
30
|
-
:param file: Optionally, a filename to log to.
|
31
|
-
:param drain: Optionally, drains the socket and places the bytes
|
32
|
-
into an in memory buffer for later processing.
|
33
|
-
"""
|
34
|
-
def __init__(self,
|
35
|
-
address: Optional[str] = None,
|
36
|
-
sock_fd: Optional[int] = None,
|
37
|
-
file: Optional[str] = None,
|
38
|
-
drain: bool = False):
|
39
|
-
if address is None and sock_fd is None:
|
40
|
-
raise ValueError("one of 'address' or 'sock_fd' must be specified")
|
41
|
-
if address is not None and sock_fd is not None:
|
42
|
-
raise ValueError("can't specify both 'address' and 'sock_fd'")
|
43
|
-
|
44
|
-
self._recv_timeout_sec = 300.0
|
45
|
-
self._sleep_time = 0.5
|
46
|
-
self._buffer: Deque[int] = deque()
|
47
|
-
if address is not None:
|
48
|
-
socket.socket.__init__(self, socket.AF_UNIX, socket.SOCK_STREAM)
|
49
|
-
self.connect(address)
|
50
|
-
else:
|
51
|
-
assert sock_fd is not None
|
52
|
-
socket.socket.__init__(self, fileno=sock_fd)
|
53
|
-
self._logfile = None
|
54
|
-
if file:
|
55
|
-
# pylint: disable=consider-using-with
|
56
|
-
self._logfile = open(file, "bw")
|
57
|
-
self._open = True
|
58
|
-
self._drain_thread = None
|
59
|
-
if drain:
|
60
|
-
self._drain_thread = self._thread_start()
|
61
|
-
|
62
|
-
def __repr__(self) -> str:
|
63
|
-
tmp = super().__repr__()
|
64
|
-
tmp = tmp.rstrip(">")
|
65
|
-
tmp = "%s, logfile=%s, drain_thread=%s>" % (tmp, self._logfile,
|
66
|
-
self._drain_thread)
|
67
|
-
return tmp
|
68
|
-
|
69
|
-
def _drain_fn(self) -> None:
|
70
|
-
"""Drains the socket and runs while the socket is open."""
|
71
|
-
while self._open:
|
72
|
-
try:
|
73
|
-
self._drain_socket()
|
74
|
-
except socket.timeout:
|
75
|
-
# The socket is expected to timeout since we set a
|
76
|
-
# short timeout to allow the thread to exit when
|
77
|
-
# self._open is set to False.
|
78
|
-
time.sleep(self._sleep_time)
|
79
|
-
|
80
|
-
def _thread_start(self) -> threading.Thread:
|
81
|
-
"""Kick off a thread to drain the socket."""
|
82
|
-
# Configure socket to not block and timeout.
|
83
|
-
# This allows our drain thread to not block
|
84
|
-
# on receive and exit smoothly.
|
85
|
-
socket.socket.setblocking(self, False)
|
86
|
-
socket.socket.settimeout(self, 1)
|
87
|
-
drain_thread = threading.Thread(target=self._drain_fn)
|
88
|
-
drain_thread.daemon = True
|
89
|
-
drain_thread.start()
|
90
|
-
return drain_thread
|
91
|
-
|
92
|
-
def close(self) -> None:
|
93
|
-
"""Close the base object and wait for the thread to terminate"""
|
94
|
-
if self._open:
|
95
|
-
self._open = False
|
96
|
-
if self._drain_thread is not None:
|
97
|
-
thread, self._drain_thread = self._drain_thread, None
|
98
|
-
thread.join()
|
99
|
-
socket.socket.close(self)
|
100
|
-
if self._logfile:
|
101
|
-
self._logfile.close()
|
102
|
-
self._logfile = None
|
103
|
-
|
104
|
-
def _drain_socket(self) -> None:
|
105
|
-
"""process arriving characters into in memory _buffer"""
|
106
|
-
data = socket.socket.recv(self, 1)
|
107
|
-
if self._logfile:
|
108
|
-
self._logfile.write(data)
|
109
|
-
self._logfile.flush()
|
110
|
-
self._buffer.extend(data)
|
111
|
-
|
112
|
-
def recv(self, bufsize: int = 1, flags: int = 0) -> bytes:
|
113
|
-
"""Return chars from in memory buffer.
|
114
|
-
Maintains the same API as socket.socket.recv.
|
115
|
-
"""
|
116
|
-
if self._drain_thread is None:
|
117
|
-
# Not buffering the socket, pass thru to socket.
|
118
|
-
return socket.socket.recv(self, bufsize, flags)
|
119
|
-
assert not flags, "Cannot pass flags to recv() in drained mode"
|
120
|
-
start_time = time.time()
|
121
|
-
while len(self._buffer) < bufsize:
|
122
|
-
time.sleep(self._sleep_time)
|
123
|
-
elapsed_sec = time.time() - start_time
|
124
|
-
if elapsed_sec > self._recv_timeout_sec:
|
125
|
-
raise socket.timeout
|
126
|
-
return bytes((self._buffer.popleft() for i in range(bufsize)))
|
127
|
-
|
128
|
-
def setblocking(self, value: bool) -> None:
|
129
|
-
"""When not draining we pass thru to the socket,
|
130
|
-
since when draining we control socket blocking.
|
131
|
-
"""
|
132
|
-
if self._drain_thread is None:
|
133
|
-
socket.socket.setblocking(self, value)
|
134
|
-
|
135
|
-
def settimeout(self, value: Optional[float]) -> None:
|
136
|
-
"""When not draining we pass thru to the socket,
|
137
|
-
since when draining we control the timeout.
|
138
|
-
"""
|
139
|
-
if value is not None:
|
140
|
-
self._recv_timeout_sec = value
|
141
|
-
if self._drain_thread is None:
|
142
|
-
socket.socket.settimeout(self, value)
|