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.
Files changed (154) hide show
  1. libvirtpy/__init__.py +5 -0
  2. libvirtpy/client/__init__.py +54 -0
  3. libvirtpy/client/_bases.py +326 -0
  4. libvirtpy/client/_runner.py +57 -0
  5. libvirtpy/client/aio.py +5922 -0
  6. libvirtpy/client/client.py +5695 -0
  7. libvirtpy/client/operations/__init__.py +631 -0
  8. libvirtpy/client/operations/_common.py +495 -0
  9. libvirtpy/client/operations/checkpoint.py +196 -0
  10. libvirtpy/client/operations/connection.py +93 -0
  11. libvirtpy/client/operations/connection_extra.py +256 -0
  12. libvirtpy/client/operations/domain.py +306 -0
  13. libvirtpy/client/operations/domain_agent.py +115 -0
  14. libvirtpy/client/operations/domain_block.py +368 -0
  15. libvirtpy/client/operations/domain_info.py +400 -0
  16. libvirtpy/client/operations/domain_lifecycle.py +338 -0
  17. libvirtpy/client/operations/domain_migration.py +164 -0
  18. libvirtpy/client/operations/domain_network.py +113 -0
  19. libvirtpy/client/operations/domain_tuning.py +494 -0
  20. libvirtpy/client/operations/host.py +246 -0
  21. libvirtpy/client/operations/host_interface.py +100 -0
  22. libvirtpy/client/operations/interface_extra.py +45 -0
  23. libvirtpy/client/operations/network.py +135 -0
  24. libvirtpy/client/operations/network_info.py +155 -0
  25. libvirtpy/client/operations/network_port.py +142 -0
  26. libvirtpy/client/operations/node_device.py +76 -0
  27. libvirtpy/client/operations/node_device_info.py +189 -0
  28. libvirtpy/client/operations/nwfilter.py +67 -0
  29. libvirtpy/client/operations/nwfilter_binding.py +74 -0
  30. libvirtpy/client/operations/secret.py +93 -0
  31. libvirtpy/client/operations/secret_extra.py +24 -0
  32. libvirtpy/client/operations/snapshot.py +100 -0
  33. libvirtpy/client/operations/snapshot_tree.py +114 -0
  34. libvirtpy/client/operations/storage.py +267 -0
  35. libvirtpy/client/operations/storage_info.py +188 -0
  36. libvirtpy/client/operations/streams.py +201 -0
  37. libvirtpy/client/references.py +249 -0
  38. libvirtpy/client/subscribing.py +88 -0
  39. libvirtpy/client/testing/__init__.py +24 -0
  40. libvirtpy/client/testing/_common.py +167 -0
  41. libvirtpy/client/testing/_domains.py +294 -0
  42. libvirtpy/client/testing/_objects.py +205 -0
  43. libvirtpy/client/testing/_state.py +246 -0
  44. libvirtpy/client/testing/_storage.py +171 -0
  45. libvirtpy/client/testing/async_transport.py +30 -0
  46. libvirtpy/client/testing/fake.py +81 -0
  47. libvirtpy/client/transport.py +87 -0
  48. libvirtpy/client/types.py +59 -0
  49. libvirtpy/client/wire.py +436 -0
  50. libvirtpy/client/wire_aio.py +348 -0
  51. libvirtpy/errors.py +7 -0
  52. libvirtpy/py.typed +0 -0
  53. libvirtpy/rpc/__init__.py +1 -0
  54. libvirtpy/rpc/aio.py +387 -0
  55. libvirtpy/rpc/cpumap.py +48 -0
  56. libvirtpy/rpc/errors.py +186 -0
  57. libvirtpy/rpc/events.py +259 -0
  58. libvirtpy/rpc/options.py +66 -0
  59. libvirtpy/rpc/procedure.py +27 -0
  60. libvirtpy/rpc/protocol/__init__.py +0 -0
  61. libvirtpy/rpc/protocol/procedures.py +5163 -0
  62. libvirtpy/rpc/protocol/typed_hints.py +210 -0
  63. libvirtpy/rpc/protocol/types.py +9299 -0
  64. libvirtpy/rpc/remote.py +295 -0
  65. libvirtpy/rpc/remote_aio.py +106 -0
  66. libvirtpy/rpc/sasl.py +467 -0
  67. libvirtpy/rpc/session.py +424 -0
  68. libvirtpy/rpc/sockets.py +251 -0
  69. libvirtpy/rpc/stream.py +323 -0
  70. libvirtpy/rpc/subscription.py +451 -0
  71. libvirtpy/rpc/sync.py +460 -0
  72. libvirtpy/rpc/typed_params.py +97 -0
  73. libvirtpy/rpc/uri.py +85 -0
  74. libvirtpy/rpc/xdr.py +552 -0
  75. libvirtpy/xml/__init__.py +49 -0
  76. libvirtpy/xml/_base.py +145 -0
  77. libvirtpy/xml/_shared/__init__.py +1 -0
  78. libvirtpy/xml/_shared/metadata.py +67 -0
  79. libvirtpy/xml/_shared/network.py +108 -0
  80. libvirtpy/xml/_shared/storage.py +131 -0
  81. libvirtpy/xml/_shared/sysinfo.py +83 -0
  82. libvirtpy/xml/_types.py +197 -0
  83. libvirtpy/xml/_xml_element.py +134 -0
  84. libvirtpy/xml/backup/__init__.py +25 -0
  85. libvirtpy/xml/backup/backup.py +89 -0
  86. libvirtpy/xml/backup/checkpoint.py +48 -0
  87. libvirtpy/xml/capabilities/__init__.py +43 -0
  88. libvirtpy/xml/capabilities/domain.py +436 -0
  89. libvirtpy/xml/capabilities/host.py +413 -0
  90. libvirtpy/xml/capabilities/storagepool.py +59 -0
  91. libvirtpy/xml/domain/__init__.py +493 -0
  92. libvirtpy/xml/domain/blkiotune.py +81 -0
  93. libvirtpy/xml/domain/clock.py +79 -0
  94. libvirtpy/xml/domain/cpu.py +265 -0
  95. libvirtpy/xml/domain/devices/__init__.py +495 -0
  96. libvirtpy/xml/domain/devices/address.py +152 -0
  97. libvirtpy/xml/domain/devices/audio.py +204 -0
  98. libvirtpy/xml/domain/devices/chardev.py +197 -0
  99. libvirtpy/xml/domain/devices/common.py +75 -0
  100. libvirtpy/xml/domain/devices/controller.py +262 -0
  101. libvirtpy/xml/domain/devices/devices.py +79 -0
  102. libvirtpy/xml/domain/devices/disk.py +471 -0
  103. libvirtpy/xml/domain/devices/filesystem.py +206 -0
  104. libvirtpy/xml/domain/devices/graphics.py +245 -0
  105. libvirtpy/xml/domain/devices/hostdev.py +221 -0
  106. libvirtpy/xml/domain/devices/input.py +89 -0
  107. libvirtpy/xml/domain/devices/interface.py +459 -0
  108. libvirtpy/xml/domain/devices/iommu.py +54 -0
  109. libvirtpy/xml/domain/devices/memballoon.py +42 -0
  110. libvirtpy/xml/domain/devices/memory_device.py +101 -0
  111. libvirtpy/xml/domain/devices/misc.py +169 -0
  112. libvirtpy/xml/domain/devices/nvram.py +20 -0
  113. libvirtpy/xml/domain/devices/shmem.py +46 -0
  114. libvirtpy/xml/domain/devices/sound.py +42 -0
  115. libvirtpy/xml/domain/devices/tpm.py +103 -0
  116. libvirtpy/xml/domain/devices/usb.py +86 -0
  117. libvirtpy/xml/domain/devices/video.py +101 -0
  118. libvirtpy/xml/domain/domain.py +157 -0
  119. libvirtpy/xml/domain/features.py +312 -0
  120. libvirtpy/xml/domain/iothread.py +41 -0
  121. libvirtpy/xml/domain/launch_security.py +82 -0
  122. libvirtpy/xml/domain/memory.py +149 -0
  123. libvirtpy/xml/domain/misc.py +113 -0
  124. libvirtpy/xml/domain/namespaces.py +96 -0
  125. libvirtpy/xml/domain/numa.py +140 -0
  126. libvirtpy/xml/domain/os.py +267 -0
  127. libvirtpy/xml/domain/qemu.py +102 -0
  128. libvirtpy/xml/domain/seclabel.py +29 -0
  129. libvirtpy/xml/domain/storage_source.py +466 -0
  130. libvirtpy/xml/domain/sysinfo.py +34 -0
  131. libvirtpy/xml/interface/__init__.py +17 -0
  132. libvirtpy/xml/interface/interface.py +153 -0
  133. libvirtpy/xml/network/__init__.py +101 -0
  134. libvirtpy/xml/network/network.py +311 -0
  135. libvirtpy/xml/network/port.py +84 -0
  136. libvirtpy/xml/nodedev/__init__.py +13 -0
  137. libvirtpy/xml/nodedev/nodedev.py +490 -0
  138. libvirtpy/xml/nwfilter/__init__.py +81 -0
  139. libvirtpy/xml/nwfilter/binding.py +51 -0
  140. libvirtpy/xml/nwfilter/filter.py +92 -0
  141. libvirtpy/xml/nwfilter/rules.py +534 -0
  142. libvirtpy/xml/secret/__init__.py +11 -0
  143. libvirtpy/xml/secret/secret.py +36 -0
  144. libvirtpy/xml/snapshot/__init__.py +29 -0
  145. libvirtpy/xml/snapshot/snapshot.py +136 -0
  146. libvirtpy/xml/storage/__init__.py +75 -0
  147. libvirtpy/xml/storage/pool.py +219 -0
  148. libvirtpy/xml/storage/volume.py +102 -0
  149. libvirtpy/xml/sysinfo.py +40 -0
  150. libvirtpy-0.1.0.dist-info/METADATA +109 -0
  151. libvirtpy-0.1.0.dist-info/RECORD +154 -0
  152. libvirtpy-0.1.0.dist-info/WHEEL +4 -0
  153. libvirtpy-0.1.0.dist-info/licenses/LICENSE +501 -0
  154. libvirtpy-0.1.0.dist-info/licenses/NOTICE +23 -0
