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,413 @@
1
+ """``<capabilities>``: what the host and its hypervisors can do.
2
+
3
+ Read-only: libvirt generates it, you only parse it.
4
+
5
+ See https://libvirt.org/formatcaps.html
6
+ """
7
+
8
+ from typing import Literal
9
+
10
+ from pydantic import Field
11
+ from pydantic_xml import attr, element
12
+
13
+ from libvirtpy.xml._base import LibvirtXmlModel
14
+ from libvirtpy.xml._types import (
15
+ OnOff,
16
+ PresenceFlag,
17
+ ScaledInteger,
18
+ SizeUnit,
19
+ Uuid,
20
+ YesNo,
21
+ )
22
+
23
+ __all__ = [
24
+ "Capabilities",
25
+ "GuestArch",
26
+ "GuestCapabilities",
27
+ "GuestDomain",
28
+ "HostCapabilities",
29
+ "HostCpu",
30
+ "HostTopology",
31
+ "SecModel",
32
+ ]
33
+
34
+
35
+ # host <cpu>
36
+
37
+
38
+ class HostCpuFeatures(LibvirtXmlModel, tag="features"):
39
+ """``<features>``: legacy x86 feature flags."""
40
+
41
+ pae: PresenceFlag | None = element(tag="pae", default=None)
42
+ nonpae: PresenceFlag | None = element(tag="nonpae", default=None)
43
+ vmx: PresenceFlag | None = element(tag="vmx", default=None)
44
+ svm: PresenceFlag | None = element(tag="svm", default=None)
45
+
46
+
47
+ class Microcode(LibvirtXmlModel, tag="microcode"):
48
+ version: int = attr(name="version", ge=1)
49
+
50
+
51
+ class Signature(LibvirtXmlModel, tag="signature"):
52
+ family: int = attr(name="family", ge=1)
53
+ model: int = attr(name="model", ge=0)
54
+ stepping: int = attr(name="stepping", ge=0)
55
+
56
+
57
+ class Counter(LibvirtXmlModel, tag="counter"):
58
+ name: str = attr(name="name")
59
+ frequency: int = attr(name="frequency", ge=1)
60
+ scaling: YesNo = attr(name="scaling")
61
+
62
+
63
+ class HostCpuTopology(LibvirtXmlModel, tag="topology"):
64
+ sockets: int = attr(name="sockets", ge=1)
65
+ dies: int | None = attr(name="dies", default=None, ge=1)
66
+ clusters: int | None = attr(name="clusters", default=None, ge=1)
67
+ cores: int = attr(name="cores", ge=1)
68
+ threads: int = attr(name="threads", ge=1)
69
+
70
+
71
+ class HostMaxPhysAddr(LibvirtXmlModel, tag="maxphysaddr"):
72
+ mode: Literal["emulate", "passthrough"] = attr(name="mode")
73
+ bits: int | None = attr(name="bits", default=None, ge=0)
74
+ limit: int | None = attr(name="limit", default=None, ge=0)
75
+
76
+
77
+ class HostCpuFeature(LibvirtXmlModel, tag="feature"):
78
+ name: str = attr(name="name")
79
+
80
+
81
+ class HostPages(LibvirtXmlModel, tag="pages"):
82
+ """``<pages>``: a supported page size."""
83
+
84
+ unit: SizeUnit | None = attr(name="unit", default=None)
85
+ size: int = attr(name="size", ge=0)
86
+
87
+
88
+ class HostCpu(LibvirtXmlModel, tag="cpu"):
89
+ """``<cpu>``: the host CPU."""
90
+
91
+ arch: str = element(tag="arch")
92
+ features_legacy: HostCpuFeatures | None = element(tag="features", default=None)
93
+ model: str | None = element(tag="model", default=None)
94
+ vendor: str | None = element(tag="vendor", default=None)
95
+ microcode: Microcode | None = element(tag="microcode", default=None)
96
+ signature: Signature | None = element(tag="signature", default=None)
97
+ counter: Counter | None = element(tag="counter", default=None)
98
+ topology: HostCpuTopology | None = element(tag="topology", default=None)
99
+ maxphysaddr: HostMaxPhysAddr | None = element(tag="maxphysaddr", default=None)
100
+ features: list[HostCpuFeature] = element(tag="feature", default_factory=list)
101
+ pages: list[HostPages] = element(tag="pages", default_factory=list)
102
+
103
+
104
+ # power, iommu, ...
105
+
106
+
107
+ class PowerManagement(LibvirtXmlModel, tag="power_management"):
108
+ suspend_mem: PresenceFlag | None = element(tag="suspend_mem", default=None)
109
+ suspend_disk: PresenceFlag | None = element(tag="suspend_disk", default=None)
110
+ suspend_hybrid: PresenceFlag | None = element(tag="suspend_hybrid", default=None)
111
+
112
+
113
+ class HostIommu(LibvirtXmlModel, tag="iommu"):
114
+ support: YesNo | None = attr(name="support", default=None)
115
+
116
+
117
+ class UriTransports(LibvirtXmlModel, tag="uri_transports"):
118
+ transports: list[Literal["vpxmigr", "tcp", "rdma", "vzmigr"]] = element(
119
+ tag="uri_transport", default_factory=list
120
+ )
121
+
122
+
123
+ class MigrationFeatures(LibvirtXmlModel, tag="migration_features"):
124
+ live: PresenceFlag | None = element(tag="live", default=None)
125
+ uri_transports: UriTransports | None = element(tag="uri_transports", default=None)
126
+
127
+
128
+ # topology
129
+
130
+
131
+ class CellMemory(ScaledInteger, tag="memory"):
132
+ """``<memory>``: the memory of a NUMA cell."""
133
+
134
+
135
+ class CellPages(LibvirtXmlModel, tag="pages"):
136
+ """``<pages>``: how many pages of a size the cell has."""
137
+
138
+ value: int = Field(ge=0, description="Element text: the number of pages.")
139
+ unit: SizeUnit | None = attr(name="unit", default=None)
140
+ size: int = attr(name="size", ge=0)
141
+
142
+
143
+ class CellSibling(LibvirtXmlModel, tag="sibling"):
144
+ id: int = attr(name="id", ge=0)
145
+ value: int = attr(name="value", ge=0)
146
+
147
+
148
+ class CellDistances(LibvirtXmlModel, tag="distances"):
149
+ siblings: list[CellSibling] = element(tag="sibling", default_factory=list)
150
+
151
+
152
+ class CellCacheSize(LibvirtXmlModel, tag="size"):
153
+ value: int = attr(name="value", ge=0)
154
+ unit: SizeUnit = attr(name="unit")
155
+
156
+
157
+ class CellCacheLine(LibvirtXmlModel, tag="line"):
158
+ value: int = attr(name="value", ge=0)
159
+ unit: SizeUnit = attr(name="unit")
160
+
161
+
162
+ class CellCache(LibvirtXmlModel, tag="cache"):
163
+ level: int = attr(name="level", ge=0)
164
+ associativity: Literal["none", "direct", "full"] = attr(name="associativity")
165
+ policy: Literal["none", "writeback", "writethrough"] = attr(name="policy")
166
+ size: CellCacheSize = element(tag="size")
167
+ line: CellCacheLine = element(tag="line")
168
+
169
+
170
+ class CellCpu(LibvirtXmlModel, tag="cpu"):
171
+ id: int = attr(name="id", ge=0)
172
+ socket_id: int | None = attr(name="socket_id", default=None, ge=0)
173
+ die_id: int | None = attr(name="die_id", default=None, ge=0)
174
+ cluster_id: int | None = attr(name="cluster_id", default=None, ge=0)
175
+ core_id: int | None = attr(name="core_id", default=None, ge=0)
176
+ siblings: str | None = attr(name="siblings", default=None)
177
+
178
+
179
+ class CellCpus(LibvirtXmlModel, tag="cpus"):
180
+ num: int = attr(name="num", ge=0)
181
+ cpus: list[CellCpu] = element(tag="cpu", default_factory=list)
182
+
183
+
184
+ class Cell(LibvirtXmlModel, tag="cell"):
185
+ """``<cell>``: one NUMA node of the host."""
186
+
187
+ id: int = attr(name="id", ge=0)
188
+ memory: CellMemory | None = element(tag="memory", default=None)
189
+ pages: list[CellPages] = element(tag="pages", default_factory=list)
190
+ distances: CellDistances | None = element(tag="distances", default=None)
191
+ caches: list[CellCache] = element(tag="cache", default_factory=list)
192
+ cpus: CellCpus | None = element(tag="cpus", default=None)
193
+
194
+
195
+ class Cells(LibvirtXmlModel, tag="cells"):
196
+ num: int = attr(name="num", ge=0)
197
+ cells: list[Cell] = element(tag="cell", default_factory=list)
198
+
199
+
200
+ class InterconnectLatency(LibvirtXmlModel, tag="latency"):
201
+ initiator: int = attr(name="initiator", ge=0)
202
+ target: int = attr(name="target", ge=0)
203
+ cache: int | None = attr(name="cache", default=None, ge=0)
204
+ type: Literal["access", "read", "write"] = attr(name="type")
205
+ value: int = attr(name="value", ge=0)
206
+
207
+
208
+ class InterconnectBandwidth(LibvirtXmlModel, tag="bandwidth"):
209
+ initiator: int = attr(name="initiator", ge=0)
210
+ target: int = attr(name="target", ge=0)
211
+ cache: int | None = attr(name="cache", default=None, ge=0)
212
+ type: Literal["access", "read", "write"] = attr(name="type")
213
+ value: int = attr(name="value", ge=0)
214
+ unit: SizeUnit = attr(name="unit")
215
+
216
+
217
+ class Interconnects(LibvirtXmlModel, tag="interconnects"):
218
+ latencies: list[InterconnectLatency] = element(tag="latency", default_factory=list)
219
+ bandwidths: list[InterconnectBandwidth] = element(
220
+ tag="bandwidth", default_factory=list
221
+ )
222
+
223
+
224
+ class HostTopology(LibvirtXmlModel, tag="topology"):
225
+ """``<topology>``: the NUMA topology of the host."""
226
+
227
+ cells: Cells = element(tag="cells")
228
+ interconnects: Interconnects | None = element(tag="interconnects", default=None)
229
+
230
+
231
+ # cache, bandwidth
232
+
233
+
234
+ class MonitorFeature(LibvirtXmlModel, tag="feature"):
235
+ name: str = attr(name="name")
236
+
237
+
238
+ class CacheMonitor(LibvirtXmlModel, tag="monitor"):
239
+ """``<monitor>``: the cache/bandwidth monitoring of the CPU."""
240
+
241
+ level: int | None = attr(name="level", default=None, ge=0)
242
+ reuse_threshold: int | None = attr(name="reuseThreshold", default=None, ge=0)
243
+ max_monitors: int = attr(name="maxMonitors", ge=0)
244
+ features: list[MonitorFeature] = element(tag="feature", default_factory=list)
245
+
246
+
247
+ class BankControl(LibvirtXmlModel, tag="control"):
248
+ granularity: int = attr(name="granularity", ge=0)
249
+ min: int | None = attr(name="min", default=None, ge=0)
250
+ unit: SizeUnit | None = attr(name="unit", default=None)
251
+ type: Literal["both", "code", "data"] | None = attr(name="type", default=None)
252
+ max_allocs: int = attr(name="maxAllocs", ge=0)
253
+
254
+
255
+ class CacheBank(LibvirtXmlModel, tag="bank"):
256
+ id: int = attr(name="id", ge=0)
257
+ level: int = attr(name="level", ge=0)
258
+ type: Literal["both", "code", "data"] = attr(name="type")
259
+ size: int = attr(name="size", ge=0)
260
+ unit: SizeUnit = attr(name="unit")
261
+ cpus: str = attr(name="cpus")
262
+ controls: list[BankControl] = element(tag="control", default_factory=list)
263
+
264
+
265
+ class HostCache(LibvirtXmlModel, tag="cache"):
266
+ banks: list[CacheBank] = element(tag="bank", default_factory=list)
267
+ monitor: CacheMonitor | None = element(tag="monitor", default=None)
268
+
269
+
270
+ class BandwidthControl(LibvirtXmlModel, tag="control"):
271
+ granularity: int = attr(name="granularity", ge=0)
272
+ min: int | None = attr(name="min", default=None, ge=0)
273
+ max_allocs: int = attr(name="maxAllocs", ge=0)
274
+
275
+
276
+ class BandwidthNode(LibvirtXmlModel, tag="node"):
277
+ id: int = attr(name="id", ge=0)
278
+ cpus: str = attr(name="cpus")
279
+ controls: list[BandwidthControl] = element(tag="control", default_factory=list)
280
+
281
+
282
+ class MemoryBandwidth(LibvirtXmlModel, tag="memory_bandwidth"):
283
+ nodes: list[BandwidthNode] = element(tag="node", default_factory=list)
284
+ monitor: CacheMonitor | None = element(tag="monitor", default=None)
285
+
286
+
287
+ class EnergyMonitor(LibvirtXmlModel, tag="monitor"):
288
+ max_monitors: int = attr(name="maxMonitors", ge=0)
289
+ features: list[MonitorFeature] = element(tag="feature", default_factory=list)
290
+
291
+
292
+ class Energy(LibvirtXmlModel, tag="energy"):
293
+ monitor: EnergyMonitor = element(tag="monitor")
294
+
295
+
296
+ class SecModelLabel(LibvirtXmlModel, tag="baselabel"):
297
+ value: str = ""
298
+ type: str = attr(name="type")
299
+
300
+
301
+ class SecModel(LibvirtXmlModel, tag="secmodel"):
302
+ """``<secmodel>``: a security driver of the host."""
303
+
304
+ model: str = element(tag="model")
305
+ doi: str = element(tag="doi")
306
+ baselabels: list[SecModelLabel] = element(tag="baselabel", default_factory=list)
307
+
308
+
309
+ class HostCapabilities(LibvirtXmlModel, tag="host"):
310
+ """``<host>``: the host itself."""
311
+
312
+ uuid: Uuid | None = element(tag="uuid", default=None)
313
+ cpu: HostCpu = element(tag="cpu")
314
+ power_management: PowerManagement | None = element(
315
+ tag="power_management", default=None
316
+ )
317
+ iommu: HostIommu | None = element(tag="iommu", default=None)
318
+ migration_features: MigrationFeatures | None = element(
319
+ tag="migration_features", default=None
320
+ )
321
+ topology: HostTopology | None = element(tag="topology", default=None)
322
+ cache: HostCache | None = element(tag="cache", default=None)
323
+ memory_bandwidth: MemoryBandwidth | None = element(
324
+ tag="memory_bandwidth", default=None
325
+ )
326
+ energy: Energy | None = element(tag="energy", default=None)
327
+ secmodels: list[SecModel] = element(tag="secmodel", default_factory=list)
328
+
329
+
330
+ # guests
331
+
332
+
333
+ class Machine(LibvirtXmlModel, tag="machine"):
334
+ """``<machine>``: a machine type."""
335
+
336
+ value: str = ""
337
+ canonical: str | None = attr(name="canonical", default=None)
338
+ max_cpus: int | None = attr(name="maxCpus", default=None, ge=0)
339
+ deprecated: YesNo | None = attr(name="deprecated", default=None)
340
+
341
+
342
+ class GuestDomain(LibvirtXmlModel, tag="domain"):
343
+ """``<domain>``: a hypervisor type that can run this guest architecture."""
344
+
345
+ type: str = attr(name="type", description="e.g. ``kvm`` or ``qemu``.")
346
+ emulator: str | None = element(tag="emulator", default=None)
347
+ machines: list[Machine] = element(tag="machine", default_factory=list)
348
+
349
+
350
+ class GuestArch(LibvirtXmlModel, tag="arch"):
351
+ """``<arch>``: a guest architecture."""
352
+
353
+ name: str = attr(name="name")
354
+ wordsize: Literal["31", "32", "64"] = element(tag="wordsize")
355
+ emulator: str | None = element(tag="emulator", default=None)
356
+ loader: str | None = element(tag="loader", default=None)
357
+ machines: list[Machine] = element(tag="machine", default_factory=list)
358
+ domains: list[GuestDomain] = element(tag="domain", default_factory=list)
359
+
360
+
361
+ class FeatureToggle(LibvirtXmlModel):
362
+ """Base of the guest features that can be toggled."""
363
+
364
+ toggle: YesNo = attr(name="toggle")
365
+ default: OnOff = attr(name="default")
366
+
367
+
368
+ class AcpiToggle(FeatureToggle, tag="acpi"):
369
+ """``<acpi>``."""
370
+
371
+
372
+ class ApicToggle(FeatureToggle, tag="apic"):
373
+ """``<apic>``."""
374
+
375
+
376
+ class DisksnapshotToggle(FeatureToggle, tag="disksnapshot"):
377
+ """``<disksnapshot>``."""
378
+
379
+
380
+ class HapToggle(FeatureToggle, tag="hap"):
381
+ """``<hap>``."""
382
+
383
+
384
+ class GuestFeatures(LibvirtXmlModel, tag="features"):
385
+ """``<features>``: the guest features the hypervisor offers."""
386
+
387
+ pae: PresenceFlag | None = element(tag="pae", default=None)
388
+ nonpae: PresenceFlag | None = element(tag="nonpae", default=None)
389
+ ia64_be: PresenceFlag | None = element(tag="ia64_be", default=None)
390
+ acpi: AcpiToggle | None = element(tag="acpi", default=None)
391
+ apic: ApicToggle | None = element(tag="apic", default=None)
392
+ cpuselection: PresenceFlag | None = element(tag="cpuselection", default=None)
393
+ deviceboot: PresenceFlag | None = element(tag="deviceboot", default=None)
394
+ disksnapshot: DisksnapshotToggle | None = element(tag="disksnapshot", default=None)
395
+ hap: HapToggle | None = element(tag="hap", default=None)
396
+ external_snapshot: PresenceFlag | None = element(
397
+ tag="externalSnapshot", default=None
398
+ )
399
+
400
+
401
+ class GuestCapabilities(LibvirtXmlModel, tag="guest"):
402
+ """``<guest>``: one guest OS type and architecture."""
403
+
404
+ os_type: Literal["xen", "linux", "hvm", "exe", "uml"] = element(tag="os_type")
405
+ arch: GuestArch = element(tag="arch")
406
+ features: GuestFeatures | None = element(tag="features", default=None)
407
+
408
+
409
+ class Capabilities(LibvirtXmlModel, tag="capabilities"):
410
+ """``<capabilities>``: the host and the guests it can run."""
411
+
412
+ host: HostCapabilities = element(tag="host")
413
+ guests: list[GuestCapabilities] = element(tag="guest", default_factory=list)
@@ -0,0 +1,59 @@
1
+ """``<storagepoolCapabilities>``: what each storage pool type supports.
2
+
3
+ Read-only: libvirt generates it, you only parse it.
4
+ """
5
+
6
+ from typing import Literal
7
+
8
+ from pydantic_xml import attr, element
9
+
10
+ from libvirtpy.xml._base import LibvirtXmlModel
11
+
12
+ __all__ = [
13
+ "PoolCapabilities",
14
+ "PoolCapsDefaultFormat",
15
+ "PoolCapsEnum",
16
+ "PoolCapsOptions",
17
+ "StoragePoolCapabilities",
18
+ ]
19
+
20
+
21
+ class PoolCapsDefaultFormat(LibvirtXmlModel, tag="defaultFormat"):
22
+ type: str = attr(name="type")
23
+
24
+
25
+ class PoolCapsEnum(LibvirtXmlModel, tag="enum"):
26
+ name: str = attr(name="name")
27
+ values: list[str] = element(tag="value", default_factory=list)
28
+
29
+
30
+ class PoolCapsOptions(LibvirtXmlModel):
31
+ """Base of ``<poolOptions>`` and ``<volOptions>``."""
32
+
33
+ default_format: PoolCapsDefaultFormat | None = element(
34
+ tag="defaultFormat", default=None
35
+ )
36
+ enums: list[PoolCapsEnum] = element(tag="enum", default_factory=list)
37
+
38
+
39
+ class PoolOptions(PoolCapsOptions, tag="poolOptions"):
40
+ """``<poolOptions>``: formats the pool itself can have."""
41
+
42
+
43
+ class VolOptions(PoolCapsOptions, tag="volOptions"):
44
+ """``<volOptions>``: formats the volumes of the pool can have."""
45
+
46
+
47
+ class PoolCapabilities(LibvirtXmlModel, tag="pool"):
48
+ """``<pool>``: the capabilities of one pool type."""
49
+
50
+ type: str = attr(name="type")
51
+ supported: Literal["yes", "no"] = attr(name="supported")
52
+ pool_options: PoolOptions | None = element(tag="poolOptions", default=None)
53
+ vol_options: VolOptions | None = element(tag="volOptions", default=None)
54
+
55
+
56
+ class StoragePoolCapabilities(LibvirtXmlModel, tag="storagepoolCapabilities"):
57
+ """``<storagepoolCapabilities>``: the capabilities of every pool type."""
58
+
59
+ pools: list[PoolCapabilities] = element(tag="pool", default_factory=list)