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,267 @@
|
|
|
1
|
+
"""``<os>``: how the guest boots.
|
|
2
|
+
|
|
3
|
+
One ``Os`` model covers the BIOS/UEFI (``hvm``), Xen paravirtual (``xen``,
|
|
4
|
+
``linux``, ``xenpvh``) and container (``exe``) variants. They are told apart
|
|
5
|
+
by the *text* of ``<type>``, which a discriminated union cannot dispatch on;
|
|
6
|
+
libvirt's own ``virDomainOSDef`` is one structure as well.
|
|
7
|
+
|
|
8
|
+
``<nvram>`` is a union like ``<disk>``: it reuses the storage sources of
|
|
9
|
+
``libvirtpy.xml.domain.storage_source``.
|
|
10
|
+
|
|
11
|
+
See https://libvirt.org/formatdomain.html#operating-system-booting
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from typing import Literal
|
|
15
|
+
|
|
16
|
+
from pydantic import Field
|
|
17
|
+
from pydantic_xml import attr, element
|
|
18
|
+
|
|
19
|
+
from libvirtpy.xml._base import LibvirtXmlModel
|
|
20
|
+
from libvirtpy.xml._types import OptionalText, YesNo
|
|
21
|
+
from libvirtpy.xml.domain.storage_source import (
|
|
22
|
+
BlockStorage,
|
|
23
|
+
CtlStorage,
|
|
24
|
+
DirStorage,
|
|
25
|
+
FileStorage,
|
|
26
|
+
NetworkStorage,
|
|
27
|
+
NvmeStorage,
|
|
28
|
+
VhostUserStorage,
|
|
29
|
+
VhostVdpaStorage,
|
|
30
|
+
VolumeStorage,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
__all__ = [
|
|
34
|
+
"Bios",
|
|
35
|
+
"BlockNvram",
|
|
36
|
+
"Boot",
|
|
37
|
+
"BootMenu",
|
|
38
|
+
"CtlNvram",
|
|
39
|
+
"DirNvram",
|
|
40
|
+
"FileNvram",
|
|
41
|
+
"InitEnv",
|
|
42
|
+
"Loader",
|
|
43
|
+
"NetworkNvram",
|
|
44
|
+
"NvmeNvram",
|
|
45
|
+
"Nvram",
|
|
46
|
+
"Os",
|
|
47
|
+
"OsAcpi",
|
|
48
|
+
"OsAcpiTable",
|
|
49
|
+
"OsFirmware",
|
|
50
|
+
"OsFirmwareFeature",
|
|
51
|
+
"OsType",
|
|
52
|
+
"Smbios",
|
|
53
|
+
"Varstore",
|
|
54
|
+
"VhostUserNvram",
|
|
55
|
+
"VhostVdpaNvram",
|
|
56
|
+
"VolumeNvram",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
PflashFormat = Literal["raw", "qcow2"]
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class OsType(LibvirtXmlModel, tag="type"):
|
|
63
|
+
"""``<type>``: the kind of OS the guest runs."""
|
|
64
|
+
|
|
65
|
+
value: Literal["hvm", "xen", "linux", "xenpvh", "exe"] = Field(
|
|
66
|
+
description="Element text: ``hvm`` for full virtualization, ``xen``/"
|
|
67
|
+
"``linux``/``xenpvh`` for Xen paravirtualization, ``exe`` for containers."
|
|
68
|
+
)
|
|
69
|
+
arch: str | None = attr(
|
|
70
|
+
name="arch", default=None, description="CPU architecture, e.g. ``x86_64``."
|
|
71
|
+
)
|
|
72
|
+
machine: str | None = attr(
|
|
73
|
+
name="machine", default=None, description="Machine type, e.g. ``q35``."
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class OsFirmwareFeature(LibvirtXmlModel, tag="feature"):
|
|
78
|
+
"""``<feature>`` in ``<os><firmware>``. Since 7.2.0."""
|
|
79
|
+
|
|
80
|
+
enabled: YesNo = attr(name="enabled")
|
|
81
|
+
name: Literal["enrolled-keys", "secure-boot"] = attr(name="name")
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class OsFirmware(LibvirtXmlModel, tag="firmware"):
|
|
85
|
+
"""``<firmware>``: requirements for automatic firmware selection."""
|
|
86
|
+
|
|
87
|
+
features: list[OsFirmwareFeature] = element(tag="feature", default_factory=list)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class Loader(LibvirtXmlModel, tag="loader"):
|
|
91
|
+
"""``<loader>``: the firmware image (BIOS or UEFI)."""
|
|
92
|
+
|
|
93
|
+
value: OptionalText = Field(
|
|
94
|
+
default=None, description="Element text: absolute path of the image."
|
|
95
|
+
)
|
|
96
|
+
readonly: YesNo | None = attr(name="readonly", default=None)
|
|
97
|
+
secure: YesNo | None = attr(
|
|
98
|
+
name="secure", default=None, description="Secure Boot capable. Since 2.1.0."
|
|
99
|
+
)
|
|
100
|
+
type: Literal["rom", "pflash"] | None = attr(name="type", default=None)
|
|
101
|
+
stateless: YesNo | None = attr(
|
|
102
|
+
name="stateless", default=None, description="No NVRAM store. Since 8.6.0."
|
|
103
|
+
)
|
|
104
|
+
format: PflashFormat | None = attr(name="format", default=None)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class _NvramBase(LibvirtXmlModel, tag="nvram"):
|
|
108
|
+
"""``<nvram>``: the UEFI variable store (attributes of every kind)."""
|
|
109
|
+
|
|
110
|
+
value: OptionalText = Field(
|
|
111
|
+
default=None,
|
|
112
|
+
description="Element text: absolute path of the store (a file store).",
|
|
113
|
+
)
|
|
114
|
+
template: str | None = attr(
|
|
115
|
+
name="template", default=None, description="Master copy of the store."
|
|
116
|
+
)
|
|
117
|
+
template_format: PflashFormat | None = attr(name="templateFormat", default=None)
|
|
118
|
+
format: PflashFormat | None = attr(name="format", default=None)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class FileNvram(_NvramBase, FileStorage, tag="nvram"):
|
|
122
|
+
"""A file store: ``<nvram>/path</nvram>`` or ``<nvram type='file'>``."""
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class BlockNvram(_NvramBase, BlockStorage, tag="nvram"):
|
|
126
|
+
"""``<nvram type='block'>``."""
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
class DirNvram(_NvramBase, DirStorage, tag="nvram"):
|
|
130
|
+
"""``<nvram type='dir'>``."""
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class NetworkNvram(_NvramBase, NetworkStorage, tag="nvram"):
|
|
134
|
+
"""``<nvram type='network'>``."""
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class VolumeNvram(_NvramBase, VolumeStorage, tag="nvram"):
|
|
138
|
+
"""``<nvram type='volume'>``."""
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class NvmeNvram(_NvramBase, NvmeStorage, tag="nvram"):
|
|
142
|
+
"""``<nvram type='nvme'>``."""
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
class VhostUserNvram(_NvramBase, VhostUserStorage, tag="nvram"):
|
|
146
|
+
"""``<nvram type='vhostuser'>``."""
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
class VhostVdpaNvram(_NvramBase, VhostVdpaStorage, tag="nvram"):
|
|
150
|
+
"""``<nvram type='vhostvdpa'>``."""
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
class CtlNvram(_NvramBase, CtlStorage, tag="nvram"):
|
|
154
|
+
"""``<nvram type='ctl'>``."""
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
Nvram = (
|
|
158
|
+
FileNvram
|
|
159
|
+
| BlockNvram
|
|
160
|
+
| DirNvram
|
|
161
|
+
| NetworkNvram
|
|
162
|
+
| VolumeNvram
|
|
163
|
+
| NvmeNvram
|
|
164
|
+
| VhostUserNvram
|
|
165
|
+
| VhostVdpaNvram
|
|
166
|
+
| CtlNvram
|
|
167
|
+
)
|
|
168
|
+
"""Any ``<nvram>``; the variant is chosen by its ``type`` attribute."""
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
class Varstore(LibvirtXmlModel, tag="varstore"):
|
|
172
|
+
"""``<varstore>``: UEFI variables kept by the hypervisor. Since 12.1.0 (QEMU)."""
|
|
173
|
+
|
|
174
|
+
template: str | None = attr(name="template", default=None)
|
|
175
|
+
path: str | None = attr(name="path", default=None)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
class Boot(LibvirtXmlModel, tag="boot"):
|
|
179
|
+
"""``<boot>``: one device in the BIOS boot order."""
|
|
180
|
+
|
|
181
|
+
dev: Literal["hd", "fd", "cdrom", "network"] = attr(name="dev")
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
class BootMenu(LibvirtXmlModel, tag="bootmenu"):
|
|
185
|
+
"""``<bootmenu>``: the interactive boot menu."""
|
|
186
|
+
|
|
187
|
+
enable: YesNo = attr(name="enable")
|
|
188
|
+
timeout: int | None = attr(
|
|
189
|
+
name="timeout", default=None, ge=0, le=65535, description="Milliseconds."
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class Smbios(LibvirtXmlModel, tag="smbios"):
|
|
194
|
+
"""``<smbios>``: where the guest's SMBIOS data comes from."""
|
|
195
|
+
|
|
196
|
+
mode: Literal["emulate", "host", "sysinfo"] = attr(name="mode")
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
class Bios(LibvirtXmlModel, tag="bios"):
|
|
200
|
+
"""``<bios>``: BIOS settings."""
|
|
201
|
+
|
|
202
|
+
useserial: YesNo | None = attr(
|
|
203
|
+
name="useserial", default=None, description="Serial Graphics Adapter."
|
|
204
|
+
)
|
|
205
|
+
reboot_timeout: int | None = attr(
|
|
206
|
+
name="rebootTimeout",
|
|
207
|
+
default=None,
|
|
208
|
+
ge=-1,
|
|
209
|
+
le=65535,
|
|
210
|
+
description="Milliseconds before rebooting after a failed boot; -1 never.",
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
class OsAcpiTable(LibvirtXmlModel, tag="table"):
|
|
215
|
+
"""``<table>`` in ``<os><acpi>``: an extra ACPI table for the guest."""
|
|
216
|
+
|
|
217
|
+
value: str = Field(description="Element text: absolute path of the table.")
|
|
218
|
+
type: Literal["raw", "rawset", "slic", "msdm"] = attr(name="type")
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
class OsAcpi(LibvirtXmlModel, tag="acpi"):
|
|
222
|
+
"""``<acpi>`` in ``<os>``: extra ACPI tables."""
|
|
223
|
+
|
|
224
|
+
tables: list[OsAcpiTable] = element(tag="table", default_factory=list)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
class InitEnv(LibvirtXmlModel, tag="initenv"):
|
|
228
|
+
"""``<initenv>``: an environment variable for a container's init."""
|
|
229
|
+
|
|
230
|
+
value: str = Field(default="", description="Element text: the value.")
|
|
231
|
+
name: str = attr(name="name")
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
class Os(LibvirtXmlModel, tag="os"):
|
|
235
|
+
"""``<os>``: firmware, boot order and direct kernel boot."""
|
|
236
|
+
|
|
237
|
+
firmware: Literal["bios", "efi"] | None = attr(
|
|
238
|
+
name="firmware",
|
|
239
|
+
default=None,
|
|
240
|
+
description="Select the firmware automatically. Since 5.2.0.",
|
|
241
|
+
)
|
|
242
|
+
type: OsType = element(tag="type")
|
|
243
|
+
firmware_info: OsFirmware | None = element(tag="firmware", default=None)
|
|
244
|
+
loader: Loader | None = element(tag="loader", default=None)
|
|
245
|
+
nvram: Nvram | None = element(tag="nvram", default=None)
|
|
246
|
+
varstore: Varstore | None = element(tag="varstore", default=None)
|
|
247
|
+
boots: list[Boot] = element(tag="boot", default_factory=list)
|
|
248
|
+
boot_menu: BootMenu | None = element(tag="bootmenu", default=None)
|
|
249
|
+
smbios: Smbios | None = element(tag="smbios", default=None)
|
|
250
|
+
bios: Bios | None = element(tag="bios", default=None)
|
|
251
|
+
acpi: OsAcpi | None = element(tag="acpi", default=None)
|
|
252
|
+
|
|
253
|
+
# Direct kernel boot
|
|
254
|
+
kernel: str | None = element(tag="kernel", default=None)
|
|
255
|
+
initrd: str | None = element(tag="initrd", default=None)
|
|
256
|
+
root: str | None = element(tag="root", default=None)
|
|
257
|
+
cmdline: str | None = element(tag="cmdline", default=None)
|
|
258
|
+
shim: str | None = element(tag="shim", default=None)
|
|
259
|
+
dtb: str | None = element(tag="dtb", default=None)
|
|
260
|
+
|
|
261
|
+
# Container boot (type ``exe``)
|
|
262
|
+
init: str | None = element(tag="init", default=None)
|
|
263
|
+
init_args: list[str] = element(tag="initarg", default_factory=list)
|
|
264
|
+
init_envs: list[InitEnv] = element(tag="initenv", default_factory=list)
|
|
265
|
+
init_dir: str | None = element(tag="initdir", default=None)
|
|
266
|
+
init_user: str | None = element(tag="inituser", default=None)
|
|
267
|
+
init_group: str | None = element(tag="initgroup", default=None)
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"""The ``qemu:`` XML namespace: QEMU specific extensions of ``<domain>``.
|
|
2
|
+
|
|
3
|
+
They are not part of the core model; ``Domain`` wires them in explicitly.
|
|
4
|
+
|
|
5
|
+
See https://libvirt.org/drvqemu.html#pass-through-of-arbitrary-qemu-commands
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from typing import Literal
|
|
9
|
+
|
|
10
|
+
from pydantic_xml import attr, element
|
|
11
|
+
|
|
12
|
+
from libvirtpy.xml._base import LibvirtXmlModel
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"QEMU_NAMESPACE",
|
|
16
|
+
"QemuArg",
|
|
17
|
+
"QemuCapabilities",
|
|
18
|
+
"QemuCapability",
|
|
19
|
+
"QemuCommandline",
|
|
20
|
+
"QemuDeprecation",
|
|
21
|
+
"QemuEnv",
|
|
22
|
+
"QemuOverride",
|
|
23
|
+
"QemuOverrideDevice",
|
|
24
|
+
"QemuOverrideProperty",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
QEMU_NAMESPACE = "http://libvirt.org/schemas/domain/qemu/1.0"
|
|
28
|
+
_NSMAP = {"qemu": QEMU_NAMESPACE}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class QemuArg(LibvirtXmlModel, tag="arg", ns="qemu", nsmap=_NSMAP):
|
|
32
|
+
"""``<qemu:arg>``: one extra command line argument."""
|
|
33
|
+
|
|
34
|
+
value: str = attr(name="value")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class QemuEnv(LibvirtXmlModel, tag="env", ns="qemu", nsmap=_NSMAP):
|
|
38
|
+
"""``<qemu:env>``: an environment variable of the QEMU process."""
|
|
39
|
+
|
|
40
|
+
name: str = attr(name="name")
|
|
41
|
+
value: str | None = attr(name="value", default=None)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class QemuCommandline(LibvirtXmlModel, tag="commandline", ns="qemu", nsmap=_NSMAP):
|
|
45
|
+
"""``<qemu:commandline>``: extra arguments and environment for QEMU."""
|
|
46
|
+
|
|
47
|
+
args: list[QemuArg] = element(tag="arg", default_factory=list)
|
|
48
|
+
envs: list[QemuEnv] = element(tag="env", default_factory=list)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class QemuCapability(LibvirtXmlModel, ns="qemu", nsmap=_NSMAP):
|
|
52
|
+
"""Base of ``<qemu:add>`` and ``<qemu:del>``."""
|
|
53
|
+
|
|
54
|
+
capability: str = attr(name="capability")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class QemuAdd(QemuCapability, tag="add", ns="qemu", nsmap=_NSMAP):
|
|
58
|
+
"""``<qemu:add>``: force a QEMU capability on."""
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class QemuDel(QemuCapability, tag="del", ns="qemu", nsmap=_NSMAP):
|
|
62
|
+
"""``<qemu:del>``: force a QEMU capability off."""
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class QemuCapabilities(LibvirtXmlModel, tag="capabilities", ns="qemu", nsmap=_NSMAP):
|
|
66
|
+
"""``<qemu:capabilities>``: override the detected QEMU capabilities."""
|
|
67
|
+
|
|
68
|
+
adds: list[QemuAdd] = element(tag="add", default_factory=list)
|
|
69
|
+
dels: list[QemuDel] = element(tag="del", default_factory=list)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class QemuDeprecation(LibvirtXmlModel, tag="deprecation", ns="qemu", nsmap=_NSMAP):
|
|
73
|
+
"""``<qemu:deprecation>``: what to do about deprecated QEMU features."""
|
|
74
|
+
|
|
75
|
+
behavior: Literal["none", "omit", "reject", "crash"] = attr(name="behavior")
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class QemuOverrideProperty(LibvirtXmlModel, tag="property", ns="qemu", nsmap=_NSMAP):
|
|
79
|
+
"""``<qemu:property>``: set a device property."""
|
|
80
|
+
|
|
81
|
+
name: str = attr(name="name")
|
|
82
|
+
type: Literal["string", "signed", "unsigned", "bool", "remove"] = attr(name="type")
|
|
83
|
+
value: str | None = attr(name="value", default=None)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class QemuOverrideFrontend(LibvirtXmlModel, tag="frontend", ns="qemu", nsmap=_NSMAP):
|
|
87
|
+
properties: list[QemuOverrideProperty] = element(
|
|
88
|
+
tag="property", default_factory=list
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class QemuOverrideDevice(LibvirtXmlModel, tag="device", ns="qemu", nsmap=_NSMAP):
|
|
93
|
+
"""``<qemu:device>``: overrides for one device, by its alias."""
|
|
94
|
+
|
|
95
|
+
alias: str = attr(name="alias")
|
|
96
|
+
frontend: QemuOverrideFrontend | None = element(tag="frontend", default=None)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class QemuOverride(LibvirtXmlModel, tag="override", ns="qemu", nsmap=_NSMAP):
|
|
100
|
+
"""``<qemu:override>``: device property overrides."""
|
|
101
|
+
|
|
102
|
+
devices: list[QemuOverrideDevice] = element(tag="device", default_factory=list)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""``<seclabel>``: the security label of the guest process.
|
|
2
|
+
|
|
3
|
+
``<seclabel>`` inside a device source is a different element
|
|
4
|
+
(``DeviceSeclabel`` in ``libvirtpy.xml.domain.storage_source``).
|
|
5
|
+
|
|
6
|
+
See https://libvirt.org/formatdomain.html#security-label
|
|
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__ = ["Seclabel"]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class Seclabel(LibvirtXmlModel, tag="seclabel"):
|
|
20
|
+
"""``<seclabel>``: how the guest is labelled by a security driver."""
|
|
21
|
+
|
|
22
|
+
model: str | None = attr(
|
|
23
|
+
name="model", default=None, description="The driver, e.g. ``selinux``."
|
|
24
|
+
)
|
|
25
|
+
type: Literal["dynamic", "static", "none"] | None = attr(name="type", default=None)
|
|
26
|
+
relabel: YesNo | None = attr(name="relabel", default=None)
|
|
27
|
+
label: str | None = element(tag="label", default=None)
|
|
28
|
+
imagelabel: str | None = element(tag="imagelabel", default=None)
|
|
29
|
+
baselabel: str | None = element(tag="baselabel", default=None)
|