@@ -0,0 +1,265 @@
1
+ """``<vcpu>`` and ``<cpu>`` (``<cputune>`` will follow).
2
+
3
+ See https://libvirt.org/formatdomain.html#cpu-allocation and
4
+ https://libvirt.org/formatdomain.html#cpu-model-and-topology
5
+ """
6
+
7
+ from typing import Literal
8
+
9
+ from pydantic import Field
10
+ from pydantic_xml import attr, element
11
+
12
+ from libvirtpy.xml._base import LibvirtXmlModel
13
+ from libvirtpy.xml._types import OnOff, OptionalText, SizeUnit, YesNo
14
+ from libvirtpy.xml.domain.numa import Numa
15
+
16
+ __all__ = [
17
+ "CacheTune",
18
+ "CacheTuneCache",
19
+ "CacheTuneMonitor",
20
+ "Cpu",
21
+ "CpuCache",
22
+ "CpuFeature",
23
+ "CpuModel",
24
+ "CpuTopology",
25
+ "Cputune",
26
+ "EmulatorPin",
27
+ "EmulatorSched",
28
+ "EnergyTune",
29
+ "EnergyTuneMonitor",
30
+ "IothreadPin",
31
+ "IothreadSched",
32
+ "MaxPhysAddr",
33
+ "MemoryTune",
34
+ "MemoryTuneMonitor",
35
+ "MemoryTuneNode",
36
+ "Vcpu",
37
+ "VcpuInfo",
38
+ "VcpuPin",
39
+ "VcpuSched",
40
+ "Vcpus",
41
+ ]
42
+
43
+
44
+ class Vcpu(LibvirtXmlModel, tag="vcpu"):
45
+ """``<vcpu>``: the maximum number of virtual CPUs."""
46
+
47
+ value: int = Field(ge=1, description="Element text: maximum vCPU count.")
48
+ placement: Literal["static", "auto"] | None = attr(name="placement", default=None)
49
+ cpuset: str | None = attr(
50
+ name="cpuset",
51
+ default=None,
52
+ description="Host CPUs the vCPUs may run on, e.g. ``1-4,^3,6``.",
53
+ )
54
+ current: int | None = attr(
55
+ name="current",
56
+ default=None,
57
+ description="vCPUs enabled at boot. Since 0.8.5.",
58
+ )
59
+
60
+
61
+ class CpuModel(LibvirtXmlModel, tag="model"):
62
+ """``<model>``: the CPU model the guest sees."""
63
+
64
+ value: OptionalText = Field(
65
+ default=None, description="Element text: model name, e.g. ``Skylake-Client``."
66
+ )
67
+ fallback: Literal["allow", "forbid"] | None = attr(name="fallback", default=None)
68
+ vendor_id: str | None = attr(
69
+ name="vendor_id",
70
+ default=None,
71
+ pattern=r"^[^,]{12}$",
72
+ description="CPUID vendor string, exactly 12 characters. Since 0.10.0.",
73
+ )
74
+
75
+
76
+ class CpuTopology(LibvirtXmlModel, tag="topology"):
77
+ """``<topology>``: how vCPUs are split into sockets, cores and threads."""
78
+
79
+ sockets: int = attr(name="sockets", ge=1)
80
+ dies: int | None = attr(name="dies", default=None, ge=1)
81
+ clusters: int | None = attr(name="clusters", default=None, ge=1)
82
+ cores: int = attr(name="cores", ge=1)
83
+ threads: int = attr(name="threads", ge=1)
84
+
85
+
86
+ class CpuFeature(LibvirtXmlModel, tag="feature"):
87
+ """``<feature>``: a CPU feature and how strictly to apply it."""
88
+
89
+ policy: Literal["force", "require", "optional", "disable", "forbid"] = attr(
90
+ name="policy"
91
+ )
92
+ name: str = attr(name="name")
93
+
94
+
95
+ class CpuCache(LibvirtXmlModel, tag="cache"):
96
+ """``<cache>`` in ``<cpu>``: the CPU cache the guest sees. Since 3.3.0."""
97
+
98
+ level: int | None = attr(name="level", default=None, ge=1, le=3)
99
+ mode: Literal["emulate", "passthrough", "disable"] = attr(name="mode")
100
+
101
+
102
+ class MaxPhysAddr(LibvirtXmlModel, tag="maxphysaddr"):
103
+ """``<maxphysaddr>``: the guest's physical address size. Since 8.7.0."""
104
+
105
+ mode: Literal["emulate", "passthrough"] = attr(name="mode")
106
+ bits: int | None = attr(name="bits", default=None, ge=0)
107
+ limit: int | None = attr(name="limit", default=None, ge=0)
108
+
109
+
110
+ class Cpu(LibvirtXmlModel, tag="cpu"):
111
+ """``<cpu>``: CPU model, features, topology and NUMA layout."""
112
+
113
+ mode: Literal["custom", "host-model", "host-passthrough", "maximum"] | None = attr(
114
+ name="mode", default=None
115
+ )
116
+ match: Literal["minimum", "exact", "strict"] | None = attr(
117
+ name="match", default=None
118
+ )
119
+ check: Literal["none", "partial", "full"] | None = attr(name="check", default=None)
120
+ deprecated_features: OnOff | None = attr(name="deprecated_features", default=None)
121
+ migratable: OnOff | None = attr(name="migratable", default=None)
122
+ model: CpuModel | None = element(tag="model", default=None)
123
+ vendor: str | None = element(tag="vendor", default=None)
124
+ topology: CpuTopology | None = element(tag="topology", default=None)
125
+ features: list[CpuFeature] = element(tag="feature", default_factory=list)
126
+ numa: Numa | None = element(tag="numa", default=None)
127
+ cache: CpuCache | None = element(tag="cache", default=None)
128
+ max_phys_addr: MaxPhysAddr | None = element(tag="maxphysaddr", default=None)
129
+
130
+
131
+ class VcpuInfo(LibvirtXmlModel, tag="vcpu"):
132
+ """``<vcpu>`` inside ``<vcpus>``: the state of one virtual CPU."""
133
+
134
+ id: int = attr(name="id", ge=0)
135
+ enabled: YesNo = attr(name="enabled")
136
+ hotpluggable: YesNo | None = attr(name="hotpluggable", default=None)
137
+ order: int | None = attr(name="order", default=None, ge=0)
138
+
139
+
140
+ class Vcpus(LibvirtXmlModel, tag="vcpus"):
141
+ """``<vcpus>``: per-vCPU hotplug state."""
142
+
143
+ vcpus: list[VcpuInfo] = element(tag="vcpu", default_factory=list)
144
+
145
+
146
+ class VcpuPin(LibvirtXmlModel, tag="vcpupin"):
147
+ """``<vcpupin>``: pin one vCPU to host CPUs."""
148
+
149
+ vcpu: int = attr(name="vcpu", ge=0)
150
+ cpuset: str = attr(name="cpuset")
151
+
152
+
153
+ class EmulatorPin(LibvirtXmlModel, tag="emulatorpin"):
154
+ """``<emulatorpin>``: pin the emulator threads to host CPUs."""
155
+
156
+ cpuset: str = attr(name="cpuset")
157
+
158
+
159
+ class IothreadPin(LibvirtXmlModel, tag="iothreadpin"):
160
+ """``<iothreadpin>``: pin one I/O thread to host CPUs."""
161
+
162
+ iothread: int = attr(name="iothread", ge=0)
163
+ cpuset: str = attr(name="cpuset")
164
+
165
+
166
+ Scheduler = Literal["batch", "idle", "fifo", "rr"]
167
+
168
+
169
+ class VcpuSched(LibvirtXmlModel, tag="vcpusched"):
170
+ """``<vcpusched>``: the scheduler policy of some vCPUs."""
171
+
172
+ vcpus: str | None = attr(name="vcpus", default=None)
173
+ scheduler: Scheduler = attr(name="scheduler")
174
+ priority: int | None = attr(name="priority", default=None, ge=0, le=65535)
175
+
176
+
177
+ class IothreadSched(LibvirtXmlModel, tag="iothreadsched"):
178
+ """``<iothreadsched>``: the scheduler policy of some I/O threads."""
179
+
180
+ iothreads: str | None = attr(name="iothreads", default=None)
181
+ scheduler: Scheduler = attr(name="scheduler")
182
+ priority: int | None = attr(name="priority", default=None, ge=0, le=65535)
183
+
184
+
185
+ class EmulatorSched(LibvirtXmlModel, tag="emulatorsched"):
186
+ """``<emulatorsched>``: the scheduler policy of the emulator threads."""
187
+
188
+ scheduler: Scheduler = attr(name="scheduler")
189
+ priority: int | None = attr(name="priority", default=None, ge=0, le=65535)
190
+
191
+
192
+ class CacheTuneCache(LibvirtXmlModel, tag="cache"):
193
+ id: int = attr(name="id", ge=0)
194
+ level: int = attr(name="level", ge=0)
195
+ type: Literal["both", "code", "data"] = attr(name="type")
196
+ size: int = attr(name="size", ge=0)
197
+ unit: SizeUnit | None = attr(name="unit", default=None)
198
+
199
+
200
+ class CacheTuneMonitor(LibvirtXmlModel, tag="monitor"):
201
+ level: int = attr(name="level", ge=0)
202
+ vcpus: str | None = attr(name="vcpus", default=None)
203
+
204
+
205
+ class CacheTune(LibvirtXmlModel, tag="cachetune"):
206
+ """``<cachetune>``: CPU cache allocation (Intel CAT). Since 4.1.0."""
207
+
208
+ vcpus: str | None = attr(name="vcpus", default=None)
209
+ id: str | None = attr(name="id", default=None)
210
+ caches: list[CacheTuneCache] = element(tag="cache", default_factory=list)
211
+ monitors: list[CacheTuneMonitor] = element(tag="monitor", default_factory=list)
212
+
213
+
214
+ class MemoryTuneNode(LibvirtXmlModel, tag="node"):
215
+ id: int = attr(name="id", ge=0)
216
+ bandwidth: int = attr(name="bandwidth", ge=0)
217
+
218
+
219
+ class MemoryTuneMonitor(LibvirtXmlModel, tag="monitor"):
220
+ vcpus: str | None = attr(name="vcpus", default=None)
221
+
222
+
223
+ class MemoryTune(LibvirtXmlModel, tag="memorytune"):
224
+ """``<memorytune>``: memory bandwidth allocation. Since 4.7.0."""
225
+
226
+ vcpus: str | None = attr(name="vcpus", default=None)
227
+ nodes: list[MemoryTuneNode] = element(tag="node", default_factory=list)
228
+ monitors: list[MemoryTuneMonitor] = element(tag="monitor", default_factory=list)
229
+
230
+
231
+ class EnergyTuneMonitor(LibvirtXmlModel, tag="monitor"):
232
+ vcpus: str | None = attr(name="vcpus", default=None)
233
+
234
+
235
+ class EnergyTune(LibvirtXmlModel, tag="energytune"):
236
+ """``<energytune>``: CPU energy monitoring."""
237
+
238
+ vcpus: str | None = attr(name="vcpus", default=None)
239
+ id: str | None = attr(name="id", default=None)
240
+ monitors: list[EnergyTuneMonitor] = element(tag="monitor", default_factory=list)
241
+
242
+
243
+ class Cputune(LibvirtXmlModel, tag="cputune"):
244
+ """``<cputune>``: CPU scheduling, pinning and resource control."""
245
+
246
+ shares: int | None = element(tag="shares", default=None, ge=0)
247
+ global_period: int | None = element(tag="global_period", default=None)
248
+ global_quota: int | None = element(tag="global_quota", default=None)
249
+ period: int | None = element(tag="period", default=None)
250
+ quota: int | None = element(tag="quota", default=None)
251
+ emulator_period: int | None = element(tag="emulator_period", default=None)
252
+ emulator_quota: int | None = element(tag="emulator_quota", default=None)
253
+ iothread_period: int | None = element(tag="iothread_period", default=None)
254
+ iothread_quota: int | None = element(tag="iothread_quota", default=None)
255
+ vcpupins: list[VcpuPin] = element(tag="vcpupin", default_factory=list)
256
+ emulatorpin: EmulatorPin | None = element(tag="emulatorpin", default=None)
257
+ iothreadpins: list[IothreadPin] = element(tag="iothreadpin", default_factory=list)
258
+ vcpuscheds: list[VcpuSched] = element(tag="vcpusched", default_factory=list)
259
+ iothreadscheds: list[IothreadSched] = element(
260
+ tag="iothreadsched", default_factory=list
261
+ )
262
+ emulatorsched: EmulatorSched | None = element(tag="emulatorsched", default=None)
263
+ cachetunes: list[CacheTune] = element(tag="cachetune", default_factory=list)
264
+ memorytunes: list[MemoryTune] = element(tag="memorytune", default_factory=list)
265
+ energytunes: list[EnergyTune] = element(tag="energytune", default_factory=list)