libvirtpy 0.1.0__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.
- libvirtpy/__init__.py +5 -0
- libvirtpy/client/__init__.py +54 -0
- libvirtpy/client/_bases.py +326 -0
- libvirtpy/client/_runner.py +57 -0
- libvirtpy/client/aio.py +5922 -0
- libvirtpy/client/client.py +5695 -0
- libvirtpy/client/operations/__init__.py +631 -0
- libvirtpy/client/operations/_common.py +495 -0
- libvirtpy/client/operations/checkpoint.py +196 -0
- libvirtpy/client/operations/connection.py +93 -0
- libvirtpy/client/operations/connection_extra.py +256 -0
- libvirtpy/client/operations/domain.py +306 -0
- libvirtpy/client/operations/domain_agent.py +115 -0
- libvirtpy/client/operations/domain_block.py +368 -0
- libvirtpy/client/operations/domain_info.py +400 -0
- libvirtpy/client/operations/domain_lifecycle.py +338 -0
- libvirtpy/client/operations/domain_migration.py +164 -0
- libvirtpy/client/operations/domain_network.py +113 -0
- libvirtpy/client/operations/domain_tuning.py +494 -0
- libvirtpy/client/operations/host.py +246 -0
- libvirtpy/client/operations/host_interface.py +100 -0
- libvirtpy/client/operations/interface_extra.py +45 -0
- libvirtpy/client/operations/network.py +135 -0
- libvirtpy/client/operations/network_info.py +155 -0
- libvirtpy/client/operations/network_port.py +142 -0
- libvirtpy/client/operations/node_device.py +76 -0
- libvirtpy/client/operations/node_device_info.py +189 -0
- libvirtpy/client/operations/nwfilter.py +67 -0
- libvirtpy/client/operations/nwfilter_binding.py +74 -0
- libvirtpy/client/operations/secret.py +93 -0
- libvirtpy/client/operations/secret_extra.py +24 -0
- libvirtpy/client/operations/snapshot.py +100 -0
- libvirtpy/client/operations/snapshot_tree.py +114 -0
- libvirtpy/client/operations/storage.py +267 -0
- libvirtpy/client/operations/storage_info.py +188 -0
- libvirtpy/client/operations/streams.py +201 -0
- libvirtpy/client/references.py +249 -0
- libvirtpy/client/subscribing.py +88 -0
- libvirtpy/client/testing/__init__.py +24 -0
- libvirtpy/client/testing/_common.py +167 -0
- libvirtpy/client/testing/_domains.py +294 -0
- libvirtpy/client/testing/_objects.py +205 -0
- libvirtpy/client/testing/_state.py +246 -0
- libvirtpy/client/testing/_storage.py +171 -0
- libvirtpy/client/testing/async_transport.py +30 -0
- libvirtpy/client/testing/fake.py +81 -0
- libvirtpy/client/transport.py +87 -0
- libvirtpy/client/types.py +59 -0
- libvirtpy/client/wire.py +436 -0
- libvirtpy/client/wire_aio.py +348 -0
- libvirtpy/errors.py +7 -0
- libvirtpy/py.typed +0 -0
- libvirtpy/rpc/__init__.py +1 -0
- libvirtpy/rpc/aio.py +387 -0
- libvirtpy/rpc/cpumap.py +48 -0
- libvirtpy/rpc/errors.py +186 -0
- libvirtpy/rpc/events.py +259 -0
- libvirtpy/rpc/options.py +66 -0
- libvirtpy/rpc/procedure.py +27 -0
- libvirtpy/rpc/protocol/__init__.py +0 -0
- libvirtpy/rpc/protocol/procedures.py +5163 -0
- libvirtpy/rpc/protocol/typed_hints.py +210 -0
- libvirtpy/rpc/protocol/types.py +9299 -0
- libvirtpy/rpc/remote.py +295 -0
- libvirtpy/rpc/remote_aio.py +106 -0
- libvirtpy/rpc/sasl.py +467 -0
- libvirtpy/rpc/session.py +424 -0
- libvirtpy/rpc/sockets.py +251 -0
- libvirtpy/rpc/stream.py +323 -0
- libvirtpy/rpc/subscription.py +451 -0
- libvirtpy/rpc/sync.py +460 -0
- libvirtpy/rpc/typed_params.py +97 -0
- libvirtpy/rpc/uri.py +85 -0
- libvirtpy/rpc/xdr.py +552 -0
- libvirtpy/xml/__init__.py +49 -0
- libvirtpy/xml/_base.py +145 -0
- libvirtpy/xml/_shared/__init__.py +1 -0
- libvirtpy/xml/_shared/metadata.py +67 -0
- libvirtpy/xml/_shared/network.py +108 -0
- libvirtpy/xml/_shared/storage.py +131 -0
- libvirtpy/xml/_shared/sysinfo.py +83 -0
- libvirtpy/xml/_types.py +197 -0
- libvirtpy/xml/_xml_element.py +134 -0
- libvirtpy/xml/backup/__init__.py +25 -0
- libvirtpy/xml/backup/backup.py +89 -0
- libvirtpy/xml/backup/checkpoint.py +48 -0
- libvirtpy/xml/capabilities/__init__.py +43 -0
- libvirtpy/xml/capabilities/domain.py +436 -0
- libvirtpy/xml/capabilities/host.py +413 -0
- libvirtpy/xml/capabilities/storagepool.py +59 -0
- libvirtpy/xml/domain/__init__.py +493 -0
- libvirtpy/xml/domain/blkiotune.py +81 -0
- libvirtpy/xml/domain/clock.py +79 -0
- libvirtpy/xml/domain/cpu.py +265 -0
- libvirtpy/xml/domain/devices/__init__.py +495 -0
- libvirtpy/xml/domain/devices/address.py +152 -0
- libvirtpy/xml/domain/devices/audio.py +204 -0
- libvirtpy/xml/domain/devices/chardev.py +197 -0
- libvirtpy/xml/domain/devices/common.py +75 -0
- libvirtpy/xml/domain/devices/controller.py +262 -0
- libvirtpy/xml/domain/devices/devices.py +79 -0
- libvirtpy/xml/domain/devices/disk.py +471 -0
- libvirtpy/xml/domain/devices/filesystem.py +206 -0
- libvirtpy/xml/domain/devices/graphics.py +245 -0
- libvirtpy/xml/domain/devices/hostdev.py +221 -0
- libvirtpy/xml/domain/devices/input.py +89 -0
- libvirtpy/xml/domain/devices/interface.py +459 -0
- libvirtpy/xml/domain/devices/iommu.py +54 -0
- libvirtpy/xml/domain/devices/memballoon.py +42 -0
- libvirtpy/xml/domain/devices/memory_device.py +101 -0
- libvirtpy/xml/domain/devices/misc.py +169 -0
- libvirtpy/xml/domain/devices/nvram.py +20 -0
- libvirtpy/xml/domain/devices/shmem.py +46 -0
- libvirtpy/xml/domain/devices/sound.py +42 -0
- libvirtpy/xml/domain/devices/tpm.py +103 -0
- libvirtpy/xml/domain/devices/usb.py +86 -0
- libvirtpy/xml/domain/devices/video.py +101 -0
- libvirtpy/xml/domain/domain.py +157 -0
- libvirtpy/xml/domain/features.py +312 -0
- libvirtpy/xml/domain/iothread.py +41 -0
- libvirtpy/xml/domain/launch_security.py +82 -0
- libvirtpy/xml/domain/memory.py +149 -0
- libvirtpy/xml/domain/misc.py +113 -0
- libvirtpy/xml/domain/namespaces.py +96 -0
- libvirtpy/xml/domain/numa.py +140 -0
- libvirtpy/xml/domain/os.py +267 -0
- libvirtpy/xml/domain/qemu.py +102 -0
- libvirtpy/xml/domain/seclabel.py +29 -0
- libvirtpy/xml/domain/storage_source.py +466 -0
- libvirtpy/xml/domain/sysinfo.py +34 -0
- libvirtpy/xml/interface/__init__.py +17 -0
- libvirtpy/xml/interface/interface.py +153 -0
- libvirtpy/xml/network/__init__.py +101 -0
- libvirtpy/xml/network/network.py +311 -0
- libvirtpy/xml/network/port.py +84 -0
- libvirtpy/xml/nodedev/__init__.py +13 -0
- libvirtpy/xml/nodedev/nodedev.py +490 -0
- libvirtpy/xml/nwfilter/__init__.py +81 -0
- libvirtpy/xml/nwfilter/binding.py +51 -0
- libvirtpy/xml/nwfilter/filter.py +92 -0
- libvirtpy/xml/nwfilter/rules.py +534 -0
- libvirtpy/xml/secret/__init__.py +11 -0
- libvirtpy/xml/secret/secret.py +36 -0
- libvirtpy/xml/snapshot/__init__.py +29 -0
- libvirtpy/xml/snapshot/snapshot.py +136 -0
- libvirtpy/xml/storage/__init__.py +75 -0
- libvirtpy/xml/storage/pool.py +219 -0
- libvirtpy/xml/storage/volume.py +102 -0
- libvirtpy/xml/sysinfo.py +40 -0
- libvirtpy-0.1.0.dist-info/METADATA +109 -0
- libvirtpy-0.1.0.dist-info/RECORD +154 -0
- libvirtpy-0.1.0.dist-info/WHEEL +4 -0
- libvirtpy-0.1.0.dist-info/licenses/LICENSE +501 -0
- libvirtpy-0.1.0.dist-info/licenses/NOTICE +23 -0
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
"""Operations that read facts about a domain."""
|
|
2
|
+
|
|
3
|
+
from libvirtpy.client.operations._common import (
|
|
4
|
+
as_bool,
|
|
5
|
+
as_int,
|
|
6
|
+
as_list,
|
|
7
|
+
as_params,
|
|
8
|
+
as_struct,
|
|
9
|
+
as_text,
|
|
10
|
+
on_domain,
|
|
11
|
+
)
|
|
12
|
+
from libvirtpy.client.references import DomainRef
|
|
13
|
+
from libvirtpy.client.transport import Operation
|
|
14
|
+
from libvirtpy.client.types import JobStats
|
|
15
|
+
from libvirtpy.rpc.protocol import types
|
|
16
|
+
from libvirtpy.rpc.typed_params import TypedValue, from_wire, to_wire
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"abort_domain_job",
|
|
20
|
+
"get_domain_control_info",
|
|
21
|
+
"get_domain_fsinfo",
|
|
22
|
+
"get_domain_guest_info",
|
|
23
|
+
"get_domain_hostname",
|
|
24
|
+
"get_domain_iothread_info",
|
|
25
|
+
"get_domain_job_info",
|
|
26
|
+
"get_domain_job_stats",
|
|
27
|
+
"get_domain_launch_security_info",
|
|
28
|
+
"get_domain_max_memory",
|
|
29
|
+
"get_domain_max_vcpus",
|
|
30
|
+
"get_domain_messages",
|
|
31
|
+
"get_domain_metadata",
|
|
32
|
+
"get_domain_os_type",
|
|
33
|
+
"get_domain_perf_events",
|
|
34
|
+
"get_domain_security_label",
|
|
35
|
+
"get_domain_security_labels",
|
|
36
|
+
"get_domain_time",
|
|
37
|
+
"has_domain_current_snapshot",
|
|
38
|
+
"is_domain_active",
|
|
39
|
+
"is_domain_persistent",
|
|
40
|
+
"is_domain_updated",
|
|
41
|
+
"set_domain_memory_stats_period",
|
|
42
|
+
"set_domain_metadata",
|
|
43
|
+
"set_domain_perf_events",
|
|
44
|
+
"set_domain_time",
|
|
45
|
+
"start_domain_dirty_rate_calc",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def is_domain_active(domain: DomainRef) -> Operation[bool]:
|
|
50
|
+
"""Tell whether the domain is running (or paused).
|
|
51
|
+
|
|
52
|
+
:param domain: the domain.
|
|
53
|
+
:returns: ``True`` if it is active.
|
|
54
|
+
"""
|
|
55
|
+
return as_bool((yield from on_domain(domain, "domain_is_active")))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def is_domain_persistent(domain: DomainRef) -> Operation[bool]:
|
|
59
|
+
"""Tell whether the domain has a stored configuration (it survives a stop).
|
|
60
|
+
|
|
61
|
+
:param domain: the domain.
|
|
62
|
+
:returns: ``True`` if it is persistent, ``False`` if transient.
|
|
63
|
+
"""
|
|
64
|
+
return as_bool((yield from on_domain(domain, "domain_is_persistent")))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def is_domain_updated(domain: DomainRef) -> Operation[bool]:
|
|
68
|
+
"""Tell whether the stored configuration differs from the running one.
|
|
69
|
+
|
|
70
|
+
:param domain: the domain.
|
|
71
|
+
:returns: ``True`` if a restart would change something.
|
|
72
|
+
"""
|
|
73
|
+
return as_bool((yield from on_domain(domain, "domain_is_updated")))
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def get_domain_max_memory(domain: DomainRef) -> Operation[int]:
|
|
77
|
+
"""Return the maximum memory of a domain.
|
|
78
|
+
|
|
79
|
+
:param domain: the domain.
|
|
80
|
+
:returns: the limit in KiB.
|
|
81
|
+
"""
|
|
82
|
+
return as_int((yield from on_domain(domain, "domain_get_max_memory")))
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def get_domain_max_vcpus(domain: DomainRef) -> Operation[int]:
|
|
86
|
+
"""Return the maximum number of virtual CPUs the domain can have.
|
|
87
|
+
|
|
88
|
+
:param domain: the domain.
|
|
89
|
+
:returns: the limit.
|
|
90
|
+
"""
|
|
91
|
+
return as_int((yield from on_domain(domain, "domain_get_max_vcpus")))
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def get_domain_os_type(domain: DomainRef) -> Operation[str]:
|
|
95
|
+
"""Return the operating system type of a domain.
|
|
96
|
+
|
|
97
|
+
:param domain: the domain.
|
|
98
|
+
:returns: e.g. ``hvm`` or ``linux``.
|
|
99
|
+
"""
|
|
100
|
+
return as_text((yield from on_domain(domain, "domain_get_os_type")))
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def get_domain_control_info(
|
|
104
|
+
domain: DomainRef, *, flags: int = 0
|
|
105
|
+
) -> Operation[types.DomainGetControlInfoRet]:
|
|
106
|
+
"""Return the state of the control interface to the hypervisor.
|
|
107
|
+
|
|
108
|
+
:param domain: the domain.
|
|
109
|
+
:param flags: reserved, 0.
|
|
110
|
+
:returns: ``state`` (``virDomainControlState``), ``details`` and ``state_time``
|
|
111
|
+
(milliseconds since the state began).
|
|
112
|
+
"""
|
|
113
|
+
reply = yield from on_domain(domain, "domain_get_control_info", flags=flags)
|
|
114
|
+
return as_struct(reply, types.DomainGetControlInfoRet)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def get_domain_hostname(domain: DomainRef, *, flags: int = 0) -> Operation[str]:
|
|
118
|
+
"""Ask the guest for its host name.
|
|
119
|
+
|
|
120
|
+
:param domain: the domain.
|
|
121
|
+
:param flags: ``virDomainGetHostnameFlags``: guest agent or lease.
|
|
122
|
+
:returns: the host name.
|
|
123
|
+
"""
|
|
124
|
+
return as_text((yield from on_domain(domain, "domain_get_hostname", flags=flags)))
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def get_domain_job_info(domain: DomainRef) -> Operation[types.DomainGetJobInfoRet]:
|
|
128
|
+
"""Return the progress of the current job (migration, save, dump...).
|
|
129
|
+
|
|
130
|
+
:param domain: the domain.
|
|
131
|
+
:returns: the job ``type`` and its time and data counters, as the daemon sends
|
|
132
|
+
them.
|
|
133
|
+
"""
|
|
134
|
+
reply = yield from on_domain(domain, "domain_get_job_info")
|
|
135
|
+
return as_struct(reply, types.DomainGetJobInfoRet)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def get_domain_job_stats(domain: DomainRef, *, flags: int = 0) -> Operation[JobStats]:
|
|
139
|
+
"""Return detailed statistics of the current or the last completed job.
|
|
140
|
+
|
|
141
|
+
:param domain: the domain.
|
|
142
|
+
:param flags: ``virDomainGetJobStatsFlags``: 1 the last completed job.
|
|
143
|
+
:returns: the job type and its statistics by name.
|
|
144
|
+
"""
|
|
145
|
+
reply = yield from on_domain(domain, "domain_get_job_stats", flags=flags)
|
|
146
|
+
stats = as_struct(reply, types.DomainGetJobStatsRet)
|
|
147
|
+
return JobStats(type=stats.type, parameters=from_wire(stats.params))
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def abort_domain_job(domain: DomainRef, *, flags: int = 0) -> Operation[None]:
|
|
151
|
+
"""Cancel the current job of a domain.
|
|
152
|
+
|
|
153
|
+
:param domain: the domain.
|
|
154
|
+
:param flags: ``virDomainAbortJobFlagsValues``: 1 postcopy.
|
|
155
|
+
"""
|
|
156
|
+
yield from on_domain(domain, "domain_abort_job_flags", flags=flags)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def get_domain_time(
|
|
160
|
+
domain: DomainRef, *, flags: int = 0
|
|
161
|
+
) -> Operation[types.DomainGetTimeRet]:
|
|
162
|
+
"""Read the clock of the guest, through the guest agent.
|
|
163
|
+
|
|
164
|
+
:param domain: the domain.
|
|
165
|
+
:param flags: reserved, 0.
|
|
166
|
+
:returns: ``seconds`` and ``nseconds`` since the epoch.
|
|
167
|
+
"""
|
|
168
|
+
reply = yield from on_domain(domain, "domain_get_time", flags=flags)
|
|
169
|
+
return as_struct(reply, types.DomainGetTimeRet)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def set_domain_time(
|
|
173
|
+
domain: DomainRef, seconds: int, nanoseconds: int = 0, *, flags: int = 0
|
|
174
|
+
) -> Operation[None]:
|
|
175
|
+
"""Set the clock of the guest, through the guest agent.
|
|
176
|
+
|
|
177
|
+
:param domain: the domain.
|
|
178
|
+
:param seconds: seconds since the epoch.
|
|
179
|
+
:param nanoseconds: the fraction, in nanoseconds.
|
|
180
|
+
:param flags: ``virDomainSetTimeFlags``: 1 sync from the host clock.
|
|
181
|
+
"""
|
|
182
|
+
yield from on_domain(
|
|
183
|
+
domain, "domain_set_time", seconds=seconds, nseconds=nanoseconds, flags=flags
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def get_domain_iothread_info(
|
|
188
|
+
domain: DomainRef, *, flags: int = 0
|
|
189
|
+
) -> Operation[list[types.DomainIothreadInfo]]:
|
|
190
|
+
"""List the IO threads of a domain and the host CPUs each may use.
|
|
191
|
+
|
|
192
|
+
:param domain: the domain.
|
|
193
|
+
:param flags: ``virDomainModificationImpact``: live or config.
|
|
194
|
+
:returns: one entry per IO thread: ``iothread_id`` and ``cpumap`` (a bit mask).
|
|
195
|
+
"""
|
|
196
|
+
reply = yield from on_domain(domain, "domain_get_iothread_info", flags=flags)
|
|
197
|
+
return [as_struct(item, types.DomainIothreadInfo) for item in as_list(reply)]
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def get_domain_fsinfo(
|
|
201
|
+
domain: DomainRef, *, flags: int = 0
|
|
202
|
+
) -> Operation[list[types.DomainFsinfo]]:
|
|
203
|
+
"""List the file systems of the guest, through the guest agent.
|
|
204
|
+
|
|
205
|
+
:param domain: the domain.
|
|
206
|
+
:param flags: reserved, 0.
|
|
207
|
+
:returns: mount point, name, file system type and disks of each file system.
|
|
208
|
+
"""
|
|
209
|
+
reply = yield from on_domain(domain, "domain_get_fsinfo", flags=flags)
|
|
210
|
+
return [as_struct(item, types.DomainFsinfo) for item in as_list(reply)]
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def get_domain_guest_info(
|
|
214
|
+
domain: DomainRef, info_types: int = 0, *, flags: int = 0
|
|
215
|
+
) -> Operation[dict[str, TypedValue]]:
|
|
216
|
+
"""Ask the guest agent for information about the guest.
|
|
217
|
+
|
|
218
|
+
:param domain: the domain.
|
|
219
|
+
:param info_types: ``virDomainGuestInfoTypes`` bits (users, os, timezone,
|
|
220
|
+
hostname, file systems, disks, interfaces); 0 for all.
|
|
221
|
+
:param flags: reserved, 0.
|
|
222
|
+
:returns: the information by name, e.g. ``os.name``.
|
|
223
|
+
"""
|
|
224
|
+
reply = yield from on_domain(
|
|
225
|
+
domain, "domain_get_guest_info", types=info_types, flags=flags
|
|
226
|
+
)
|
|
227
|
+
return as_params(reply)
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def get_domain_messages(domain: DomainRef, *, flags: int = 0) -> Operation[list[str]]:
|
|
231
|
+
"""Read the messages libvirt has for a domain (for example a failed hot-unplug).
|
|
232
|
+
|
|
233
|
+
:param domain: the domain.
|
|
234
|
+
:param flags: ``virDomainMessageType``: daemon or guest messages; 0 for all.
|
|
235
|
+
:returns: the messages.
|
|
236
|
+
"""
|
|
237
|
+
reply = yield from on_domain(domain, "domain_get_messages", flags=flags)
|
|
238
|
+
return [as_text(item) for item in as_list(reply)]
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
def get_domain_launch_security_info(
|
|
242
|
+
domain: DomainRef, *, flags: int = 0
|
|
243
|
+
) -> Operation[dict[str, TypedValue]]:
|
|
244
|
+
"""Return the confidential-computing launch parameters (SEV, TDX...).
|
|
245
|
+
|
|
246
|
+
:param domain: the domain.
|
|
247
|
+
:param flags: reserved, 0.
|
|
248
|
+
:returns: the parameters by name.
|
|
249
|
+
"""
|
|
250
|
+
reply = yield from on_domain(domain, "domain_get_launch_security_info", flags=flags)
|
|
251
|
+
return as_params(reply)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def get_domain_perf_events(
|
|
255
|
+
domain: DomainRef, *, flags: int = 0
|
|
256
|
+
) -> Operation[dict[str, TypedValue]]:
|
|
257
|
+
"""Return which performance monitoring events are enabled.
|
|
258
|
+
|
|
259
|
+
:param domain: the domain.
|
|
260
|
+
:param flags: ``virDomainModificationImpact``: live or config.
|
|
261
|
+
:returns: event name (``cmt``, ``mbmt``, ``cpu_cycles``...) -> enabled.
|
|
262
|
+
"""
|
|
263
|
+
reply = yield from on_domain(domain, "domain_get_perf_events", flags=flags)
|
|
264
|
+
return as_params(reply)
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
def set_domain_perf_events(
|
|
268
|
+
domain: DomainRef, events: dict[str, bool], *, flags: int = 0
|
|
269
|
+
) -> Operation[None]:
|
|
270
|
+
"""Enable or disable performance monitoring events.
|
|
271
|
+
|
|
272
|
+
:param domain: the domain.
|
|
273
|
+
:param events: event name -> enabled.
|
|
274
|
+
:param flags: ``virDomainModificationImpact``: live or config.
|
|
275
|
+
"""
|
|
276
|
+
yield from on_domain(
|
|
277
|
+
domain, "domain_set_perf_events", params=to_wire(events), flags=flags
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def get_domain_security_label(
|
|
282
|
+
domain: DomainRef,
|
|
283
|
+
) -> Operation[types.DomainGetSecurityLabelRet]:
|
|
284
|
+
"""Return the security label (SELinux, AppArmor) of the domain's process.
|
|
285
|
+
|
|
286
|
+
:param domain: the domain.
|
|
287
|
+
:returns: ``label`` (the text as character codes) and ``enforcing``.
|
|
288
|
+
"""
|
|
289
|
+
reply = yield from on_domain(domain, "domain_get_security_label")
|
|
290
|
+
return as_struct(reply, types.DomainGetSecurityLabelRet)
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
def get_domain_security_labels(
|
|
294
|
+
domain: DomainRef,
|
|
295
|
+
) -> Operation[list[types.DomainGetSecurityLabelRet]]:
|
|
296
|
+
"""Return the security labels of the domain's process, one per security driver.
|
|
297
|
+
|
|
298
|
+
:param domain: the domain.
|
|
299
|
+
:returns: the labels.
|
|
300
|
+
"""
|
|
301
|
+
reply = yield from on_domain(domain, "domain_get_security_label_list")
|
|
302
|
+
return [as_struct(item, types.DomainGetSecurityLabelRet) for item in as_list(reply)]
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
def get_domain_metadata(
|
|
306
|
+
domain: DomainRef,
|
|
307
|
+
metadata_type: int = 0,
|
|
308
|
+
namespace: str | None = None,
|
|
309
|
+
*,
|
|
310
|
+
flags: int = 0,
|
|
311
|
+
) -> Operation[str]:
|
|
312
|
+
"""Read the metadata of a domain.
|
|
313
|
+
|
|
314
|
+
:param domain: the domain.
|
|
315
|
+
:param metadata_type: ``virDomainMetadataType``: 0 description, 1 title,
|
|
316
|
+
2 an element (then give ``namespace``).
|
|
317
|
+
:param namespace: the XML namespace URI of an element; ``None`` otherwise.
|
|
318
|
+
:param flags: ``virDomainModificationImpact``: live or config.
|
|
319
|
+
:returns: the text or the XML of the element.
|
|
320
|
+
"""
|
|
321
|
+
reply = yield from on_domain(
|
|
322
|
+
domain,
|
|
323
|
+
"domain_get_metadata",
|
|
324
|
+
type=metadata_type,
|
|
325
|
+
uri=namespace,
|
|
326
|
+
flags=flags,
|
|
327
|
+
)
|
|
328
|
+
return as_text(reply)
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
def set_domain_metadata(
|
|
332
|
+
domain: DomainRef,
|
|
333
|
+
metadata_type: int,
|
|
334
|
+
value: str | None,
|
|
335
|
+
*,
|
|
336
|
+
key: str | None = None,
|
|
337
|
+
namespace: str | None = None,
|
|
338
|
+
flags: int = 0,
|
|
339
|
+
) -> Operation[None]:
|
|
340
|
+
"""Set the metadata of a domain.
|
|
341
|
+
|
|
342
|
+
:param domain: the domain.
|
|
343
|
+
:param metadata_type: ``virDomainMetadataType``: 0 description, 1 title,
|
|
344
|
+
2 an element (then give ``key`` and ``namespace``).
|
|
345
|
+
:param value: the text or the XML of the element; ``None`` removes it.
|
|
346
|
+
:param key: the namespace prefix of an element.
|
|
347
|
+
:param namespace: the XML namespace URI of an element.
|
|
348
|
+
:param flags: ``virDomainModificationImpact``: live or config.
|
|
349
|
+
"""
|
|
350
|
+
yield from on_domain(
|
|
351
|
+
domain,
|
|
352
|
+
"domain_set_metadata",
|
|
353
|
+
type=metadata_type,
|
|
354
|
+
metadata=value,
|
|
355
|
+
key=key,
|
|
356
|
+
uri=namespace,
|
|
357
|
+
flags=flags,
|
|
358
|
+
)
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
def has_domain_current_snapshot(
|
|
362
|
+
domain: DomainRef, *, flags: int = 0
|
|
363
|
+
) -> Operation[bool]:
|
|
364
|
+
"""Tell whether the domain has a current snapshot.
|
|
365
|
+
|
|
366
|
+
:param domain: the domain.
|
|
367
|
+
:param flags: reserved, 0.
|
|
368
|
+
:returns: ``True`` if there is one.
|
|
369
|
+
"""
|
|
370
|
+
return as_bool(
|
|
371
|
+
(yield from on_domain(domain, "domain_has_current_snapshot", flags=flags))
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
def set_domain_memory_stats_period(
|
|
376
|
+
domain: DomainRef, period: int, *, flags: int = 0
|
|
377
|
+
) -> Operation[None]:
|
|
378
|
+
"""Set how often the balloon driver reports memory statistics.
|
|
379
|
+
|
|
380
|
+
:param domain: the domain.
|
|
381
|
+
:param period: seconds between reports; 0 stops them, negative leaves as is.
|
|
382
|
+
:param flags: ``virDomainModificationImpact``: live or config.
|
|
383
|
+
"""
|
|
384
|
+
yield from on_domain(
|
|
385
|
+
domain, "domain_set_memory_stats_period", period=period, flags=flags
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
def start_domain_dirty_rate_calc(
|
|
390
|
+
domain: DomainRef, seconds: int, *, flags: int = 0
|
|
391
|
+
) -> Operation[None]:
|
|
392
|
+
"""Start measuring how fast the guest dirties its memory.
|
|
393
|
+
|
|
394
|
+
:param domain: the domain.
|
|
395
|
+
:param seconds: how long to measure.
|
|
396
|
+
:param flags: ``virDomainDirtyRateCalcFlags``: the measuring mode.
|
|
397
|
+
"""
|
|
398
|
+
yield from on_domain(
|
|
399
|
+
domain, "domain_start_dirty_rate_calc", seconds=seconds, flags=flags
|
|
400
|
+
)
|