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,169 @@
1
+ """Small devices: ``<panic>``, ``<watchdog>`` and ``<rng>``.
2
+
3
+ See https://libvirt.org/formatdomain.html#events-configuration (panic),
4
+ https://libvirt.org/formatdomain.html#watchdog-device and
5
+ https://libvirt.org/formatdomain.html#random-number-generator-device
6
+ """
7
+
8
+ from typing import Literal
9
+
10
+ from pydantic import Field
11
+ from pydantic_xml import attr, element
12
+
13
+ from libvirtpy.xml._base import LibvirtXmlModel
14
+ from libvirtpy.xml._types import OptionalText, ScaledInteger, YesNo
15
+ from libvirtpy.xml.domain.devices.address import Address
16
+ from libvirtpy.xml.domain.devices.chardev import (
17
+ CharDevLog,
18
+ CharDevProtocol,
19
+ CharDevSource,
20
+ CharDevType,
21
+ )
22
+ from libvirtpy.xml.domain.devices.common import Alias, DeviceAcpi, VirtioDriverOptions
23
+
24
+ __all__ = [
25
+ "Crypto",
26
+ "Lease",
27
+ "Panic",
28
+ "Pstore",
29
+ "Rng",
30
+ "RngBackend",
31
+ "RngDriver",
32
+ "RngRate",
33
+ "Vsock",
34
+ "Watchdog",
35
+ ]
36
+
37
+
38
+ class Panic(LibvirtXmlModel, tag="panic"):
39
+ """``<panic>``: a device that tells the host the guest has crashed."""
40
+
41
+ model: Literal["isa", "pseries", "hyperv", "s390", "pvpanic"] | None = attr(
42
+ name="model", default=None
43
+ )
44
+ alias: Alias | None = element(tag="alias", default=None)
45
+ address: Address | None = element(tag="address", default=None)
46
+
47
+
48
+ class Watchdog(LibvirtXmlModel, tag="watchdog"):
49
+ """``<watchdog>``: a guest watchdog timer."""
50
+
51
+ model: Literal["i6300esb", "ib700", "diag288", "itco"] = attr(name="model")
52
+ action: (
53
+ Literal["reset", "shutdown", "poweroff", "pause", "none", "dump", "inject-nmi"]
54
+ | None
55
+ ) = attr(name="action", default=None)
56
+ alias: Alias | None = element(tag="alias", default=None)
57
+ acpi: DeviceAcpi | None = element(tag="acpi", default=None)
58
+ address: Address | None = element(tag="address", default=None)
59
+
60
+
61
+ class RngDriver(VirtioDriverOptions, tag="driver"):
62
+ """``<driver>`` of an RNG device: virtio options only."""
63
+
64
+
65
+ class RngRate(LibvirtXmlModel, tag="rate"):
66
+ """``<rate>``: at most ``bytes`` bytes per ``period`` milliseconds."""
67
+
68
+ bytes: int = attr(name="bytes", ge=1)
69
+ period: int | None = attr(name="period", default=None, ge=1)
70
+
71
+
72
+ class RngBackend(LibvirtXmlModel, tag="backend"):
73
+ """``<backend>``: where the random numbers come from.
74
+
75
+ ``random`` has a device path as text, ``egd`` a character device
76
+ ``type`` with ``<source>``, and ``builtin`` neither.
77
+ """
78
+
79
+ model: Literal["random", "egd", "builtin"] = attr(name="model")
80
+ value: OptionalText = Field(
81
+ default=None, description="Element text: the device path of ``random``."
82
+ )
83
+ type: CharDevType | None = attr(name="type", default=None, description="``egd``.")
84
+ sources: list[CharDevSource] = element(tag="source", default_factory=list)
85
+ protocol: CharDevProtocol | None = element(tag="protocol", default=None)
86
+ log: CharDevLog | None = element(tag="log", default=None)
87
+
88
+
89
+ class Rng(LibvirtXmlModel, tag="rng"):
90
+ """``<rng>``: a random number generator device."""
91
+
92
+ model: Literal["virtio", "virtio-transitional", "virtio-non-transitional"] = attr(
93
+ name="model"
94
+ )
95
+ driver: RngDriver | None = element(tag="driver", default=None)
96
+ rate: RngRate | None = element(tag="rate", default=None)
97
+ backend: RngBackend = element(tag="backend")
98
+ alias: Alias | None = element(tag="alias", default=None)
99
+ acpi: DeviceAcpi | None = element(tag="acpi", default=None)
100
+ address: Address | None = element(tag="address", default=None)
101
+
102
+
103
+ class VsockCid(LibvirtXmlModel, tag="cid"):
104
+ auto: YesNo | None = attr(name="auto", default=None)
105
+ address: int | None = attr(name="address", default=None, ge=0)
106
+
107
+
108
+ class VsockDriver(VirtioDriverOptions, tag="driver"):
109
+ """``<driver>`` of a vsock device: virtio options only."""
110
+
111
+
112
+ class Vsock(LibvirtXmlModel, tag="vsock"):
113
+ """``<vsock>``: a host/guest socket device."""
114
+
115
+ model: (
116
+ Literal["virtio", "virtio-transitional", "virtio-non-transitional"] | None
117
+ ) = attr(name="model", default=None)
118
+ cid: VsockCid | None = element(tag="cid", default=None)
119
+ driver: VsockDriver | None = element(tag="driver", default=None)
120
+ alias: Alias | None = element(tag="alias", default=None)
121
+ acpi: DeviceAcpi | None = element(tag="acpi", default=None)
122
+ address: Address | None = element(tag="address", default=None)
123
+
124
+
125
+ class CryptoBackend(LibvirtXmlModel, tag="backend"):
126
+ model: Literal["builtin", "lkcf"] = attr(name="model")
127
+ queues: int | None = attr(name="queues", default=None, ge=1)
128
+
129
+
130
+ class CryptoDriver(VirtioDriverOptions, tag="driver"):
131
+ """``<driver>`` of a crypto device: virtio options only."""
132
+
133
+
134
+ class Crypto(LibvirtXmlModel, tag="crypto"):
135
+ """``<crypto>``: a virtio crypto device."""
136
+
137
+ model: Literal["virtio"] = attr(name="model")
138
+ type: Literal["qemu"] = attr(name="type")
139
+ backend: CryptoBackend = element(tag="backend")
140
+ driver: CryptoDriver | None = element(tag="driver", default=None)
141
+ alias: Alias | None = element(tag="alias", default=None)
142
+ address: Address | None = element(tag="address", default=None)
143
+
144
+
145
+ class LeaseTarget(LibvirtXmlModel, tag="target"):
146
+ path: str = attr(name="path")
147
+ offset: int | None = attr(name="offset", default=None, ge=0)
148
+
149
+
150
+ class Lease(LibvirtXmlModel, tag="lease"):
151
+ """``<lease>``: a lock manager lease."""
152
+
153
+ lockspace: str = element(tag="lockspace")
154
+ key: str = element(tag="key")
155
+ target: LeaseTarget = element(tag="target")
156
+
157
+
158
+ class PstoreSize(ScaledInteger, tag="size"):
159
+ """``<size>``: the size of the persistent store."""
160
+
161
+
162
+ class Pstore(LibvirtXmlModel, tag="pstore"):
163
+ """``<pstore>``: a persistent store for guest crash data."""
164
+
165
+ backend: Literal["acpi-erst"] = attr(name="backend")
166
+ path: str | None = element(tag="path", default=None)
167
+ size: PstoreSize = element(tag="size")
168
+ alias: Alias | None = element(tag="alias", default=None)
169
+ address: Address | None = element(tag="address", default=None)
@@ -0,0 +1,20 @@
1
+ """``<nvram>`` device: the NVRAM of PowerPC guests.
2
+
3
+ Not to be confused with ``<os><nvram>``, the UEFI variable store
4
+ (``libvirtpy.xml.domain.os``).
5
+
6
+ See https://libvirt.org/formatdomain.html#nvram-device
7
+ """
8
+
9
+ from pydantic_xml import element
10
+
11
+ from libvirtpy.xml._base import LibvirtXmlModel
12
+ from libvirtpy.xml.domain.devices.address import Address
13
+
14
+ __all__ = ["NvramDevice"]
15
+
16
+
17
+ class NvramDevice(LibvirtXmlModel, tag="nvram"):
18
+ """``<nvram>``: a non-volatile RAM device."""
19
+
20
+ address: Address | None = element(tag="address", default=None)
@@ -0,0 +1,46 @@
1
+ """``<shmem>``: shared memory between host and guest, or between guests.
2
+
3
+ See https://libvirt.org/formatdomain.html#shared-memory-device
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._types import OnOff, ScaledInteger
12
+ from libvirtpy.xml.domain.devices.address import Address
13
+ from libvirtpy.xml.domain.devices.common import Alias, DeviceAcpi
14
+
15
+ __all__ = ["Shmem", "ShmemMsi", "ShmemServer", "ShmemSize"]
16
+
17
+
18
+ class ShmemModel(LibvirtXmlModel, tag="model"):
19
+ type: Literal["ivshmem", "ivshmem-plain", "ivshmem-doorbell"] = attr(name="type")
20
+
21
+
22
+ class ShmemSize(ScaledInteger, tag="size"):
23
+ """``<size>``: the size of the shared memory region."""
24
+
25
+
26
+ class ShmemServer(LibvirtXmlModel, tag="server"):
27
+ path: str | None = attr(name="path", default=None)
28
+
29
+
30
+ class ShmemMsi(LibvirtXmlModel, tag="msi"):
31
+ ioeventfd: OnOff | None = attr(name="ioeventfd", default=None)
32
+ vectors: int | None = attr(name="vectors", default=None, ge=0)
33
+
34
+
35
+ class Shmem(LibvirtXmlModel, tag="shmem"):
36
+ """``<shmem>``: an inter-VM shared memory device."""
37
+
38
+ name: str = attr(name="name", pattern=r"^[^/]*$")
39
+ role: Literal["master", "peer"] | None = attr(name="role", default=None)
40
+ model: ShmemModel | None = element(tag="model", default=None)
41
+ size: ShmemSize | None = element(tag="size", default=None)
42
+ server: ShmemServer | None = element(tag="server", default=None)
43
+ msi: ShmemMsi | None = element(tag="msi", default=None)
44
+ alias: Alias | None = element(tag="alias", default=None)
45
+ acpi: DeviceAcpi | None = element(tag="acpi", default=None)
46
+ address: Address | None = element(tag="address", default=None)
@@ -0,0 +1,42 @@
1
+ """``<sound>``: sound cards. (Host audio backends are ``<audio>``.)
2
+
3
+ See https://libvirt.org/formatdomain.html#sound-devices
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._types import YesNo
12
+ from libvirtpy.xml.domain.devices.address import Address
13
+ from libvirtpy.xml.domain.devices.common import Alias, DeviceAcpi, VirtioDriverOptions
14
+ from libvirtpy.xml.domain.devices.graphics import GraphicsAudio
15
+
16
+ __all__ = ["Sound", "SoundCodec", "SoundDriver"]
17
+
18
+
19
+ class SoundCodec(LibvirtXmlModel, tag="codec"):
20
+ """``<codec>``: an ICH6/ICH9 codec."""
21
+
22
+ type: Literal["duplex", "micro", "output"] = attr(name="type")
23
+
24
+
25
+ class SoundDriver(VirtioDriverOptions, tag="driver"):
26
+ """``<driver>`` of a sound card: virtio options only."""
27
+
28
+
29
+ class Sound(LibvirtXmlModel, tag="sound"):
30
+ """``<sound>``: a sound card."""
31
+
32
+ model: Literal[
33
+ "sb16", "es1370", "pcspk", "ac97", "ich6", "ich7", "ich9", "usb", "virtio"
34
+ ] = attr(name="model")
35
+ multichannel: YesNo | None = attr(name="multichannel", default=None)
36
+ streams: int | None = attr(name="streams", default=None, ge=0)
37
+ audio: GraphicsAudio | None = element(tag="audio", default=None)
38
+ codecs: list[SoundCodec] = element(tag="codec", default_factory=list)
39
+ driver: SoundDriver | 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)
@@ -0,0 +1,103 @@
1
+ """``<tpm>``: a virtual Trusted Platform Module.
2
+
3
+ One class per backend ``type`` (``passthrough``, ``emulator``, ``external``).
4
+
5
+ See https://libvirt.org/formatdomain.html#tpm-device
6
+ """
7
+
8
+ from typing import Literal
9
+
10
+ from pydantic_xml import attr, element
11
+
12
+ from libvirtpy.xml._base import LibvirtXmlModel
13
+ from libvirtpy.xml._types import PresenceFlag, Uuid, YesNo
14
+ from libvirtpy.xml.domain.devices.address import Address
15
+ from libvirtpy.xml.domain.devices.common import Alias
16
+
17
+ __all__ = [
18
+ "EmulatorTpmBackend",
19
+ "ExternalTpmBackend",
20
+ "PassthroughTpmBackend",
21
+ "Tpm",
22
+ "TpmBackend",
23
+ ]
24
+
25
+
26
+ class TpmDevice(LibvirtXmlModel, tag="device"):
27
+ path: str | None = attr(name="path", default=None)
28
+
29
+
30
+ class PassthroughTpmBackend(LibvirtXmlModel, tag="backend"):
31
+ """``type='passthrough'``: a host TPM device."""
32
+
33
+ type: Literal["passthrough"] = attr(name="type")
34
+ version: Literal["1.2", "2.0"] | None = attr(name="version", default=None)
35
+ device: TpmDevice | None = element(tag="device", default=None)
36
+
37
+
38
+ class TpmEncryption(LibvirtXmlModel, tag="encryption"):
39
+ secret: Uuid = attr(name="secret")
40
+
41
+
42
+ class ActivePcrBanks(LibvirtXmlModel, tag="active_pcr_banks"):
43
+ sha1: PresenceFlag | None = element(tag="sha1", default=None)
44
+ sha256: PresenceFlag | None = element(tag="sha256", default=None)
45
+ sha384: PresenceFlag | None = element(tag="sha384", default=None)
46
+ sha512: PresenceFlag | None = element(tag="sha512", default=None)
47
+
48
+
49
+ class EmulatorSource(LibvirtXmlModel, tag="source"):
50
+ type: Literal["file", "dir"] = attr(name="type")
51
+ path: str = attr(name="path")
52
+
53
+
54
+ class TpmProfile(LibvirtXmlModel, tag="profile"):
55
+ source: str | None = attr(name="source", default=None)
56
+ remove_disabled: Literal["check", "fips-host"] | None = attr(
57
+ name="removeDisabled", default=None
58
+ )
59
+ name: str | None = attr(name="name", default=None)
60
+
61
+
62
+ class EmulatorTpmBackend(LibvirtXmlModel, tag="backend"):
63
+ """``type='emulator'``: swtpm."""
64
+
65
+ type: Literal["emulator"] = attr(name="type")
66
+ version: Literal["1.2", "2.0"] | None = attr(name="version", default=None)
67
+ persistent_state: YesNo | None = attr(name="persistent_state", default=None)
68
+ debug: int | None = attr(name="debug", default=None, ge=0, le=255)
69
+ encryption: TpmEncryption | None = element(tag="encryption", default=None)
70
+ active_pcr_banks: ActivePcrBanks | None = element(
71
+ tag="active_pcr_banks", default=None
72
+ )
73
+ source: EmulatorSource | None = element(tag="source", default=None)
74
+ profile: TpmProfile | None = element(tag="profile", default=None)
75
+
76
+
77
+ class ExternalSource(LibvirtXmlModel, tag="source"):
78
+ type: Literal["unix"] = attr(name="type")
79
+ path: str = attr(name="path")
80
+ mode: Literal["connect"] = attr(name="mode")
81
+
82
+
83
+ class ExternalTpmBackend(LibvirtXmlModel, tag="backend"):
84
+ """``type='external'``: a TPM emulator served on a socket."""
85
+
86
+ type: Literal["external"] = attr(name="type")
87
+ version: Literal["1.2", "2.0"] | None = attr(name="version", default=None)
88
+ source: ExternalSource | None = element(tag="source", default=None)
89
+
90
+
91
+ TpmBackend = PassthroughTpmBackend | EmulatorTpmBackend | ExternalTpmBackend
92
+ """Any TPM ``<backend>``; the variant is chosen by its ``type`` attribute."""
93
+
94
+
95
+ class Tpm(LibvirtXmlModel, tag="tpm"):
96
+ """``<tpm>``: a TPM device."""
97
+
98
+ model: Literal["tpm-tis", "tpm-crb", "tpm-spapr", "spapr-tpm-proxy"] | None = attr(
99
+ name="model", default=None
100
+ )
101
+ backend: TpmBackend = element(tag="backend")
102
+ alias: Alias | None = element(tag="alias", default=None)
103
+ address: Address | None = element(tag="address", default=None)
@@ -0,0 +1,86 @@
1
+ """USB-related devices: ``<hub>``, ``<redirdev>``, ``<redirfilter>``, ``<smartcard>``.
2
+
3
+ See https://libvirt.org/formatdomain.html#redirected-devices (and the sections
4
+ on USB hubs and smartcard devices).
5
+ """
6
+
7
+ from typing import Literal
8
+
9
+ from pydantic_xml import attr, element
10
+
11
+ from libvirtpy.xml._base import LibvirtXmlModel
12
+ from libvirtpy.xml._types import YesNo
13
+ from libvirtpy.xml.domain.devices.address import Address
14
+ from libvirtpy.xml.domain.devices.chardev import (
15
+ CharDevLog,
16
+ CharDevProtocol,
17
+ CharDevSource,
18
+ CharDevTarget,
19
+ CharDevType,
20
+ )
21
+ from libvirtpy.xml.domain.devices.common import Alias, DeviceAcpi, DeviceBoot
22
+
23
+ __all__ = [
24
+ "Hub",
25
+ "RedirFilter",
26
+ "Redirdev",
27
+ "Smartcard",
28
+ "UsbDeviceFilter",
29
+ ]
30
+
31
+
32
+ class Hub(LibvirtXmlModel, tag="hub"):
33
+ """``<hub>``: a USB hub."""
34
+
35
+ type: Literal["usb"] = attr(name="type")
36
+ alias: Alias | None = element(tag="alias", default=None)
37
+ address: Address | None = element(tag="address", default=None)
38
+
39
+
40
+ class Redirdev(LibvirtXmlModel, tag="redirdev"):
41
+ """``<redirdev>``: USB redirection from a client to the guest."""
42
+
43
+ bus: Literal["usb"] = attr(name="bus")
44
+ type: CharDevType = attr(name="type")
45
+ sources: list[CharDevSource] = element(tag="source", default_factory=list)
46
+ protocol: CharDevProtocol | None = element(tag="protocol", default=None)
47
+ log: CharDevLog | None = element(tag="log", default=None)
48
+ boot: DeviceBoot | None = element(tag="boot", default=None)
49
+ alias: Alias | None = element(tag="alias", default=None)
50
+ address: Address | None = element(tag="address", default=None)
51
+
52
+
53
+ class UsbDeviceFilter(LibvirtXmlModel, tag="usbdev"):
54
+ """``<usbdev>``: one rule of the redirection filter."""
55
+
56
+ allow: YesNo = attr(name="allow")
57
+ class_: str | None = attr(name="class", default=None)
58
+ vendor: str | None = attr(name="vendor", default=None)
59
+ product: str | None = attr(name="product", default=None)
60
+ version: str | None = attr(name="version", default=None)
61
+
62
+
63
+ class RedirFilter(LibvirtXmlModel, tag="redirfilter"):
64
+ """``<redirfilter>``: which USB devices may be redirected."""
65
+
66
+ usbdevs: list[UsbDeviceFilter] = element(tag="usbdev", default_factory=list)
67
+
68
+
69
+ class Smartcard(LibvirtXmlModel, tag="smartcard"):
70
+ """``<smartcard>``: a smartcard reader.
71
+
72
+ ``mode`` is ``host``, ``host-certificates`` (with ``certificates`` and
73
+ ``database``) or ``passthrough`` (a character device ``type``, with
74
+ ``sources`` and ``target``).
75
+ """
76
+
77
+ mode: Literal["host", "host-certificates", "passthrough"] = attr(name="mode")
78
+ type: CharDevType | None = attr(name="type", default=None)
79
+ certificates: list[str] = element(tag="certificate", default_factory=list)
80
+ database: str | None = element(tag="database", default=None)
81
+ sources: list[CharDevSource] = element(tag="source", default_factory=list)
82
+ protocol: CharDevProtocol | None = element(tag="protocol", default=None)
83
+ log: CharDevLog | None = element(tag="log", default=None)
84
+ target: CharDevTarget | None = element(tag="target", default=None)
85
+ acpi: DeviceAcpi | None = element(tag="acpi", default=None)
86
+ address: Address | None = element(tag="address", default=None)
@@ -0,0 +1,101 @@
1
+ """``<video>``: graphics adapters.
2
+
3
+ ``VideoModel`` is one model for all adapter types: they differ by one to
4
+ three optional attributes.
5
+
6
+ See https://libvirt.org/formatdomain.html#video-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, YesNo
15
+ from libvirtpy.xml.domain.devices.address import Address
16
+ from libvirtpy.xml.domain.devices.common import Alias, DeviceAcpi, VirtioDriverOptions
17
+
18
+ __all__ = [
19
+ "Video",
20
+ "VideoAcceleration",
21
+ "VideoDriver",
22
+ "VideoModel",
23
+ "VideoResolution",
24
+ ]
25
+
26
+
27
+ class VideoAcceleration(LibvirtXmlModel, tag="acceleration"):
28
+ accel3d: YesNo | None = attr(name="accel3d", default=None)
29
+ accel2d: YesNo | None = attr(name="accel2d", default=None)
30
+ rendernode: str | None = attr(
31
+ name="rendernode", default=None, description="Host DRM render node."
32
+ )
33
+
34
+
35
+ class VideoResolution(LibvirtXmlModel, tag="resolution"):
36
+ """``<resolution>``: the minimum guest resolution. Since 5.9.0."""
37
+
38
+ x: int = attr(name="x", ge=0)
39
+ y: int = attr(name="y", ge=0)
40
+
41
+
42
+ class VideoModel(LibvirtXmlModel, tag="model"):
43
+ """``<model>``: the emulated adapter and its memory."""
44
+
45
+ type: Literal[
46
+ "vga",
47
+ "cirrus",
48
+ "vmvga",
49
+ "xen",
50
+ "vbox",
51
+ "gop",
52
+ "none",
53
+ "bochs",
54
+ "ramfb",
55
+ "qxl",
56
+ "virtio",
57
+ ] = attr(name="type")
58
+ ram: int | None = attr(name="ram", default=None, ge=0, description="KiB, qxl.")
59
+ vgamem: int | None = attr(
60
+ name="vgamem", default=None, ge=0, description="KiB, qxl."
61
+ )
62
+ vram64: int | None = attr(
63
+ name="vram64", default=None, ge=0, description="KiB, qxl."
64
+ )
65
+ device: (
66
+ Literal[
67
+ "virtio-vga",
68
+ "virtio-vga-gl",
69
+ "virtio-gpu",
70
+ "virtio-gpu-gl",
71
+ "vhost-user-vga",
72
+ "vhost-user-gpu",
73
+ ]
74
+ | None
75
+ ) = attr(name="device", default=None, description="Only for ``virtio``.")
76
+ vram: int | None = attr(name="vram", default=None, ge=0, description="KiB.")
77
+ heads: int | None = attr(name="heads", default=None, ge=0)
78
+ primary: YesNo | None = attr(name="primary", default=None)
79
+ blob: OnOff | None = attr(name="blob", default=None)
80
+ edid: OnOff | None = attr(name="edid", default=None)
81
+ acceleration: VideoAcceleration | None = element(tag="acceleration", default=None)
82
+ resolution: VideoResolution | None = element(tag="resolution", default=None)
83
+
84
+
85
+ class VideoDriver(VirtioDriverOptions, tag="driver"):
86
+ """``<driver>`` of a video device."""
87
+
88
+ name: Literal["qemu", "vhostuser"] | None = attr(name="name", default=None)
89
+ vgaconf: Literal["io", "on", "off"] | None = attr(
90
+ name="vgaconf", default=None, description="bhyve only."
91
+ )
92
+
93
+
94
+ class Video(LibvirtXmlModel, tag="video"):
95
+ """``<video>``: a graphics adapter."""
96
+
97
+ driver: VideoDriver | None = element(tag="driver", default=None)
98
+ model: VideoModel | None = element(tag="model", default=None)
99
+ alias: Alias | None = element(tag="alias", default=None)
100
+ acpi: DeviceAcpi | None = element(tag="acpi", default=None)
101
+ address: Address | None = element(tag="address", default=None)