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,101 @@
1
+ """Models for ``<network>`` XML. See https://libvirt.org/formatnetwork.html"""
2
+
3
+ from libvirtpy.xml._shared.metadata import (
4
+ Metadata,
5
+ )
6
+ from libvirtpy.xml._shared.network import (
7
+ Bandwidth,
8
+ BandwidthLimit,
9
+ FilterParameter,
10
+ FilterRef,
11
+ Inbound,
12
+ Outbound,
13
+ Route,
14
+ VirtualPort,
15
+ VirtualPortParameters,
16
+ Vlan,
17
+ VlanTag,
18
+ )
19
+ from libvirtpy.xml.network.network import (
20
+ DNSMASQ_NAMESPACE,
21
+ DhcpBootp,
22
+ DhcpHost,
23
+ DhcpLease,
24
+ DhcpRange,
25
+ Network,
26
+ NetworkBridge,
27
+ NetworkDhcp,
28
+ NetworkDns,
29
+ NetworkDnsDomain,
30
+ NetworkDnsForwarder,
31
+ NetworkDnsHost,
32
+ NetworkDnsSrv,
33
+ NetworkDnsTxt,
34
+ NetworkForward,
35
+ NetworkForwardAddress,
36
+ NetworkForwardDriver,
37
+ NetworkForwardInterface,
38
+ NetworkForwardNat,
39
+ NetworkIp,
40
+ NetworkMac,
41
+ NetworkMtu,
42
+ NetworkPortOptions,
43
+ NetworkTftp,
44
+ Portgroup,
45
+ )
46
+ from libvirtpy.xml.network.port import (
47
+ NetworkPort,
48
+ PortMac,
49
+ PortOptions,
50
+ PortOwner,
51
+ PortPlug,
52
+ PortPlugDriver,
53
+ PortRxFilters,
54
+ )
55
+
56
+ __all__ = [
57
+ "DNSMASQ_NAMESPACE",
58
+ "Bandwidth",
59
+ "BandwidthLimit",
60
+ "DhcpBootp",
61
+ "DhcpHost",
62
+ "DhcpLease",
63
+ "DhcpRange",
64
+ "FilterParameter",
65
+ "FilterRef",
66
+ "Inbound",
67
+ "Metadata",
68
+ "Network",
69
+ "NetworkBridge",
70
+ "NetworkDhcp",
71
+ "NetworkDns",
72
+ "NetworkDnsDomain",
73
+ "NetworkDnsForwarder",
74
+ "NetworkDnsHost",
75
+ "NetworkDnsSrv",
76
+ "NetworkDnsTxt",
77
+ "NetworkForward",
78
+ "NetworkForwardAddress",
79
+ "NetworkForwardDriver",
80
+ "NetworkForwardInterface",
81
+ "NetworkForwardNat",
82
+ "NetworkIp",
83
+ "NetworkMac",
84
+ "NetworkMtu",
85
+ "NetworkPort",
86
+ "NetworkPortOptions",
87
+ "NetworkTftp",
88
+ "Outbound",
89
+ "PortMac",
90
+ "PortOptions",
91
+ "PortOwner",
92
+ "PortPlug",
93
+ "PortPlugDriver",
94
+ "PortRxFilters",
95
+ "Portgroup",
96
+ "Route",
97
+ "VirtualPort",
98
+ "VirtualPortParameters",
99
+ "Vlan",
100
+ "VlanTag",
101
+ ]
@@ -0,0 +1,311 @@
1
+ """``<network>``: a virtual network.
2
+
3
+ See https://libvirt.org/formatnetwork.html
4
+ """
5
+
6
+ from typing import Literal
7
+
8
+ from pydantic_xml import attr, element
9
+
10
+ from libvirtpy.xml._base import LibvirtXmlModel
11
+ from libvirtpy.xml._shared.metadata import Metadata
12
+ from libvirtpy.xml._shared.network import Bandwidth, Route, VirtualPort, Vlan
13
+ from libvirtpy.xml._types import HexNumber, OnOff, Uuid, YesNo
14
+
15
+ __all__ = [
16
+ "DNSMASQ_NAMESPACE",
17
+ "DhcpBootp",
18
+ "DhcpHost",
19
+ "DhcpLease",
20
+ "DhcpRange",
21
+ "Network",
22
+ "NetworkBridge",
23
+ "NetworkDhcp",
24
+ "NetworkDns",
25
+ "NetworkDnsDomain",
26
+ "NetworkDnsForwarder",
27
+ "NetworkDnsHost",
28
+ "NetworkDnsSrv",
29
+ "NetworkDnsTxt",
30
+ "NetworkForward",
31
+ "NetworkForwardAddress",
32
+ "NetworkForwardDriver",
33
+ "NetworkForwardInterface",
34
+ "NetworkForwardNat",
35
+ "NetworkIp",
36
+ "NetworkMac",
37
+ "NetworkMtu",
38
+ "NetworkPortOptions",
39
+ "NetworkTftp",
40
+ "Portgroup",
41
+ ]
42
+
43
+ DNSMASQ_NAMESPACE = "http://libvirt.org/schemas/network/dnsmasq/1.0"
44
+
45
+
46
+ class NetworkBridge(LibvirtXmlModel, tag="bridge"):
47
+ """``<bridge>``: the host bridge device."""
48
+
49
+ name: str | None = attr(name="name", default=None)
50
+ zone: str | None = attr(name="zone", default=None, description="Firewall zone.")
51
+ stp: OnOff | None = attr(name="stp", default=None)
52
+ delay: int | None = attr(name="delay", default=None, ge=0)
53
+ mac_table_manager: Literal["kernel", "libvirt"] | None = attr(
54
+ name="macTableManager", default=None
55
+ )
56
+
57
+
58
+ class NetworkMtu(LibvirtXmlModel, tag="mtu"):
59
+ size: int = attr(name="size", ge=0, le=65535)
60
+
61
+
62
+ class NetworkMac(LibvirtXmlModel, tag="mac"):
63
+ address: str = attr(name="address")
64
+
65
+
66
+ class NetworkForwardInterface(LibvirtXmlModel, tag="interface"):
67
+ """``<interface>`` in ``<forward>``: a host interface of the pool."""
68
+
69
+ dev: str = attr(name="dev")
70
+ connections: int | None = attr(name="connections", default=None, ge=0)
71
+
72
+
73
+ class NetworkForwardAddress(LibvirtXmlModel, tag="address"):
74
+ """``<address>`` in ``<forward>``: a PCI device of the pool."""
75
+
76
+ type: Literal["pci"] = attr(name="type")
77
+ domain: HexNumber | None = attr(name="domain", default=None)
78
+ bus: HexNumber | None = attr(name="bus", default=None)
79
+ slot: HexNumber | None = attr(name="slot", default=None)
80
+ function: HexNumber | None = attr(name="function", default=None)
81
+ multifunction: OnOff | None = attr(name="multifunction", default=None)
82
+ connections: int | None = attr(name="connections", default=None, ge=0)
83
+
84
+
85
+ class ForwardPf(LibvirtXmlModel, tag="pf"):
86
+ dev: str = attr(name="dev")
87
+
88
+
89
+ class NetworkForwardDriver(LibvirtXmlModel, tag="driver"):
90
+ """``<driver>`` of a hostdev network."""
91
+
92
+ name: Literal["kvm", "vfio", "xen"] | None = attr(name="name", default=None)
93
+ model: str | None = attr(name="model", default=None)
94
+ iommufd: YesNo | None = attr(name="iommufd", default=None)
95
+
96
+
97
+ class NatAddress(LibvirtXmlModel, tag="address"):
98
+ start: str = attr(name="start")
99
+ end: str = attr(name="end")
100
+
101
+
102
+ class NatPort(LibvirtXmlModel, tag="port"):
103
+ start: int = attr(name="start", ge=0, le=65535)
104
+ end: int = attr(name="end", ge=0, le=65535)
105
+
106
+
107
+ class NetworkForwardNat(LibvirtXmlModel, tag="nat"):
108
+ """``<nat>``: the address and port range used for NAT."""
109
+
110
+ ipv6: YesNo | None = attr(name="ipv6", default=None)
111
+ address: NatAddress | None = element(tag="address", default=None)
112
+ port: NatPort | None = element(tag="port", default=None)
113
+
114
+
115
+ class NetworkForward(LibvirtXmlModel, tag="forward"):
116
+ """``<forward>``: how the network is connected to the outside."""
117
+
118
+ dev: str | None = attr(name="dev", default=None)
119
+ mode: (
120
+ Literal[
121
+ "nat",
122
+ "route",
123
+ "open",
124
+ "bridge",
125
+ "passthrough",
126
+ "private",
127
+ "vepa",
128
+ "hostdev",
129
+ ]
130
+ | None
131
+ ) = attr(name="mode", default=None)
132
+ managed: YesNo | None = attr(name="managed", default=None)
133
+ interfaces: list[NetworkForwardInterface] = element(
134
+ tag="interface", default_factory=list
135
+ )
136
+ addresses: list[NetworkForwardAddress] = element(
137
+ tag="address", default_factory=list
138
+ )
139
+ pf: ForwardPf | None = element(tag="pf", default=None)
140
+ driver: NetworkForwardDriver | None = element(tag="driver", default=None)
141
+ nat: NetworkForwardNat | None = element(tag="nat", default=None)
142
+
143
+
144
+ class Portgroup(LibvirtXmlModel, tag="portgroup"):
145
+ """``<portgroup>``: a named set of port settings."""
146
+
147
+ name: str = attr(name="name")
148
+ default: YesNo | None = attr(name="default", default=None)
149
+ trust_guest_rx_filters: YesNo | None = attr(
150
+ name="trustGuestRxFilters", default=None
151
+ )
152
+ virtualport: VirtualPort | None = element(tag="virtualport", default=None)
153
+ bandwidth: Bandwidth | None = element(tag="bandwidth", default=None)
154
+ vlan: Vlan | None = element(tag="vlan", default=None)
155
+
156
+
157
+ class NetworkDnsDomain(LibvirtXmlModel, tag="domain"):
158
+ """``<domain>``: the DNS domain of the network."""
159
+
160
+ name: str = attr(name="name")
161
+ local_only: YesNo | None = attr(name="localOnly", default=None)
162
+ registered: YesNo | None = attr(name="register", default=None)
163
+
164
+
165
+ class NetworkDnsForwarder(LibvirtXmlModel, tag="forwarder"):
166
+ addr: str | None = attr(name="addr", default=None)
167
+ domain: str | None = attr(name="domain", default=None)
168
+ port: int | None = attr(name="port", default=None, ge=0, le=65535)
169
+
170
+
171
+ class NetworkDnsTxt(LibvirtXmlModel, tag="txt"):
172
+ name: str = attr(name="name")
173
+ value: str = attr(name="value")
174
+
175
+
176
+ class NetworkDnsSrv(LibvirtXmlModel, tag="srv"):
177
+ service: str = attr(name="service")
178
+ protocol: str = attr(name="protocol")
179
+ domain: str | None = attr(name="domain", default=None)
180
+ target: str | None = attr(name="target", default=None)
181
+ port: int | None = attr(name="port", default=None, ge=0, le=65535)
182
+ priority: int | None = attr(name="priority", default=None, ge=0, le=65535)
183
+ weight: int | None = attr(name="weight", default=None, ge=0, le=65535)
184
+
185
+
186
+ class NetworkDnsHost(LibvirtXmlModel, tag="host"):
187
+ ip: str = attr(name="ip")
188
+ hostnames: list[str] = element(tag="hostname", default_factory=list)
189
+
190
+
191
+ class NetworkDns(LibvirtXmlModel, tag="dns"):
192
+ """``<dns>``: the DNS server of the network."""
193
+
194
+ enable: YesNo | None = attr(name="enable", default=None)
195
+ forward_plain_names: YesNo | None = attr(name="forwardPlainNames", default=None)
196
+ forwarders: list[NetworkDnsForwarder] = element(
197
+ tag="forwarder", default_factory=list
198
+ )
199
+ txts: list[NetworkDnsTxt] = element(tag="txt", default_factory=list)
200
+ srvs: list[NetworkDnsSrv] = element(tag="srv", default_factory=list)
201
+ hosts: list[NetworkDnsHost] = element(tag="host", default_factory=list)
202
+
203
+
204
+ class NetworkPortOptions(LibvirtXmlModel, tag="port"):
205
+ """``<port>``: port options of the network's switch."""
206
+
207
+ isolated: YesNo | None = attr(name="isolated", default=None)
208
+
209
+
210
+ class NetworkTftp(LibvirtXmlModel, tag="tftp"):
211
+ root: str = attr(name="root")
212
+
213
+
214
+ class DhcpLease(LibvirtXmlModel, tag="lease"):
215
+ """``<lease>``: how long leases last."""
216
+
217
+ expiry: int = attr(name="expiry", ge=0)
218
+ unit: Literal["seconds", "minutes", "hours"] | None = attr(
219
+ name="unit", default=None
220
+ )
221
+
222
+
223
+ class DhcpRange(LibvirtXmlModel, tag="range"):
224
+ start: str = attr(name="start")
225
+ end: str = attr(name="end")
226
+ lease: DhcpLease | None = element(tag="lease", default=None)
227
+
228
+
229
+ class DhcpHost(LibvirtXmlModel, tag="host"):
230
+ """``<host>``: a static DHCP lease."""
231
+
232
+ mac: str | None = attr(name="mac", default=None)
233
+ id: str | None = attr(name="id", default=None, description="DUID, for DHCPv6.")
234
+ name: str | None = attr(name="name", default=None)
235
+ ip: str = attr(name="ip")
236
+ lease: DhcpLease | None = element(tag="lease", default=None)
237
+
238
+
239
+ class DhcpBootp(LibvirtXmlModel, tag="bootp"):
240
+ file: str = attr(name="file")
241
+ server: str | None = attr(name="server", default=None)
242
+
243
+
244
+ class NetworkDhcp(LibvirtXmlModel, tag="dhcp"):
245
+ """``<dhcp>``: the DHCP server of an IP range."""
246
+
247
+ ranges: list[DhcpRange] = element(tag="range", default_factory=list)
248
+ hosts: list[DhcpHost] = element(tag="host", default_factory=list)
249
+ bootp: DhcpBootp | None = element(tag="bootp", default=None)
250
+
251
+
252
+ class NetworkIp(LibvirtXmlModel, tag="ip"):
253
+ """``<ip>``: an address of the host bridge, with its DHCP and TFTP services."""
254
+
255
+ address: str | None = attr(name="address", default=None)
256
+ netmask: str | None = attr(name="netmask", default=None)
257
+ prefix: int | None = attr(name="prefix", default=None, ge=0)
258
+ family: Literal["ipv4", "ipv6"] | None = attr(name="family", default=None)
259
+ local_ptr: YesNo | None = attr(name="localPtr", default=None)
260
+ tftp: NetworkTftp | None = element(tag="tftp", default=None)
261
+ dhcp: NetworkDhcp | None = element(tag="dhcp", default=None)
262
+
263
+
264
+ class DnsmasqOption(
265
+ LibvirtXmlModel, tag="option", ns="dnsmasq", nsmap={"dnsmasq": DNSMASQ_NAMESPACE}
266
+ ):
267
+ """``<dnsmasq:option>``: a raw dnsmasq configuration line."""
268
+
269
+ value: str = attr(name="value")
270
+
271
+
272
+ class DnsmasqOptions(
273
+ LibvirtXmlModel, tag="options", ns="dnsmasq", nsmap={"dnsmasq": DNSMASQ_NAMESPACE}
274
+ ):
275
+ """``<dnsmasq:options>``: extra dnsmasq settings."""
276
+
277
+ options: list[DnsmasqOption] = element(tag="option", default_factory=list)
278
+
279
+
280
+ class Network(LibvirtXmlModel, tag="network"):
281
+ """``<network>``: a virtual network."""
282
+
283
+ connections: int | None = attr(name="connections", default=None, ge=0)
284
+ ipv6: YesNo | None = attr(name="ipv6", default=None)
285
+ trust_guest_rx_filters: YesNo | None = attr(
286
+ name="trustGuestRxFilters", default=None
287
+ )
288
+ name: str = element(tag="name")
289
+ uuid: Uuid | None = element(tag="uuid", default=None)
290
+ title: str | None = element(tag="title", default=None)
291
+ description: str | None = element(tag="description", default=None)
292
+ metadata: Metadata | None = element(tag="metadata", default=None)
293
+ bridge: NetworkBridge | None = element(tag="bridge", default=None)
294
+ mtu: NetworkMtu | None = element(tag="mtu", default=None)
295
+ mac: NetworkMac | None = element(tag="mac", default=None)
296
+ forward: NetworkForward | None = element(tag="forward", default=None)
297
+ virtualport: VirtualPort | None = element(tag="virtualport", default=None)
298
+ portgroups: list[Portgroup] = element(tag="portgroup", default_factory=list)
299
+ domain: NetworkDnsDomain | None = element(tag="domain", default=None)
300
+ dns: NetworkDns | None = element(tag="dns", default=None)
301
+ bandwidth: Bandwidth | None = element(tag="bandwidth", default=None)
302
+ vlan: Vlan | None = element(tag="vlan", default=None)
303
+ port: NetworkPortOptions | None = element(tag="port", default=None)
304
+ ips: list[NetworkIp] = element(tag="ip", default_factory=list)
305
+ routes: list[Route] = element(tag="route", default_factory=list)
306
+ dnsmasq_options: DnsmasqOptions | None = element(
307
+ tag="options",
308
+ ns="dnsmasq",
309
+ nsmap={"dnsmasq": DNSMASQ_NAMESPACE},
310
+ default=None,
311
+ )
@@ -0,0 +1,84 @@
1
+ """``<networkport>``: a port of a virtual network.
2
+
3
+ See https://libvirt.org/formatnetworkport.html
4
+ """
5
+
6
+ from typing import Literal
7
+
8
+ from pydantic_xml import attr, element
9
+
10
+ from libvirtpy.xml._base import LibvirtXmlModel
11
+ from libvirtpy.xml._shared.network import Bandwidth, VirtualPort, Vlan
12
+ from libvirtpy.xml._shared.storage import HostPciAddress
13
+ from libvirtpy.xml._types import Uuid, YesNo
14
+
15
+ __all__ = [
16
+ "NetworkPort",
17
+ "PortMac",
18
+ "PortOptions",
19
+ "PortOwner",
20
+ "PortPlug",
21
+ "PortPlugDriver",
22
+ "PortRxFilters",
23
+ ]
24
+
25
+
26
+ class PortOwner(LibvirtXmlModel, tag="owner"):
27
+ """``<owner>``: the domain that uses the port."""
28
+
29
+ name: str = element(tag="name")
30
+ uuid: Uuid = element(tag="uuid")
31
+
32
+
33
+ class PortMac(LibvirtXmlModel, tag="mac"):
34
+ address: str = attr(name="address")
35
+
36
+
37
+ class PortRxFilters(LibvirtXmlModel, tag="rxfilters"):
38
+ trust_guest: YesNo = attr(name="trustGuest")
39
+
40
+
41
+ class PortOptions(LibvirtXmlModel, tag="port"):
42
+ isolated: YesNo | None = attr(name="isolated", default=None)
43
+
44
+
45
+ class PortPlugDriver(LibvirtXmlModel, tag="driver"):
46
+ name: Literal["kvm", "vfio", "xen"] | None = attr(name="name", default=None)
47
+ model: str | None = attr(name="model", default=None)
48
+ iommufd: YesNo | None = attr(name="iommufd", default=None)
49
+
50
+
51
+ class PortPlug(LibvirtXmlModel, tag="plug"):
52
+ r"""``<plug>``: how the port is connected to the host.
53
+
54
+ One model for all ``type``\ s (``network``, ``bridge``, ``direct``,
55
+ ``hostdev-pci``): they use a few different optional fields of one element.
56
+ """
57
+
58
+ type: Literal["network", "bridge", "direct", "hostdev-pci"] = attr(name="type")
59
+ bridge: str | None = attr(name="bridge", default=None)
60
+ mac_table_manager: Literal["kernel", "libvirt"] | None = attr(
61
+ name="macTableManager", default=None
62
+ )
63
+ dev: str | None = attr(name="dev", default=None)
64
+ mode: Literal["bridge", "passthrough", "private", "vepa"] | None = attr(
65
+ name="mode", default=None
66
+ )
67
+ managed: YesNo | None = attr(name="managed", default=None)
68
+ driver: PortPlugDriver | None = element(tag="driver", default=None)
69
+ address: HostPciAddress | None = element(tag="address", default=None)
70
+
71
+
72
+ class NetworkPort(LibvirtXmlModel, tag="networkport"):
73
+ """``<networkport>``: a port of a virtual network."""
74
+
75
+ uuid: Uuid = element(tag="uuid")
76
+ owner: PortOwner = element(tag="owner")
77
+ mac: PortMac = element(tag="mac")
78
+ group: str | None = element(tag="group", default=None)
79
+ rxfilters: PortRxFilters | None = element(tag="rxfilters", default=None)
80
+ virtualport: VirtualPort | None = element(tag="virtualport", default=None)
81
+ bandwidth: Bandwidth | None = element(tag="bandwidth", default=None)
82
+ vlan: Vlan | None = element(tag="vlan", default=None)
83
+ port: PortOptions | None = element(tag="port", default=None)
84
+ plug: PortPlug | None = element(tag="plug", default=None)
@@ -0,0 +1,13 @@
1
+ """Models for node devices. See https://libvirt.org/formatnode.html"""
2
+
3
+ from libvirtpy.xml.nodedev.nodedev import (
4
+ Capability,
5
+ Device,
6
+ SubCapability,
7
+ )
8
+
9
+ __all__ = [
10
+ "Capability",
11
+ "Device",
12
+ "SubCapability",
13
+ ]