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,490 @@
1
+ """``<device>``: a host device, as listed by ``virsh nodedev-*``.
2
+
3
+ Each ``<capability type=...>`` is its own class; ``Capability`` is their plain
4
+ union (see ``libvirtpy.xml.domain.devices.address`` for why it is not a
5
+ discriminated union). Capabilities nested in a capability (``phys_function``,
6
+ ``fc_host``, ``removable``, ...) are the union ``SubCapability``.
7
+
8
+ See https://libvirt.org/formatnode.html
9
+ """
10
+
11
+ from typing import Literal
12
+
13
+ from pydantic_xml import attr, element
14
+
15
+ from libvirtpy.xml._base import LibvirtXmlModel
16
+ from libvirtpy.xml._types import Uuid
17
+
18
+ __all__ = [
19
+ "Capability",
20
+ "Device",
21
+ "SubCapability",
22
+ ]
23
+
24
+
25
+ class DeviceAddress(LibvirtXmlModel, tag="address"):
26
+ """``<address>``: a PCI address."""
27
+
28
+ domain: str | None = attr(name="domain", default=None)
29
+ bus: str | None = attr(name="bus", default=None)
30
+ slot: str | None = attr(name="slot", default=None)
31
+ function: str | None = attr(name="function", default=None)
32
+
33
+
34
+ class IdText(LibvirtXmlModel):
35
+ """Base of ``<vendor>`` and ``<product>``: a hex ``id`` and optional text."""
36
+
37
+ value: str = ""
38
+ id: str = attr(name="id", pattern=r"^(0x)?[0-9a-fA-F]+$")
39
+
40
+
41
+ class Vendor(IdText, tag="vendor"):
42
+ """``<vendor>``: the vendor ID and name."""
43
+
44
+
45
+ class Product(IdText, tag="product"):
46
+ """``<product>``: the product ID and name."""
47
+
48
+
49
+ # sub-capabilities
50
+
51
+
52
+ class PhysFunction(LibvirtXmlModel, tag="capability"):
53
+ """``type='phys_function'``: the physical function of a virtual function."""
54
+
55
+ type: Literal["phys_function"] = attr(name="type")
56
+ address: DeviceAddress | None = element(tag="address", default=None)
57
+
58
+
59
+ class VirtFunctions(LibvirtXmlModel, tag="capability"):
60
+ """``type='virt_functions'``: the virtual functions of a physical function."""
61
+
62
+ type: Literal["virt_functions"] = attr(name="type")
63
+ max_count: int | None = attr(name="maxCount", default=None, ge=0)
64
+ addresses: list[DeviceAddress] = element(tag="address", default_factory=list)
65
+
66
+
67
+ class PciBridge(LibvirtXmlModel, tag="capability"):
68
+ """``type='pci-bridge'`` or ``'cardbus-bridge'``."""
69
+
70
+ type: Literal["pci-bridge", "cardbus-bridge"] = attr(name="type")
71
+
72
+
73
+ class MdevTypeInfo(LibvirtXmlModel, tag="type"):
74
+ id: str = attr(name="id")
75
+ name: str | None = element(tag="name", default=None)
76
+ device_api: Literal["vfio-pci", "vfio-ccw", "vfio-ap"] = element(tag="deviceAPI")
77
+ available_instances: int = element(tag="availableInstances", ge=0)
78
+
79
+
80
+ class MdevTypes(LibvirtXmlModel, tag="capability"):
81
+ """``type='mdev_types'``: the mediated device types the device supports."""
82
+
83
+ type: Literal["mdev_types"] = attr(name="type")
84
+ types: list[MdevTypeInfo] = element(tag="type", default_factory=list)
85
+
86
+
87
+ class VpdField(LibvirtXmlModel, tag="vendor_field"):
88
+ value: str = ""
89
+ index: str = attr(name="index")
90
+
91
+
92
+ class VpdSystemField(LibvirtXmlModel, tag="system_field"):
93
+ value: str = ""
94
+ index: str = attr(name="index")
95
+
96
+
97
+ class VpdReadOnlyFields(LibvirtXmlModel, tag="fields"):
98
+ access: Literal["readonly"] = attr(name="access")
99
+ change_level: str | None = element(tag="change_level", default=None)
100
+ manufacture_id: str | None = element(tag="manufacture_id", default=None)
101
+ part_number: str | None = element(tag="part_number", default=None)
102
+ serial_number: str | None = element(tag="serial_number", default=None)
103
+ vendor_fields: list[VpdField] = element(tag="vendor_field", default_factory=list)
104
+
105
+
106
+ class VpdReadWriteFields(LibvirtXmlModel, tag="fields"):
107
+ access: Literal["readwrite"] = attr(name="access")
108
+ asset_tag: str | None = element(tag="asset_tag", default=None)
109
+ vendor_fields: list[VpdField] = element(tag="vendor_field", default_factory=list)
110
+ system_fields: list[VpdSystemField] = element(
111
+ tag="system_field", default_factory=list
112
+ )
113
+
114
+
115
+ class Vpd(LibvirtXmlModel, tag="capability"):
116
+ """``type='vpd'``: the PCI vital product data. Since 7.9.0."""
117
+
118
+ type: Literal["vpd"] = attr(name="type")
119
+ name: str = element(tag="name")
120
+ fields: list[VpdReadOnlyFields | VpdReadWriteFields] = element(
121
+ tag="fields", default_factory=list
122
+ )
123
+
124
+
125
+ class Cap80203(LibvirtXmlModel, tag="capability"):
126
+ """``type='80203'``: an Ethernet interface."""
127
+
128
+ type: Literal["80203"] = attr(name="type")
129
+
130
+
131
+ class Cap80211(LibvirtXmlModel, tag="capability"):
132
+ """``type='80211'``: a wireless interface."""
133
+
134
+ type: Literal["80211"] = attr(name="type")
135
+
136
+
137
+ class FcHost(LibvirtXmlModel, tag="capability"):
138
+ """``type='fc_host'``: a Fibre Channel host."""
139
+
140
+ type: Literal["fc_host"] = attr(name="type")
141
+ wwnn: str = element(tag="wwnn")
142
+ wwpn: str = element(tag="wwpn")
143
+ fabric_wwn: str | None = element(tag="fabric_wwn", default=None)
144
+
145
+
146
+ class VportOps(LibvirtXmlModel, tag="capability"):
147
+ """``type='vport_ops'``: virtual ports of a Fibre Channel host."""
148
+
149
+ type: Literal["vport_ops"] = attr(name="type")
150
+ max_vports: int = element(tag="max_vports", ge=0)
151
+ vports: int = element(tag="vports", ge=0)
152
+
153
+
154
+ class FcRemotePort(LibvirtXmlModel, tag="capability"):
155
+ """``type='fc_remote_port'``: a remote Fibre Channel port."""
156
+
157
+ type: Literal["fc_remote_port"] = attr(name="type")
158
+ rport: str = element(tag="rport")
159
+ wwpn: str = element(tag="wwpn")
160
+
161
+
162
+ class Removable(LibvirtXmlModel, tag="capability"):
163
+ """``type='removable'``: a storage device with removable media."""
164
+
165
+ type: Literal["removable"] = attr(name="type")
166
+ media_available: Literal["0", "1"] = element(tag="media_available")
167
+ media_size: int = element(tag="media_size", ge=0)
168
+ media_label: str | None = element(tag="media_label", default=None)
169
+ logical_block_size: int | None = element(
170
+ tag="logical_block_size", default=None, ge=0
171
+ )
172
+ num_blocks: int | None = element(tag="num_blocks", default=None, ge=0)
173
+
174
+
175
+ class Hotpluggable(LibvirtXmlModel, tag="capability"):
176
+ """``type='hotpluggable'``: a storage device that can be unplugged."""
177
+
178
+ type: Literal["hotpluggable"] = attr(name="type")
179
+
180
+
181
+ class CcwGroupMember(LibvirtXmlModel, tag="capability"):
182
+ """``type='ccwgroup_member'``: a member of a CCW group device."""
183
+
184
+ type: Literal["ccwgroup_member"] = attr(name="type")
185
+ group_device: str = element(tag="group_device")
186
+
187
+
188
+ class QethGroup(LibvirtXmlModel, tag="capability"):
189
+ """``type='qeth_generic'``, ``'qeth_layer2'`` or ``'qeth_layer3'``."""
190
+
191
+ type: Literal["qeth_generic", "qeth_layer2", "qeth_layer3"] = attr(name="type")
192
+ card_type: str = element(tag="card_type")
193
+ chpid: str = element(tag="chpid")
194
+
195
+
196
+ SubCapability = (
197
+ PhysFunction
198
+ | VirtFunctions
199
+ | PciBridge
200
+ | MdevTypes
201
+ | Vpd
202
+ | Cap80203
203
+ | Cap80211
204
+ | FcHost
205
+ | VportOps
206
+ | FcRemotePort
207
+ | Removable
208
+ | Hotpluggable
209
+ | CcwGroupMember
210
+ | QethGroup
211
+ )
212
+ """Any capability nested in another; chosen by its ``type`` attribute."""
213
+
214
+
215
+ # capabilities
216
+
217
+
218
+ class SystemHardware(LibvirtXmlModel, tag="hardware"):
219
+ vendor: str | None = element(tag="vendor", default=None)
220
+ version: str | None = element(tag="version", default=None)
221
+ serial: str | None = element(tag="serial", default=None)
222
+ uuid: Uuid = element(tag="uuid")
223
+
224
+
225
+ class SystemFirmware(LibvirtXmlModel, tag="firmware"):
226
+ vendor: str | None = element(tag="vendor", default=None)
227
+ version: str | None = element(tag="version", default=None)
228
+ release_date: str | None = element(tag="release_date", default=None)
229
+
230
+
231
+ class SystemCapability(LibvirtXmlModel, tag="capability"):
232
+ type: Literal["system"] = attr(name="type")
233
+ product: str | None = element(tag="product", default=None)
234
+ hardware: SystemHardware = element(tag="hardware")
235
+ firmware: SystemFirmware = element(tag="firmware")
236
+
237
+
238
+ class IommuGroup(LibvirtXmlModel, tag="iommuGroup"):
239
+ number: int = attr(name="number", ge=0)
240
+ addresses: list[DeviceAddress] = element(tag="address", default_factory=list)
241
+
242
+
243
+ class Numa(LibvirtXmlModel, tag="numa"):
244
+ node: int | None = attr(name="node", default=None)
245
+
246
+
247
+ class PciExpressLink(LibvirtXmlModel, tag="link"):
248
+ validity: Literal["cap", "sta"] = attr(name="validity")
249
+ port: int | None = attr(name="port", default=None, ge=0)
250
+ speed: str | None = attr(name="speed", default=None)
251
+ width: int = attr(name="width", ge=0)
252
+
253
+
254
+ class PciExpress(LibvirtXmlModel, tag="pci-express"):
255
+ links: list[PciExpressLink] = element(tag="link", default_factory=list)
256
+
257
+
258
+ class PciCapability(LibvirtXmlModel, tag="capability"):
259
+ type: Literal["pci"] = attr(name="type")
260
+ class_: str | None = element(tag="class", default=None)
261
+ domain: int = element(tag="domain", ge=0)
262
+ bus: int = element(tag="bus", ge=0)
263
+ slot: int = element(tag="slot", ge=0)
264
+ function: int = element(tag="function", ge=0)
265
+ product: Product = element(tag="product")
266
+ vendor: Vendor = element(tag="vendor")
267
+ capabilities: list[SubCapability] = element(tag="capability", default_factory=list)
268
+ iommu_group: IommuGroup | None = element(tag="iommuGroup", default=None)
269
+ numa: Numa | None = element(tag="numa", default=None)
270
+ pci_express: PciExpress | None = element(tag="pci-express", default=None)
271
+
272
+
273
+ class UsbDeviceCapability(LibvirtXmlModel, tag="capability"):
274
+ type: Literal["usb_device"] = attr(name="type")
275
+ bus: int = element(tag="bus", ge=0)
276
+ device: int = element(tag="device", ge=0)
277
+ # The schema requires <port>, but libvirt leaves it out for root hubs.
278
+ port: int | None = element(tag="port", default=None, ge=0)
279
+ product: Product = element(tag="product")
280
+ vendor: Vendor = element(tag="vendor")
281
+
282
+
283
+ class UsbCapability(LibvirtXmlModel, tag="capability"):
284
+ type: Literal["usb"] = attr(name="type")
285
+ number: int = element(tag="number", ge=0)
286
+ class_: int = element(tag="class", ge=0)
287
+ subclass: int = element(tag="subclass", ge=0)
288
+ protocol: int = element(tag="protocol", ge=0)
289
+ description: str | None = element(tag="description", default=None)
290
+
291
+
292
+ class NetLink(LibvirtXmlModel, tag="link"):
293
+ speed: int | None = attr(name="speed", default=None, ge=0)
294
+ state: str | None = attr(name="state", default=None)
295
+
296
+
297
+ class NetFeature(LibvirtXmlModel, tag="feature"):
298
+ name: str = attr(name="name")
299
+
300
+
301
+ class NetCapability(LibvirtXmlModel, tag="capability"):
302
+ type: Literal["net"] = attr(name="type")
303
+ interface: str = element(tag="interface")
304
+ address: str | None = element(tag="address", default=None)
305
+ link: NetLink | None = element(tag="link", default=None)
306
+ features: list[NetFeature] = element(tag="feature", default_factory=list)
307
+ capabilities: list[SubCapability] = element(tag="capability", default_factory=list)
308
+
309
+
310
+ class ScsiGenericCapability(LibvirtXmlModel, tag="capability"):
311
+ type: Literal["scsi_generic"] = attr(name="type")
312
+ char: str = element(tag="char")
313
+
314
+
315
+ class ScsiHostCapability(LibvirtXmlModel, tag="capability"):
316
+ type: Literal["scsi_host"] = attr(name="type")
317
+ host: int = element(tag="host", ge=0)
318
+ unique_id: int | None = element(tag="unique_id", default=None, ge=0)
319
+ capabilities: list[SubCapability] = element(tag="capability", default_factory=list)
320
+
321
+
322
+ class ScsiTargetCapability(LibvirtXmlModel, tag="capability"):
323
+ type: Literal["scsi_target"] = attr(name="type")
324
+ target: str = element(tag="target")
325
+ capabilities: list[SubCapability] = element(tag="capability", default_factory=list)
326
+
327
+
328
+ class ScsiCapability(LibvirtXmlModel, tag="capability"):
329
+ type: Literal["scsi"] = attr(name="type")
330
+ host: int = element(tag="host", ge=0)
331
+ bus: int = element(tag="bus", ge=0)
332
+ target: int = element(tag="target", ge=0)
333
+ lun: int = element(tag="lun", ge=0)
334
+ device_type: str | None = element(tag="type", default=None)
335
+
336
+
337
+ class StorageCapability(LibvirtXmlModel, tag="capability"):
338
+ type: Literal["storage"] = attr(name="type")
339
+ block: str = element(tag="block")
340
+ bus: str | None = element(tag="bus", default=None)
341
+ drive_type: str | None = element(tag="drive_type", default=None)
342
+ model: str | None = element(tag="model", default=None)
343
+ vendor: str | None = element(tag="vendor", default=None)
344
+ serial: str | None = element(tag="serial", default=None)
345
+ size: int | None = element(tag="size", default=None, ge=0)
346
+ logical_block_size: int | None = element(
347
+ tag="logical_block_size", default=None, ge=0
348
+ )
349
+ num_blocks: int | None = element(tag="num_blocks", default=None, ge=0)
350
+ capabilities: list[SubCapability] = element(tag="capability", default_factory=list)
351
+
352
+
353
+ class DrmCapability(LibvirtXmlModel, tag="capability"):
354
+ type: Literal["drm"] = attr(name="type")
355
+ device_type: Literal["primary", "control", "render"] = element(tag="type")
356
+
357
+
358
+ class MdevTypeId(LibvirtXmlModel, tag="type"):
359
+ id: str = attr(name="id")
360
+
361
+
362
+ class MdevAttr(LibvirtXmlModel, tag="attr"):
363
+ name: str = attr(name="name")
364
+ value: str = attr(name="value")
365
+
366
+
367
+ class MdevCapability(LibvirtXmlModel, tag="capability"):
368
+ type: Literal["mdev"] = attr(name="type")
369
+ mdev_type: MdevTypeId = element(tag="type")
370
+ iommu_group: IommuGroup | None = element(tag="iommuGroup", default=None)
371
+ uuid: Uuid | None = element(tag="uuid", default=None)
372
+ parent_addr: str | None = element(tag="parent_addr", default=None)
373
+ attrs: list[MdevAttr] = element(tag="attr", default_factory=list)
374
+
375
+
376
+ class CcwCapability(LibvirtXmlModel, tag="capability"):
377
+ type: Literal["ccw"] = attr(name="type")
378
+ state: Literal["online", "offline"] | None = element(tag="state", default=None)
379
+ cssid: str = element(tag="cssid")
380
+ ssid: str = element(tag="ssid")
381
+ devno: str = element(tag="devno")
382
+ capabilities: list[SubCapability] = element(tag="capability", default_factory=list)
383
+
384
+
385
+ class CcwMember(LibvirtXmlModel, tag="ccw_device"):
386
+ value: str = ""
387
+ ref: str = attr(name="ref")
388
+
389
+
390
+ class CcwMembers(LibvirtXmlModel, tag="members"):
391
+ devices: list[CcwMember] = element(tag="ccw_device", default_factory=list)
392
+
393
+
394
+ class CcwGroupCapability(LibvirtXmlModel, tag="capability"):
395
+ type: Literal["ccwgroup"] = attr(name="type")
396
+ state: Literal["online", "offline"] | None = element(tag="state", default=None)
397
+ cssid: str = element(tag="cssid")
398
+ ssid: str = element(tag="ssid")
399
+ devno: str = element(tag="devno")
400
+ members: CcwMembers | None = element(tag="members", default=None)
401
+ capabilities: list[SubCapability] = element(tag="capability", default_factory=list)
402
+
403
+
404
+ class ChannelDevAddr(LibvirtXmlModel, tag="channel_dev_addr"):
405
+ cssid: str = element(tag="cssid")
406
+ ssid: str = element(tag="ssid")
407
+ devno: str = element(tag="devno")
408
+
409
+
410
+ class CssCapability(LibvirtXmlModel, tag="capability"):
411
+ type: Literal["css"] = attr(name="type")
412
+ cssid: str = element(tag="cssid")
413
+ ssid: str = element(tag="ssid")
414
+ devno: str = element(tag="devno")
415
+ channel_dev_addr: ChannelDevAddr | None = element(
416
+ tag="channel_dev_addr", default=None
417
+ )
418
+ capabilities: list[SubCapability] = element(tag="capability", default_factory=list)
419
+
420
+
421
+ class VdpaCapability(LibvirtXmlModel, tag="capability"):
422
+ type: Literal["vdpa"] = attr(name="type")
423
+ chardev: str = element(tag="chardev")
424
+
425
+
426
+ class ApCardCapability(LibvirtXmlModel, tag="capability"):
427
+ type: Literal["ap_card"] = attr(name="type")
428
+ ap_adapter: str = element(tag="ap-adapter")
429
+
430
+
431
+ class ApQueueCapability(LibvirtXmlModel, tag="capability"):
432
+ type: Literal["ap_queue"] = attr(name="type")
433
+ ap_adapter: str = element(tag="ap-adapter")
434
+ ap_domain: str = element(tag="ap-domain")
435
+
436
+
437
+ class ApMatrixCapability(LibvirtXmlModel, tag="capability"):
438
+ type: Literal["ap_matrix"] = attr(name="type")
439
+ capabilities: list[SubCapability] = element(tag="capability", default_factory=list)
440
+
441
+
442
+ Capability = (
443
+ SystemCapability
444
+ | PciCapability
445
+ | UsbDeviceCapability
446
+ | UsbCapability
447
+ | NetCapability
448
+ | ScsiGenericCapability
449
+ | ScsiHostCapability
450
+ | ScsiTargetCapability
451
+ | ScsiCapability
452
+ | StorageCapability
453
+ | DrmCapability
454
+ | MdevCapability
455
+ | CcwCapability
456
+ | CcwGroupCapability
457
+ | CssCapability
458
+ | VdpaCapability
459
+ | ApCardCapability
460
+ | ApQueueCapability
461
+ | ApMatrixCapability
462
+ )
463
+ """Any ``<capability>`` of a node device; chosen by its ``type`` attribute."""
464
+
465
+
466
+ class DeviceNode(LibvirtXmlModel, tag="devnode"):
467
+ value: str = ""
468
+ type: Literal["dev", "link"] = attr(name="type")
469
+
470
+
471
+ class DeviceParent(LibvirtXmlModel, tag="parent"):
472
+ value: str = ""
473
+ wwnn: str | None = attr(name="wwnn", default=None)
474
+ wwpn: str | None = attr(name="wwpn", default=None)
475
+ fabric_wwn: str | None = attr(name="fabric_wwn", default=None)
476
+
477
+
478
+ class DeviceDriver(LibvirtXmlModel, tag="driver"):
479
+ name: str = element(tag="name")
480
+
481
+
482
+ class Device(LibvirtXmlModel, tag="device"):
483
+ """``<device>``: a host device and what it can do."""
484
+
485
+ name: str = element(tag="name")
486
+ path: str | None = element(tag="path", default=None)
487
+ devnodes: list[DeviceNode] = element(tag="devnode", default_factory=list)
488
+ parent: DeviceParent | None = element(tag="parent", default=None)
489
+ driver: DeviceDriver | None = element(tag="driver", default=None)
490
+ capabilities: list[Capability] = element(tag="capability", default_factory=list)
@@ -0,0 +1,81 @@
1
+ """Models for network filters. See https://libvirt.org/formatnwfilter.html"""
2
+
3
+ from libvirtpy.xml._shared.network import (
4
+ FilterParameter,
5
+ FilterRef,
6
+ )
7
+ from libvirtpy.xml.nwfilter.binding import (
8
+ FilterBinding,
9
+ FilterBindingBackend,
10
+ FilterBindingLinkdev,
11
+ FilterBindingMac,
12
+ FilterBindingOwner,
13
+ FilterBindingPortdev,
14
+ )
15
+ from libvirtpy.xml.nwfilter.filter import (
16
+ Filter,
17
+ FilterRule,
18
+ )
19
+ from libvirtpy.xml.nwfilter.rules import (
20
+ AhIpv6Rule,
21
+ AhRule,
22
+ AllIpv6Rule,
23
+ AllRule,
24
+ ArpRule,
25
+ EspIpv6Rule,
26
+ EspRule,
27
+ IcmpRule,
28
+ Icmpv6Rule,
29
+ IgmpRule,
30
+ IpRule,
31
+ Ipv6Rule,
32
+ MacRule,
33
+ RarpRule,
34
+ SctpIpv6Rule,
35
+ SctpRule,
36
+ StpRule,
37
+ TcpIpv6Rule,
38
+ TcpRule,
39
+ UdpIpv6Rule,
40
+ UdpliteIpv6Rule,
41
+ UdpliteRule,
42
+ UdpRule,
43
+ VlanRule,
44
+ )
45
+
46
+ __all__ = [
47
+ "AhIpv6Rule",
48
+ "AhRule",
49
+ "AllIpv6Rule",
50
+ "AllRule",
51
+ "ArpRule",
52
+ "EspIpv6Rule",
53
+ "EspRule",
54
+ "Filter",
55
+ "FilterBinding",
56
+ "FilterBindingBackend",
57
+ "FilterBindingLinkdev",
58
+ "FilterBindingMac",
59
+ "FilterBindingOwner",
60
+ "FilterBindingPortdev",
61
+ "FilterParameter",
62
+ "FilterRef",
63
+ "FilterRule",
64
+ "IcmpRule",
65
+ "Icmpv6Rule",
66
+ "IgmpRule",
67
+ "IpRule",
68
+ "Ipv6Rule",
69
+ "MacRule",
70
+ "RarpRule",
71
+ "SctpIpv6Rule",
72
+ "SctpRule",
73
+ "StpRule",
74
+ "TcpIpv6Rule",
75
+ "TcpRule",
76
+ "UdpIpv6Rule",
77
+ "UdpRule",
78
+ "UdpliteIpv6Rule",
79
+ "UdpliteRule",
80
+ "VlanRule",
81
+ ]
@@ -0,0 +1,51 @@
1
+ """``<filterbinding>``: a network filter applied to a port.
2
+
3
+ See https://libvirt.org/formatnwfilter.html#network-filter-bindings
4
+ """
5
+
6
+ from pydantic_xml import attr, element
7
+
8
+ from libvirtpy.xml._base import LibvirtXmlModel
9
+ from libvirtpy.xml._shared.network import FilterRef
10
+ from libvirtpy.xml._types import Uuid
11
+
12
+ __all__ = [
13
+ "FilterBinding",
14
+ "FilterBindingBackend",
15
+ "FilterBindingLinkdev",
16
+ "FilterBindingMac",
17
+ "FilterBindingOwner",
18
+ "FilterBindingPortdev",
19
+ ]
20
+
21
+
22
+ class FilterBindingOwner(LibvirtXmlModel, tag="owner"):
23
+ name: str = element(tag="name")
24
+ uuid: Uuid = element(tag="uuid")
25
+
26
+
27
+ class FilterBindingPortdev(LibvirtXmlModel, tag="portdev"):
28
+ name: str = attr(name="name")
29
+
30
+
31
+ class FilterBindingLinkdev(LibvirtXmlModel, tag="linkdev"):
32
+ name: str = attr(name="name")
33
+
34
+
35
+ class FilterBindingMac(LibvirtXmlModel, tag="mac"):
36
+ address: str = attr(name="address")
37
+
38
+
39
+ class FilterBindingBackend(LibvirtXmlModel, tag="backend"):
40
+ name: str = attr(name="name")
41
+
42
+
43
+ class FilterBinding(LibvirtXmlModel, tag="filterbinding"):
44
+ """``<filterbinding>``: which filter guards which network device."""
45
+
46
+ owner: FilterBindingOwner = element(tag="owner")
47
+ portdev: FilterBindingPortdev = element(tag="portdev")
48
+ linkdev: FilterBindingLinkdev | None = element(tag="linkdev", default=None)
49
+ mac: FilterBindingMac = element(tag="mac")
50
+ filterref: FilterRef = element(tag="filterref")
51
+ backend: FilterBindingBackend | None = element(tag="backend", default=None)