libvirtpy 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- libvirtpy/__init__.py +5 -0
- libvirtpy/client/__init__.py +54 -0
- libvirtpy/client/_bases.py +326 -0
- libvirtpy/client/_runner.py +57 -0
- libvirtpy/client/aio.py +5922 -0
- libvirtpy/client/client.py +5695 -0
- libvirtpy/client/operations/__init__.py +631 -0
- libvirtpy/client/operations/_common.py +495 -0
- libvirtpy/client/operations/checkpoint.py +196 -0
- libvirtpy/client/operations/connection.py +93 -0
- libvirtpy/client/operations/connection_extra.py +256 -0
- libvirtpy/client/operations/domain.py +306 -0
- libvirtpy/client/operations/domain_agent.py +115 -0
- libvirtpy/client/operations/domain_block.py +368 -0
- libvirtpy/client/operations/domain_info.py +400 -0
- libvirtpy/client/operations/domain_lifecycle.py +338 -0
- libvirtpy/client/operations/domain_migration.py +164 -0
- libvirtpy/client/operations/domain_network.py +113 -0
- libvirtpy/client/operations/domain_tuning.py +494 -0
- libvirtpy/client/operations/host.py +246 -0
- libvirtpy/client/operations/host_interface.py +100 -0
- libvirtpy/client/operations/interface_extra.py +45 -0
- libvirtpy/client/operations/network.py +135 -0
- libvirtpy/client/operations/network_info.py +155 -0
- libvirtpy/client/operations/network_port.py +142 -0
- libvirtpy/client/operations/node_device.py +76 -0
- libvirtpy/client/operations/node_device_info.py +189 -0
- libvirtpy/client/operations/nwfilter.py +67 -0
- libvirtpy/client/operations/nwfilter_binding.py +74 -0
- libvirtpy/client/operations/secret.py +93 -0
- libvirtpy/client/operations/secret_extra.py +24 -0
- libvirtpy/client/operations/snapshot.py +100 -0
- libvirtpy/client/operations/snapshot_tree.py +114 -0
- libvirtpy/client/operations/storage.py +267 -0
- libvirtpy/client/operations/storage_info.py +188 -0
- libvirtpy/client/operations/streams.py +201 -0
- libvirtpy/client/references.py +249 -0
- libvirtpy/client/subscribing.py +88 -0
- libvirtpy/client/testing/__init__.py +24 -0
- libvirtpy/client/testing/_common.py +167 -0
- libvirtpy/client/testing/_domains.py +294 -0
- libvirtpy/client/testing/_objects.py +205 -0
- libvirtpy/client/testing/_state.py +246 -0
- libvirtpy/client/testing/_storage.py +171 -0
- libvirtpy/client/testing/async_transport.py +30 -0
- libvirtpy/client/testing/fake.py +81 -0
- libvirtpy/client/transport.py +87 -0
- libvirtpy/client/types.py +59 -0
- libvirtpy/client/wire.py +436 -0
- libvirtpy/client/wire_aio.py +348 -0
- libvirtpy/errors.py +7 -0
- libvirtpy/py.typed +0 -0
- libvirtpy/rpc/__init__.py +1 -0
- libvirtpy/rpc/aio.py +387 -0
- libvirtpy/rpc/cpumap.py +48 -0
- libvirtpy/rpc/errors.py +186 -0
- libvirtpy/rpc/events.py +259 -0
- libvirtpy/rpc/options.py +66 -0
- libvirtpy/rpc/procedure.py +27 -0
- libvirtpy/rpc/protocol/__init__.py +0 -0
- libvirtpy/rpc/protocol/procedures.py +5163 -0
- libvirtpy/rpc/protocol/typed_hints.py +210 -0
- libvirtpy/rpc/protocol/types.py +9299 -0
- libvirtpy/rpc/remote.py +295 -0
- libvirtpy/rpc/remote_aio.py +106 -0
- libvirtpy/rpc/sasl.py +467 -0
- libvirtpy/rpc/session.py +424 -0
- libvirtpy/rpc/sockets.py +251 -0
- libvirtpy/rpc/stream.py +323 -0
- libvirtpy/rpc/subscription.py +451 -0
- libvirtpy/rpc/sync.py +460 -0
- libvirtpy/rpc/typed_params.py +97 -0
- libvirtpy/rpc/uri.py +85 -0
- libvirtpy/rpc/xdr.py +552 -0
- libvirtpy/xml/__init__.py +49 -0
- libvirtpy/xml/_base.py +145 -0
- libvirtpy/xml/_shared/__init__.py +1 -0
- libvirtpy/xml/_shared/metadata.py +67 -0
- libvirtpy/xml/_shared/network.py +108 -0
- libvirtpy/xml/_shared/storage.py +131 -0
- libvirtpy/xml/_shared/sysinfo.py +83 -0
- libvirtpy/xml/_types.py +197 -0
- libvirtpy/xml/_xml_element.py +134 -0
- libvirtpy/xml/backup/__init__.py +25 -0
- libvirtpy/xml/backup/backup.py +89 -0
- libvirtpy/xml/backup/checkpoint.py +48 -0
- libvirtpy/xml/capabilities/__init__.py +43 -0
- libvirtpy/xml/capabilities/domain.py +436 -0
- libvirtpy/xml/capabilities/host.py +413 -0
- libvirtpy/xml/capabilities/storagepool.py +59 -0
- libvirtpy/xml/domain/__init__.py +493 -0
- libvirtpy/xml/domain/blkiotune.py +81 -0
- libvirtpy/xml/domain/clock.py +79 -0
- libvirtpy/xml/domain/cpu.py +265 -0
- libvirtpy/xml/domain/devices/__init__.py +495 -0
- libvirtpy/xml/domain/devices/address.py +152 -0
- libvirtpy/xml/domain/devices/audio.py +204 -0
- libvirtpy/xml/domain/devices/chardev.py +197 -0
- libvirtpy/xml/domain/devices/common.py +75 -0
- libvirtpy/xml/domain/devices/controller.py +262 -0
- libvirtpy/xml/domain/devices/devices.py +79 -0
- libvirtpy/xml/domain/devices/disk.py +471 -0
- libvirtpy/xml/domain/devices/filesystem.py +206 -0
- libvirtpy/xml/domain/devices/graphics.py +245 -0
- libvirtpy/xml/domain/devices/hostdev.py +221 -0
- libvirtpy/xml/domain/devices/input.py +89 -0
- libvirtpy/xml/domain/devices/interface.py +459 -0
- libvirtpy/xml/domain/devices/iommu.py +54 -0
- libvirtpy/xml/domain/devices/memballoon.py +42 -0
- libvirtpy/xml/domain/devices/memory_device.py +101 -0
- libvirtpy/xml/domain/devices/misc.py +169 -0
- libvirtpy/xml/domain/devices/nvram.py +20 -0
- libvirtpy/xml/domain/devices/shmem.py +46 -0
- libvirtpy/xml/domain/devices/sound.py +42 -0
- libvirtpy/xml/domain/devices/tpm.py +103 -0
- libvirtpy/xml/domain/devices/usb.py +86 -0
- libvirtpy/xml/domain/devices/video.py +101 -0
- libvirtpy/xml/domain/domain.py +157 -0
- libvirtpy/xml/domain/features.py +312 -0
- libvirtpy/xml/domain/iothread.py +41 -0
- libvirtpy/xml/domain/launch_security.py +82 -0
- libvirtpy/xml/domain/memory.py +149 -0
- libvirtpy/xml/domain/misc.py +113 -0
- libvirtpy/xml/domain/namespaces.py +96 -0
- libvirtpy/xml/domain/numa.py +140 -0
- libvirtpy/xml/domain/os.py +267 -0
- libvirtpy/xml/domain/qemu.py +102 -0
- libvirtpy/xml/domain/seclabel.py +29 -0
- libvirtpy/xml/domain/storage_source.py +466 -0
- libvirtpy/xml/domain/sysinfo.py +34 -0
- libvirtpy/xml/interface/__init__.py +17 -0
- libvirtpy/xml/interface/interface.py +153 -0
- libvirtpy/xml/network/__init__.py +101 -0
- libvirtpy/xml/network/network.py +311 -0
- libvirtpy/xml/network/port.py +84 -0
- libvirtpy/xml/nodedev/__init__.py +13 -0
- libvirtpy/xml/nodedev/nodedev.py +490 -0
- libvirtpy/xml/nwfilter/__init__.py +81 -0
- libvirtpy/xml/nwfilter/binding.py +51 -0
- libvirtpy/xml/nwfilter/filter.py +92 -0
- libvirtpy/xml/nwfilter/rules.py +534 -0
- libvirtpy/xml/secret/__init__.py +11 -0
- libvirtpy/xml/secret/secret.py +36 -0
- libvirtpy/xml/snapshot/__init__.py +29 -0
- libvirtpy/xml/snapshot/snapshot.py +136 -0
- libvirtpy/xml/storage/__init__.py +75 -0
- libvirtpy/xml/storage/pool.py +219 -0
- libvirtpy/xml/storage/volume.py +102 -0
- libvirtpy/xml/sysinfo.py +40 -0
- libvirtpy-0.1.0.dist-info/METADATA +109 -0
- libvirtpy-0.1.0.dist-info/RECORD +154 -0
- libvirtpy-0.1.0.dist-info/WHEEL +4 -0
- libvirtpy-0.1.0.dist-info/licenses/LICENSE +501 -0
- libvirtpy-0.1.0.dist-info/licenses/NOTICE +23 -0
|
@@ -0,0 +1,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)
|