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,245 @@
1
+ """``<graphics>``: how the guest display is exposed on the host.
2
+
3
+ One class per graphics ``type``; ``Graphics`` is their plain union (see
4
+ ``libvirtpy.xml.domain.devices.address`` for why it is not a discriminated one).
5
+
6
+ See https://libvirt.org/formatdomain.html#graphical-framebuffers
7
+ """
8
+
9
+ from typing import Literal
10
+
11
+ from pydantic_xml import attr, element
12
+
13
+ from libvirtpy.xml._base import LibvirtXmlModel
14
+ from libvirtpy.xml._types import YesNo
15
+
16
+ __all__ = [
17
+ "AddressListen",
18
+ "DbusGraphics",
19
+ "DesktopGraphics",
20
+ "EglHeadlessGraphics",
21
+ "Graphics",
22
+ "GraphicsAudio",
23
+ "GraphicsGl",
24
+ "Listen",
25
+ "NetworkListen",
26
+ "NoneListen",
27
+ "RdpGraphics",
28
+ "SdlGraphics",
29
+ "SocketListen",
30
+ "SpiceChannel",
31
+ "SpiceGraphics",
32
+ "VncGraphics",
33
+ ]
34
+
35
+
36
+ class AddressListen(LibvirtXmlModel, tag="listen"):
37
+ """``<listen type='address'>``: listen on an IP address or host name."""
38
+
39
+ type: Literal["address"] = attr(name="type")
40
+ address: str | None = attr(name="address", default=None)
41
+
42
+
43
+ class NetworkListen(LibvirtXmlModel, tag="listen"):
44
+ """``<listen type='network'>``: listen on the address of a libvirt network."""
45
+
46
+ type: Literal["network"] = attr(name="type")
47
+ network: str = attr(name="network")
48
+ address: str | None = attr(
49
+ name="address", default=None, description="Filled in by libvirt."
50
+ )
51
+
52
+
53
+ class SocketListen(LibvirtXmlModel, tag="listen"):
54
+ """``<listen type='socket'>``: listen on a UNIX socket."""
55
+
56
+ type: Literal["socket"] = attr(name="type")
57
+ socket: str | None = attr(name="socket", default=None)
58
+
59
+
60
+ class NoneListen(LibvirtXmlModel, tag="listen"):
61
+ """``<listen type='none'>``: do not listen on the host."""
62
+
63
+ type: Literal["none"] = attr(name="type")
64
+
65
+
66
+ Listen = AddressListen | NetworkListen | SocketListen | NoneListen
67
+ """Any ``<listen>``; the variant is chosen by its ``type`` attribute."""
68
+
69
+
70
+ class GraphicsGl(LibvirtXmlModel, tag="gl"):
71
+ """``<gl>``: OpenGL acceleration."""
72
+
73
+ enable: YesNo | None = attr(name="enable", default=None)
74
+ rendernode: str | None = attr(name="rendernode", default=None)
75
+
76
+
77
+ class GraphicsAudio(LibvirtXmlModel, tag="audio"):
78
+ """``<audio>``: the ``<audio>`` device (by ``id``) the display uses."""
79
+
80
+ id: int = attr(name="id", ge=0, le=255)
81
+
82
+
83
+ class _GraphicsBase(LibvirtXmlModel, tag="graphics"):
84
+ """Attributes and children every graphics type has."""
85
+
86
+ listens: list[Listen] = element(tag="listen", default_factory=list)
87
+
88
+
89
+ class _NetworkGraphicsBase(_GraphicsBase):
90
+ """Attributes of the graphics types that listen on a port."""
91
+
92
+ port: int | None = attr(name="port", default=None, ge=-1, le=65535)
93
+ autoport: YesNo | None = attr(name="autoport", default=None)
94
+ listen: str | None = attr(
95
+ name="listen", default=None, description="Shortcut of ``<listen>``."
96
+ )
97
+ passwd: str | None = attr(name="passwd", default=None)
98
+ passwd_valid_to: str | None = attr(name="passwdValidTo", default=None)
99
+ keymap: str | None = attr(name="keymap", default=None)
100
+ connected: Literal["fail", "disconnect", "keep"] | None = attr(
101
+ name="connected", default=None
102
+ )
103
+
104
+
105
+ class SdlGraphics(_GraphicsBase, tag="graphics"):
106
+ """``type='sdl'``: a window on the host display."""
107
+
108
+ type: Literal["sdl"] = attr(name="type")
109
+ display: str | None = attr(name="display", default=None)
110
+ xauth: str | None = attr(name="xauth", default=None)
111
+ fullscreen: YesNo | None = attr(name="fullscreen", default=None)
112
+ gl: GraphicsGl | None = element(tag="gl", default=None)
113
+
114
+
115
+ class VncGraphics(_NetworkGraphicsBase, tag="graphics"):
116
+ """``type='vnc'``: a VNC server."""
117
+
118
+ type: Literal["vnc"] = attr(name="type")
119
+ websocket: int | None = attr(name="websocket", default=None, ge=-1, le=65535)
120
+ share_policy: Literal["allow-exclusive", "force-shared", "ignore"] | None = attr(
121
+ name="sharePolicy", default=None
122
+ )
123
+ power_control: YesNo | None = attr(name="powerControl", default=None)
124
+ wait: YesNo | None = attr(name="wait", default=None)
125
+ socket: str | None = attr(name="socket", default=None)
126
+ audio: GraphicsAudio | None = element(tag="audio", default=None)
127
+
128
+
129
+ class SpiceChannel(LibvirtXmlModel, tag="channel"):
130
+ """``<channel>``: the security mode of one SPICE channel."""
131
+
132
+ name: Literal[
133
+ "main",
134
+ "display",
135
+ "inputs",
136
+ "cursor",
137
+ "playback",
138
+ "record",
139
+ "smartcard",
140
+ "usbredir",
141
+ ] = attr(name="name")
142
+ mode: Literal["any", "secure", "insecure"] = attr(name="mode")
143
+
144
+
145
+ class SpiceImage(LibvirtXmlModel, tag="image"):
146
+ compression: Literal["auto_glz", "auto_lz", "quic", "glz", "lz", "off"] = attr(
147
+ name="compression"
148
+ )
149
+
150
+
151
+ class SpiceJpeg(LibvirtXmlModel, tag="jpeg"):
152
+ compression: Literal["auto", "never", "always"] = attr(name="compression")
153
+
154
+
155
+ class SpiceZlib(LibvirtXmlModel, tag="zlib"):
156
+ compression: Literal["auto", "never", "always"] = attr(name="compression")
157
+
158
+
159
+ class SpicePlayback(LibvirtXmlModel, tag="playback"):
160
+ compression: Literal["on", "off"] = attr(name="compression")
161
+
162
+
163
+ class SpiceStreaming(LibvirtXmlModel, tag="streaming"):
164
+ mode: Literal["filter", "all", "off"] = attr(name="mode")
165
+
166
+
167
+ class SpiceClipboard(LibvirtXmlModel, tag="clipboard"):
168
+ copypaste: YesNo = attr(name="copypaste")
169
+
170
+
171
+ class SpiceMouse(LibvirtXmlModel, tag="mouse"):
172
+ mode: Literal["server", "client"] = attr(name="mode")
173
+
174
+
175
+ class SpiceFiletransfer(LibvirtXmlModel, tag="filetransfer"):
176
+ enable: YesNo = attr(name="enable")
177
+
178
+
179
+ class SpiceGraphics(_NetworkGraphicsBase, tag="graphics"):
180
+ """``type='spice'``: a SPICE server."""
181
+
182
+ type: Literal["spice"] = attr(name="type")
183
+ tls_port: int | None = attr(name="tlsPort", default=None, ge=-1, le=65535)
184
+ default_mode: Literal["any", "secure", "insecure"] | None = attr(
185
+ name="defaultMode", default=None
186
+ )
187
+ channels: list[SpiceChannel] = element(tag="channel", default_factory=list)
188
+ image: SpiceImage | None = element(tag="image", default=None)
189
+ jpeg: SpiceJpeg | None = element(tag="jpeg", default=None)
190
+ zlib: SpiceZlib | None = element(tag="zlib", default=None)
191
+ playback: SpicePlayback | None = element(tag="playback", default=None)
192
+ streaming: SpiceStreaming | None = element(tag="streaming", default=None)
193
+ clipboard: SpiceClipboard | None = element(tag="clipboard", default=None)
194
+ mouse: SpiceMouse | None = element(tag="mouse", default=None)
195
+ filetransfer: SpiceFiletransfer | None = element(tag="filetransfer", default=None)
196
+ gl: GraphicsGl | None = element(tag="gl", default=None)
197
+
198
+
199
+ class DbusGraphics(_GraphicsBase, tag="graphics"):
200
+ """``type='dbus'``: a D-Bus display."""
201
+
202
+ type: Literal["dbus"] = attr(name="type")
203
+ address: str | None = attr(name="address", default=None)
204
+ p2p: YesNo | None = attr(name="p2p", default=None)
205
+ gl: GraphicsGl | None = element(tag="gl", default=None)
206
+ audio: GraphicsAudio | None = element(tag="audio", default=None)
207
+
208
+
209
+ class RdpGraphics(_GraphicsBase, tag="graphics"):
210
+ """``type='rdp'``: an RDP server."""
211
+
212
+ type: Literal["rdp"] = attr(name="type")
213
+ port: int | None = attr(name="port", default=None, ge=-1, le=65535)
214
+ autoport: YesNo | None = attr(name="autoport", default=None)
215
+ replace_user: YesNo | None = attr(name="replaceUser", default=None)
216
+ multi_user: YesNo | None = attr(name="multiUser", default=None)
217
+ listen: str | None = attr(name="listen", default=None)
218
+ username: str | None = attr(name="username", default=None)
219
+ passwd: str | None = attr(name="passwd", default=None)
220
+
221
+
222
+ class DesktopGraphics(_GraphicsBase, tag="graphics"):
223
+ """``type='desktop'``: a window on the host desktop (VirtualBox)."""
224
+
225
+ type: Literal["desktop"] = attr(name="type")
226
+ display: str | None = attr(name="display", default=None)
227
+
228
+
229
+ class EglHeadlessGraphics(_GraphicsBase, tag="graphics"):
230
+ """``type='egl-headless'``: remote rendering without a display."""
231
+
232
+ type: Literal["egl-headless"] = attr(name="type")
233
+ gl: GraphicsGl | None = element(tag="gl", default=None)
234
+
235
+
236
+ Graphics = (
237
+ SdlGraphics
238
+ | VncGraphics
239
+ | SpiceGraphics
240
+ | DbusGraphics
241
+ | RdpGraphics
242
+ | DesktopGraphics
243
+ | EglHeadlessGraphics
244
+ )
245
+ """Any ``<graphics>``; the variant is chosen by its ``type`` attribute."""
@@ -0,0 +1,221 @@
1
+ """``<hostdev>``: host devices passed through to the guest.
2
+
3
+ One class per ``type`` (``pci``, ``usb``, ``scsi``, ...); ``Hostdev`` is their
4
+ plain union. The ``mode`` attribute (``subsystem``, or ``capabilities`` for
5
+ ``storage``, ``misc`` and ``net``) follows from the type and is kept as written.
6
+
7
+ See https://libvirt.org/formatdomain.html#host-device-assignment
8
+ """
9
+
10
+ from typing import Literal
11
+
12
+ from pydantic_xml import attr, element
13
+
14
+ from libvirtpy.xml._base import LibvirtXmlModel
15
+ from libvirtpy.xml._shared.network import Route
16
+ from libvirtpy.xml._shared.storage import HostPciAddress, ScsiAdapter
17
+ from libvirtpy.xml._types import OnOff, PresenceFlag, Uuid, YesNo
18
+ from libvirtpy.xml.domain.devices.address import Address
19
+ from libvirtpy.xml.domain.devices.common import Alias, DeviceAcpi, DeviceBoot
20
+ from libvirtpy.xml.domain.devices.interface import (
21
+ HostdevProduct,
22
+ HostdevVendor,
23
+ InterfaceIp,
24
+ InterfaceRom,
25
+ InterfaceTeaming,
26
+ )
27
+ from libvirtpy.xml.domain.storage_source import Initiator, NetworkAuth
28
+
29
+ __all__ = [
30
+ "Hostdev",
31
+ "HostdevDriver",
32
+ "MdevHostdev",
33
+ "MiscHostdev",
34
+ "NetHostdev",
35
+ "PciHostdev",
36
+ "ScsiHostHostdev",
37
+ "ScsiHostdev",
38
+ "StorageHostdev",
39
+ "UsbHostdev",
40
+ ]
41
+
42
+ StartupPolicy = Literal["mandatory", "requisite", "optional"]
43
+
44
+
45
+ class HostdevDriver(LibvirtXmlModel, tag="driver"):
46
+ """``<driver>``: which host driver binds the device."""
47
+
48
+ name: Literal["kvm", "vfio", "xen"] | None = attr(name="name", default=None)
49
+ model: str | None = attr(name="model", default=None)
50
+ iommufd: YesNo | None = attr(name="iommufd", default=None)
51
+
52
+
53
+ class _HostdevBase(LibvirtXmlModel, tag="hostdev"):
54
+ """Fields every hostdev type has."""
55
+
56
+ mode: Literal["subsystem", "capabilities"] | None = attr(name="mode", default=None)
57
+ managed: YesNo | None = attr(name="managed", default=None)
58
+ rom: InterfaceRom | None = element(tag="rom", default=None)
59
+ readonly: PresenceFlag | None = element(tag="readonly", default=None)
60
+ shareable: PresenceFlag | None = element(tag="shareable", default=None)
61
+ alias: Alias | None = element(tag="alias", default=None)
62
+ acpi: DeviceAcpi | None = element(tag="acpi", default=None)
63
+ address: Address | None = element(tag="address", default=None)
64
+ boot: DeviceBoot | None = element(tag="boot", default=None)
65
+
66
+
67
+ class PciSource(LibvirtXmlModel, tag="source"):
68
+ start_policy: StartupPolicy | None = attr(name="startupPolicy", default=None)
69
+ write_filtering: YesNo | None = attr(name="writeFiltering", default=None)
70
+ address: HostPciAddress = element(tag="address")
71
+
72
+
73
+ class PciHostdev(_HostdevBase, tag="hostdev"):
74
+ """``type='pci'``: a PCI device, optionally with a vfio display."""
75
+
76
+ type: Literal["pci"] = attr(name="type")
77
+ ramfb: OnOff | None = attr(name="ramfb", default=None)
78
+ display: OnOff | None = attr(name="display", default=None)
79
+ driver: HostdevDriver | None = element(tag="driver", default=None)
80
+ teaming: InterfaceTeaming | None = element(tag="teaming", default=None)
81
+ source: PciSource | None = element(tag="source", default=None)
82
+
83
+
84
+ class UsbAddress(LibvirtXmlModel, tag="address"):
85
+ """``<address>`` of a host USB device: bus plus device or port."""
86
+
87
+ bus: str = attr(name="bus")
88
+ device: str | None = attr(name="device", default=None)
89
+ port: str | None = attr(name="port", default=None)
90
+
91
+
92
+ class UsbSource(LibvirtXmlModel, tag="source"):
93
+ start_policy: StartupPolicy | None = attr(name="startupPolicy", default=None)
94
+ guest_reset: Literal["off", "uninitialized", "on"] | None = attr(
95
+ name="guestReset", default=None
96
+ )
97
+ vendor: HostdevVendor | None = element(tag="vendor", default=None)
98
+ product: HostdevProduct | None = element(tag="product", default=None)
99
+ address: UsbAddress | None = element(tag="address", default=None)
100
+
101
+
102
+ class UsbHostdev(_HostdevBase, tag="hostdev"):
103
+ """``type='usb'``: a USB device, by vendor/product or by address."""
104
+
105
+ type: Literal["usb"] = attr(name="type")
106
+ source: UsbSource | None = element(tag="source", default=None)
107
+
108
+
109
+ class ScsiAddress(LibvirtXmlModel, tag="address"):
110
+ bus: str = attr(name="bus")
111
+ target: str = attr(name="target")
112
+ unit: str = attr(name="unit")
113
+
114
+
115
+ class ScsiHost(LibvirtXmlModel, tag="host"):
116
+ """``<host>``: an iSCSI portal."""
117
+
118
+ name: str = attr(name="name")
119
+ port: int | None = attr(name="port", default=None, ge=0, le=65535)
120
+
121
+
122
+ class ScsiSource(LibvirtXmlModel, tag="source"):
123
+ """``<source>`` of a SCSI hostdev: a local adapter or an iSCSI target."""
124
+
125
+ protocol: Literal["adapter", "iscsi"] | None = attr(name="protocol", default=None)
126
+ name: str | None = attr(name="name", default=None)
127
+ adapter: ScsiAdapter | None = element(tag="adapter", default=None)
128
+ address: ScsiAddress | None = element(tag="address", default=None)
129
+ hosts: list[ScsiHost] = element(tag="host", default_factory=list)
130
+ auth: NetworkAuth | None = element(tag="auth", default=None)
131
+ initiator: Initiator | None = element(tag="initiator", default=None)
132
+
133
+
134
+ class ScsiHostdev(_HostdevBase, tag="hostdev"):
135
+ """``type='scsi'``: a SCSI device."""
136
+
137
+ type: Literal["scsi"] = attr(name="type")
138
+ sgio: Literal["filtered", "unfiltered"] | None = attr(name="sgio", default=None)
139
+ rawio: YesNo | None = attr(name="rawio", default=None)
140
+ source: ScsiSource | None = element(tag="source", default=None)
141
+
142
+
143
+ class ScsiHostSource(LibvirtXmlModel, tag="source"):
144
+ protocol: Literal["vhost"] = attr(name="protocol")
145
+ wwpn: str = attr(name="wwpn")
146
+
147
+
148
+ class ScsiHostHostdev(_HostdevBase, tag="hostdev"):
149
+ """``type='scsi_host'``: a vhost-scsi target."""
150
+
151
+ type: Literal["scsi_host"] = attr(name="type")
152
+ model: (
153
+ Literal["virtio", "virtio-transitional", "virtio-non-transitional"] | None
154
+ ) = attr(name="model", default=None)
155
+ source: ScsiHostSource | None = element(tag="source", default=None)
156
+
157
+
158
+ class MdevAddress(LibvirtXmlModel, tag="address"):
159
+ uuid: Uuid = attr(name="uuid")
160
+
161
+
162
+ class MdevSource(LibvirtXmlModel, tag="source"):
163
+ address: MdevAddress = element(tag="address")
164
+
165
+
166
+ class MdevHostdev(_HostdevBase, tag="hostdev"):
167
+ """``type='mdev'``: a mediated device."""
168
+
169
+ type: Literal["mdev"] = attr(name="type")
170
+ model: Literal["vfio-pci", "vfio-ccw", "vfio-ap"] = attr(name="model")
171
+ ramfb: OnOff | None = attr(name="ramfb", default=None)
172
+ display: OnOff | None = attr(name="display", default=None)
173
+ source: MdevSource | None = element(tag="source", default=None)
174
+
175
+
176
+ class BlockSource(LibvirtXmlModel, tag="source"):
177
+ block: str = element(tag="block", description="Host block device path.")
178
+
179
+
180
+ class StorageHostdev(_HostdevBase, tag="hostdev"):
181
+ """``type='storage'``: a host block device (LXC)."""
182
+
183
+ type: Literal["storage"] = attr(name="type")
184
+ source: BlockSource | None = element(tag="source", default=None)
185
+
186
+
187
+ class CharSource(LibvirtXmlModel, tag="source"):
188
+ char: str = element(tag="char", description="Host character device path.")
189
+
190
+
191
+ class MiscHostdev(_HostdevBase, tag="hostdev"):
192
+ """``type='misc'``: a host character device (LXC)."""
193
+
194
+ type: Literal["misc"] = attr(name="type")
195
+ source: CharSource | None = element(tag="source", default=None)
196
+
197
+
198
+ class NetSource(LibvirtXmlModel, tag="source"):
199
+ interface: str = element(tag="interface", description="Host network interface.")
200
+
201
+
202
+ class NetHostdev(_HostdevBase, tag="hostdev"):
203
+ """``type='net'``: a host network interface moved into the container (LXC)."""
204
+
205
+ type: Literal["net"] = attr(name="type")
206
+ source: NetSource | None = element(tag="source", default=None)
207
+ ips: list[InterfaceIp] = element(tag="ip", default_factory=list)
208
+ routes: list[Route] = element(tag="route", default_factory=list)
209
+
210
+
211
+ Hostdev = (
212
+ PciHostdev
213
+ | UsbHostdev
214
+ | ScsiHostdev
215
+ | ScsiHostHostdev
216
+ | MdevHostdev
217
+ | StorageHostdev
218
+ | MiscHostdev
219
+ | NetHostdev
220
+ )
221
+ """Any ``<hostdev>``; the variant is chosen by its ``type`` attribute."""
@@ -0,0 +1,89 @@
1
+ """``<input>``: mice, tablets, keyboards and passed-through input devices.
2
+
3
+ One model per kind of ``type``; ``Input`` is their union (see
4
+ ``libvirtpy.xml.domain.devices.address`` for why it is a plain union).
5
+
6
+ See https://libvirt.org/formatdomain.html#input-devices
7
+ """
8
+
9
+ from typing import Literal
10
+
11
+ from pydantic_xml import attr, element
12
+
13
+ from libvirtpy.xml._base import LibvirtXmlModel
14
+ from libvirtpy.xml._types import OnOff
15
+ from libvirtpy.xml.domain.devices.address import Address
16
+ from libvirtpy.xml.domain.devices.common import Alias, DeviceAcpi, VirtioDriverOptions
17
+
18
+ __all__ = [
19
+ "EvdevInput",
20
+ "EvdevInputSource",
21
+ "HidInput",
22
+ "Input",
23
+ "InputDriver",
24
+ "PassthroughInput",
25
+ "PassthroughInputSource",
26
+ ]
27
+
28
+
29
+ class InputDriver(VirtioDriverOptions, tag="driver"):
30
+ """``<driver>`` of an input device: virtio options only."""
31
+
32
+
33
+ class _InputBase(LibvirtXmlModel, tag="input"):
34
+ """Fields every input type has."""
35
+
36
+ model: (
37
+ Literal["virtio", "virtio-transitional", "virtio-non-transitional"] | None
38
+ ) = attr(name="model", default=None)
39
+ driver: InputDriver | None = element(tag="driver", default=None)
40
+ alias: Alias | None = element(tag="alias", default=None)
41
+ acpi: DeviceAcpi | None = element(tag="acpi", default=None)
42
+ address: Address | None = element(tag="address", default=None)
43
+
44
+
45
+ class HidInput(_InputBase, tag="input"):
46
+ """``type='mouse'``, ``'tablet'`` or ``'keyboard'``: an emulated device."""
47
+
48
+ type: Literal["tablet", "mouse", "keyboard"] = attr(name="type")
49
+ bus: Literal["ps2", "usb", "xen", "virtio"] | None = attr(name="bus", default=None)
50
+
51
+
52
+ class PassthroughInputSource(LibvirtXmlModel, tag="source"):
53
+ evdev: str = attr(name="evdev", description="Host event device path.")
54
+
55
+
56
+ class PassthroughInput(_InputBase, tag="input"):
57
+ """``type='passthrough'``: a host event device via virtio. Since 1.3.0."""
58
+
59
+ type: Literal["passthrough"] = attr(name="type")
60
+ bus: Literal["virtio"] = attr(name="bus")
61
+ source: PassthroughInputSource = element(tag="source")
62
+
63
+
64
+ class EvdevInputSource(LibvirtXmlModel, tag="source"):
65
+ dev: str = attr(name="dev", description="Host event device path.")
66
+ grab: Literal["all"] | None = attr(name="grab", default=None)
67
+ grab_toggle: (
68
+ Literal[
69
+ "ctrl-ctrl",
70
+ "alt-alt",
71
+ "shift-shift",
72
+ "meta-meta",
73
+ "scrolllock",
74
+ "ctrl-scrolllock",
75
+ ]
76
+ | None
77
+ ) = attr(name="grabToggle", default=None)
78
+ repeat: OnOff | None = attr(name="repeat", default=None)
79
+
80
+
81
+ class EvdevInput(_InputBase, tag="input"):
82
+ """``type='evdev'``: a host event device shared with the guest. Since 7.4.0."""
83
+
84
+ type: Literal["evdev"] = attr(name="type")
85
+ source: EvdevInputSource = element(tag="source")
86
+
87
+
88
+ Input = HidInput | PassthroughInput | EvdevInput
89
+ """Any ``<input>``; the variant is chosen by its ``type`` attribute."""