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,471 @@
|
|
|
1
|
+
"""``<disk>``: hard disks, CD-ROMs and floppies.
|
|
2
|
+
|
|
3
|
+
``Disk`` is a plain union with one class per ``type`` of the disk (``file``,
|
|
4
|
+
``block``, ...), built from the storage mixins of
|
|
5
|
+
``libvirtpy.xml.domain.storage_source``. The same mixins build the
|
|
6
|
+
``<backingStore>`` chain.
|
|
7
|
+
|
|
8
|
+
See https://libvirt.org/formatdomain.html#hard-drives-floppy-disks-cdroms
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from typing import Literal
|
|
12
|
+
|
|
13
|
+
from pydantic_xml import attr, element
|
|
14
|
+
|
|
15
|
+
from libvirtpy.xml._base import LibvirtXmlModel
|
|
16
|
+
from libvirtpy.xml._shared.storage import StorageEncryption
|
|
17
|
+
from libvirtpy.xml._types import OnOff, PresenceFlag, YesNo
|
|
18
|
+
from libvirtpy.xml.domain.devices.address import Address
|
|
19
|
+
from libvirtpy.xml.domain.devices.common import (
|
|
20
|
+
Alias,
|
|
21
|
+
DeviceAcpi,
|
|
22
|
+
DeviceBoot,
|
|
23
|
+
DriverIothreads,
|
|
24
|
+
VirtioDriverOptions,
|
|
25
|
+
)
|
|
26
|
+
from libvirtpy.xml.domain.storage_source import (
|
|
27
|
+
BlockStorage,
|
|
28
|
+
CtlStorage,
|
|
29
|
+
DirStorage,
|
|
30
|
+
DiskFormat,
|
|
31
|
+
FileStorage,
|
|
32
|
+
MetadataCache,
|
|
33
|
+
NetworkAuth,
|
|
34
|
+
NetworkStorage,
|
|
35
|
+
NvmeStorage,
|
|
36
|
+
VhostUserStorage,
|
|
37
|
+
VhostVdpaStorage,
|
|
38
|
+
VolumeStorage,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
__all__ = [
|
|
42
|
+
"BackingStore",
|
|
43
|
+
"BlockBackingStore",
|
|
44
|
+
"BlockDisk",
|
|
45
|
+
"BlockIo",
|
|
46
|
+
"BlockMirror",
|
|
47
|
+
"CtlBackingStore",
|
|
48
|
+
"CtlDisk",
|
|
49
|
+
"CtlMirror",
|
|
50
|
+
"DirBackingStore",
|
|
51
|
+
"DirDisk",
|
|
52
|
+
"DirMirror",
|
|
53
|
+
"Disk",
|
|
54
|
+
"DiskDriver",
|
|
55
|
+
"DiskTarget",
|
|
56
|
+
"FileBackingStore",
|
|
57
|
+
"FileDisk",
|
|
58
|
+
"FileMirror",
|
|
59
|
+
"Geometry",
|
|
60
|
+
"IoTune",
|
|
61
|
+
"Mirror",
|
|
62
|
+
"NetworkBackingStore",
|
|
63
|
+
"NetworkDisk",
|
|
64
|
+
"NetworkMirror",
|
|
65
|
+
"NvmeBackingStore",
|
|
66
|
+
"NvmeDisk",
|
|
67
|
+
"NvmeMirror",
|
|
68
|
+
"ThrottleFilter",
|
|
69
|
+
"ThrottleFilters",
|
|
70
|
+
"Transient",
|
|
71
|
+
"VhostUserBackingStore",
|
|
72
|
+
"VhostUserDisk",
|
|
73
|
+
"VhostUserMirror",
|
|
74
|
+
"VhostVdpaBackingStore",
|
|
75
|
+
"VhostVdpaDisk",
|
|
76
|
+
"VhostVdpaMirror",
|
|
77
|
+
"VolumeBackingStore",
|
|
78
|
+
"VolumeDisk",
|
|
79
|
+
"VolumeMirror",
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class StatisticEntry(LibvirtXmlModel, tag="statistic"):
|
|
84
|
+
interval: int = attr(name="interval", ge=0)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class LatencyBin(LibvirtXmlModel, tag="bin"):
|
|
88
|
+
start: int = attr(name="start", ge=0)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class LatencyHistogram(LibvirtXmlModel, tag="latency-histogram"):
|
|
92
|
+
type: Literal["read", "write", "zone", "flush"] | None = attr(
|
|
93
|
+
name="type", default=None
|
|
94
|
+
)
|
|
95
|
+
bins: list[LatencyBin] = element(tag="bin", default_factory=list)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class DiskStatistics(LibvirtXmlModel, tag="statistics"):
|
|
99
|
+
statistics: list[StatisticEntry] = element(tag="statistic", default_factory=list)
|
|
100
|
+
histograms: list[LatencyHistogram] = element(
|
|
101
|
+
tag="latency-histogram", default_factory=list
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class DiskDriver(VirtioDriverOptions, tag="driver"):
|
|
106
|
+
"""``<driver>``: the hypervisor driver and its tuning."""
|
|
107
|
+
|
|
108
|
+
name: str | None = attr(name="name", default=None, description="e.g. ``qemu``.")
|
|
109
|
+
type: str | None = attr(
|
|
110
|
+
name="type", default=None, description="Image format, e.g. ``qcow2``."
|
|
111
|
+
)
|
|
112
|
+
cache: (
|
|
113
|
+
Literal["default", "none", "writeback", "writethrough", "directsync", "unsafe"]
|
|
114
|
+
| None
|
|
115
|
+
) = attr(name="cache", default=None)
|
|
116
|
+
error_policy: Literal["stop", "report", "ignore", "enospace"] | None = attr(
|
|
117
|
+
name="error_policy", default=None
|
|
118
|
+
)
|
|
119
|
+
rerror_policy: Literal["stop", "report", "ignore"] | None = attr(
|
|
120
|
+
name="rerror_policy", default=None
|
|
121
|
+
)
|
|
122
|
+
io: Literal["threads", "native", "io_uring"] | None = attr(name="io", default=None)
|
|
123
|
+
ioeventfd: OnOff | None = attr(name="ioeventfd", default=None)
|
|
124
|
+
event_idx: OnOff | None = attr(name="event_idx", default=None)
|
|
125
|
+
copy_on_read: OnOff | None = attr(name="copy_on_read", default=None)
|
|
126
|
+
discard: Literal["unmap", "ignore"] | None = attr(name="discard", default=None)
|
|
127
|
+
iothread: int | None = attr(name="iothread", default=None, ge=0)
|
|
128
|
+
detect_zeroes: Literal["off", "on", "unmap"] | None = attr(
|
|
129
|
+
name="detect_zeroes", default=None
|
|
130
|
+
)
|
|
131
|
+
discard_no_unref: OnOff | None = attr(name="discard_no_unref", default=None)
|
|
132
|
+
queues: int | None = attr(name="queues", default=None, ge=1)
|
|
133
|
+
queue_size: int | None = attr(name="queue_size", default=None, ge=1)
|
|
134
|
+
metadata_cache: MetadataCache | None = element(tag="metadata_cache", default=None)
|
|
135
|
+
iothreads: DriverIothreads | None = element(tag="iothreads", default=None)
|
|
136
|
+
statistics: DiskStatistics | None = element(tag="statistics", default=None)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class DiskTarget(LibvirtXmlModel, tag="target"):
|
|
140
|
+
"""``<target>``: the device name and bus the guest sees."""
|
|
141
|
+
|
|
142
|
+
dev: str = attr(name="dev", description="Guest device name, e.g. ``vda``.")
|
|
143
|
+
bus: (
|
|
144
|
+
Literal[
|
|
145
|
+
"ide", "fdc", "scsi", "virtio", "xen", "usb", "uml", "sata", "sd", "nvme"
|
|
146
|
+
]
|
|
147
|
+
| None
|
|
148
|
+
) = attr(name="bus", default=None)
|
|
149
|
+
tray: Literal["open", "closed"] | None = attr(name="tray", default=None)
|
|
150
|
+
removable: OnOff | None = attr(name="removable", default=None)
|
|
151
|
+
rotation_rate: int | None = attr(name="rotation_rate", default=None, ge=1)
|
|
152
|
+
dpofua: OnOff | None = attr(name="dpofua", default=None)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
class BackendDomain(LibvirtXmlModel, tag="backenddomain"):
|
|
156
|
+
"""``<backenddomain>``: a Xen domain that serves the disk."""
|
|
157
|
+
|
|
158
|
+
name: str = attr(name="name")
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
class Transient(LibvirtXmlModel, tag="transient"):
|
|
162
|
+
"""``<transient>``: changes are discarded when the guest stops."""
|
|
163
|
+
|
|
164
|
+
share_backing: YesNo | None = attr(name="shareBacking", default=None)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
class ThrottleFilter(LibvirtXmlModel, tag="throttlefilter"):
|
|
168
|
+
group: str = attr(name="group")
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
class ThrottleFilters(LibvirtXmlModel, tag="throttlefilters"):
|
|
172
|
+
"""``<throttlefilters>``: I/O throttle groups applied to the disk."""
|
|
173
|
+
|
|
174
|
+
filters: list[ThrottleFilter] = element(tag="throttlefilter", default_factory=list)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class IoTune(LibvirtXmlModel, tag="iotune"):
|
|
178
|
+
"""``<iotune>``: I/O limits; each element text is a plain number."""
|
|
179
|
+
|
|
180
|
+
total_bytes_sec: int | None = element(tag="total_bytes_sec", default=None, ge=0)
|
|
181
|
+
read_bytes_sec: int | None = element(tag="read_bytes_sec", default=None, ge=0)
|
|
182
|
+
write_bytes_sec: int | None = element(tag="write_bytes_sec", default=None, ge=0)
|
|
183
|
+
total_iops_sec: int | None = element(tag="total_iops_sec", default=None, ge=0)
|
|
184
|
+
read_iops_sec: int | None = element(tag="read_iops_sec", default=None, ge=0)
|
|
185
|
+
write_iops_sec: int | None = element(tag="write_iops_sec", default=None, ge=0)
|
|
186
|
+
total_bytes_sec_max: int | None = element(
|
|
187
|
+
tag="total_bytes_sec_max", default=None, ge=0
|
|
188
|
+
)
|
|
189
|
+
read_bytes_sec_max: int | None = element(
|
|
190
|
+
tag="read_bytes_sec_max", default=None, ge=0
|
|
191
|
+
)
|
|
192
|
+
write_bytes_sec_max: int | None = element(
|
|
193
|
+
tag="write_bytes_sec_max", default=None, ge=0
|
|
194
|
+
)
|
|
195
|
+
total_iops_sec_max: int | None = element(
|
|
196
|
+
tag="total_iops_sec_max", default=None, ge=0
|
|
197
|
+
)
|
|
198
|
+
read_iops_sec_max: int | None = element(tag="read_iops_sec_max", default=None, ge=0)
|
|
199
|
+
write_iops_sec_max: int | None = element(
|
|
200
|
+
tag="write_iops_sec_max", default=None, ge=0
|
|
201
|
+
)
|
|
202
|
+
size_iops_sec: int | None = element(tag="size_iops_sec", default=None, ge=0)
|
|
203
|
+
group_name: str | None = element(tag="group_name", default=None)
|
|
204
|
+
total_bytes_sec_max_length: int | None = element(
|
|
205
|
+
tag="total_bytes_sec_max_length", default=None, ge=0
|
|
206
|
+
)
|
|
207
|
+
read_bytes_sec_max_length: int | None = element(
|
|
208
|
+
tag="read_bytes_sec_max_length", default=None, ge=0
|
|
209
|
+
)
|
|
210
|
+
write_bytes_sec_max_length: int | None = element(
|
|
211
|
+
tag="write_bytes_sec_max_length", default=None, ge=0
|
|
212
|
+
)
|
|
213
|
+
total_iops_sec_max_length: int | None = element(
|
|
214
|
+
tag="total_iops_sec_max_length", default=None, ge=0
|
|
215
|
+
)
|
|
216
|
+
read_iops_sec_max_length: int | None = element(
|
|
217
|
+
tag="read_iops_sec_max_length", default=None, ge=0
|
|
218
|
+
)
|
|
219
|
+
write_iops_sec_max_length: int | None = element(
|
|
220
|
+
tag="write_iops_sec_max_length", default=None, ge=0
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
class Geometry(LibvirtXmlModel, tag="geometry"):
|
|
225
|
+
"""``<geometry>``: the legacy cylinders/heads/sectors of the disk."""
|
|
226
|
+
|
|
227
|
+
cyls: int = attr(name="cyls")
|
|
228
|
+
heads: int = attr(name="heads")
|
|
229
|
+
secs: int = attr(name="secs")
|
|
230
|
+
trans: Literal["auto", "none", "lba"] | None = attr(name="trans", default=None)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
class BlockIo(LibvirtXmlModel, tag="blockio"):
|
|
234
|
+
"""``<blockio>``: block sizes the guest sees."""
|
|
235
|
+
|
|
236
|
+
logical_block_size: int | None = attr(name="logical_block_size", default=None)
|
|
237
|
+
physical_block_size: int | None = attr(name="physical_block_size", default=None)
|
|
238
|
+
discard_granularity: int | None = attr(name="discard_granularity", default=None)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
class _BackingStoreBase(LibvirtXmlModel, tag="backingStore"):
|
|
242
|
+
"""Fields of every ``<backingStore>``; an empty one ends the chain."""
|
|
243
|
+
|
|
244
|
+
index: int | None = attr(name="index", default=None, ge=1)
|
|
245
|
+
format: DiskFormat | None = element(tag="format", default=None)
|
|
246
|
+
backing_store: BackingStore | None = element(tag="backingStore", default=None)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
class FileBackingStore(_BackingStoreBase, FileStorage, tag="backingStore"):
|
|
250
|
+
"""A ``<backingStore>`` that is a file; also an empty, chain-ending one."""
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
class BlockBackingStore(_BackingStoreBase, BlockStorage, tag="backingStore"):
|
|
254
|
+
"""A ``<backingStore type='block'>``."""
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
class DirBackingStore(_BackingStoreBase, DirStorage, tag="backingStore"):
|
|
258
|
+
"""A ``<backingStore type='dir'>``."""
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
class NetworkBackingStore(_BackingStoreBase, NetworkStorage, tag="backingStore"):
|
|
262
|
+
"""A ``<backingStore type='network'>``."""
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
class VolumeBackingStore(_BackingStoreBase, VolumeStorage, tag="backingStore"):
|
|
266
|
+
"""A ``<backingStore type='volume'>``."""
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
class NvmeBackingStore(_BackingStoreBase, NvmeStorage, tag="backingStore"):
|
|
270
|
+
"""A ``<backingStore type='nvme'>``."""
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
class VhostUserBackingStore(_BackingStoreBase, VhostUserStorage, tag="backingStore"):
|
|
274
|
+
"""A ``<backingStore type='vhostuser'>``."""
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
class VhostVdpaBackingStore(_BackingStoreBase, VhostVdpaStorage, tag="backingStore"):
|
|
278
|
+
"""A ``<backingStore type='vhostvdpa'>``."""
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
class CtlBackingStore(_BackingStoreBase, CtlStorage, tag="backingStore"):
|
|
282
|
+
"""A ``<backingStore type='ctl'>``."""
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
BackingStore = (
|
|
286
|
+
FileBackingStore
|
|
287
|
+
| BlockBackingStore
|
|
288
|
+
| DirBackingStore
|
|
289
|
+
| NetworkBackingStore
|
|
290
|
+
| VolumeBackingStore
|
|
291
|
+
| NvmeBackingStore
|
|
292
|
+
| VhostUserBackingStore
|
|
293
|
+
| VhostVdpaBackingStore
|
|
294
|
+
| CtlBackingStore
|
|
295
|
+
)
|
|
296
|
+
"""Any ``<backingStore>``; the variant is chosen by its ``type`` attribute."""
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
class _MirrorBase(LibvirtXmlModel, tag="mirror"):
|
|
300
|
+
"""``<mirror>``: a running block copy or active commit of the disk."""
|
|
301
|
+
|
|
302
|
+
job: Literal["copy", "active-commit"] | None = attr(name="job", default=None)
|
|
303
|
+
ready: Literal["yes", "abort", "pivot"] | None = attr(name="ready", default=None)
|
|
304
|
+
file: str | None = attr(
|
|
305
|
+
name="file", default=None, description="Target file of a ``type='file'`` copy."
|
|
306
|
+
)
|
|
307
|
+
format: str | None = attr(
|
|
308
|
+
name="format", default=None, description="Image format of the target."
|
|
309
|
+
)
|
|
310
|
+
format_info: DiskFormat | None = element(tag="format", default=None)
|
|
311
|
+
backing_store: BackingStore | None = element(tag="backingStore", default=None)
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
class FileMirror(_MirrorBase, FileStorage, tag="mirror"):
|
|
315
|
+
"""A ``<mirror>`` that is a file."""
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
class BlockMirror(_MirrorBase, BlockStorage, tag="mirror"):
|
|
319
|
+
"""A ``<mirror type='block'>``."""
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
class DirMirror(_MirrorBase, DirStorage, tag="mirror"):
|
|
323
|
+
"""A ``<mirror type='dir'>``."""
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
class NetworkMirror(_MirrorBase, NetworkStorage, tag="mirror"):
|
|
327
|
+
"""A ``<mirror type='network'>``."""
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
class VolumeMirror(_MirrorBase, VolumeStorage, tag="mirror"):
|
|
331
|
+
"""A ``<mirror type='volume'>``."""
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
class NvmeMirror(_MirrorBase, NvmeStorage, tag="mirror"):
|
|
335
|
+
"""A ``<mirror type='nvme'>``."""
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
class VhostUserMirror(_MirrorBase, VhostUserStorage, tag="mirror"):
|
|
339
|
+
"""A ``<mirror type='vhostuser'>``."""
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
class VhostVdpaMirror(_MirrorBase, VhostVdpaStorage, tag="mirror"):
|
|
343
|
+
"""A ``<mirror type='vhostvdpa'>``."""
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
class CtlMirror(_MirrorBase, CtlStorage, tag="mirror"):
|
|
347
|
+
"""A ``<mirror type='ctl'>``."""
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
Mirror = (
|
|
351
|
+
FileMirror
|
|
352
|
+
| BlockMirror
|
|
353
|
+
| DirMirror
|
|
354
|
+
| NetworkMirror
|
|
355
|
+
| VolumeMirror
|
|
356
|
+
| NvmeMirror
|
|
357
|
+
| VhostUserMirror
|
|
358
|
+
| VhostVdpaMirror
|
|
359
|
+
| CtlMirror
|
|
360
|
+
)
|
|
361
|
+
"""Any ``<mirror>``; the variant is chosen by its ``type`` attribute."""
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
class _DiskBase(LibvirtXmlModel, tag="disk"):
|
|
365
|
+
"""Fields of every ``<disk>``, whatever its ``type``."""
|
|
366
|
+
|
|
367
|
+
device: Literal["floppy", "disk", "cdrom", "lun"] | None = attr(
|
|
368
|
+
name="device", default=None
|
|
369
|
+
)
|
|
370
|
+
model: (
|
|
371
|
+
Literal[
|
|
372
|
+
"virtio",
|
|
373
|
+
"virtio-transitional",
|
|
374
|
+
"virtio-non-transitional",
|
|
375
|
+
"usb-storage",
|
|
376
|
+
"usb-bot",
|
|
377
|
+
]
|
|
378
|
+
| None
|
|
379
|
+
) = attr(name="model", default=None)
|
|
380
|
+
snapshot: Literal["no", "internal", "external", "manual"] | None = attr(
|
|
381
|
+
name="snapshot", default=None
|
|
382
|
+
)
|
|
383
|
+
rawio: YesNo | None = attr(name="rawio", default=None, description="``lun`` only.")
|
|
384
|
+
sgio: Literal["filtered", "unfiltered"] | None = attr(
|
|
385
|
+
name="sgio", default=None, description="``lun`` only."
|
|
386
|
+
)
|
|
387
|
+
driver: DiskDriver | None = element(tag="driver", default=None)
|
|
388
|
+
target: DiskTarget | None = element(tag="target", default=None)
|
|
389
|
+
backing_store: BackingStore | None = element(tag="backingStore", default=None)
|
|
390
|
+
mirror: Mirror | None = element(tag="mirror", default=None)
|
|
391
|
+
auth: NetworkAuth | None = element(tag="auth", default=None)
|
|
392
|
+
boot: DeviceBoot | None = element(tag="boot", default=None)
|
|
393
|
+
backend_domain: BackendDomain | None = element(tag="backenddomain", default=None)
|
|
394
|
+
readonly: PresenceFlag | None = element(tag="readonly", default=None)
|
|
395
|
+
shareable: PresenceFlag | None = element(tag="shareable", default=None)
|
|
396
|
+
transient: Transient | None = element(tag="transient", default=None)
|
|
397
|
+
serial: str | None = element(tag="serial", default=None)
|
|
398
|
+
encryption: StorageEncryption | None = element(tag="encryption", default=None)
|
|
399
|
+
throttle_filters: ThrottleFilters | None = element(
|
|
400
|
+
tag="throttlefilters", default=None
|
|
401
|
+
)
|
|
402
|
+
iotune: IoTune | None = element(tag="iotune", default=None)
|
|
403
|
+
alias: Alias | None = element(tag="alias", default=None)
|
|
404
|
+
acpi: DeviceAcpi | None = element(tag="acpi", default=None)
|
|
405
|
+
address: Address | None = element(tag="address", default=None)
|
|
406
|
+
geometry: Geometry | None = element(tag="geometry", default=None)
|
|
407
|
+
blockio: BlockIo | None = element(tag="blockio", default=None)
|
|
408
|
+
wwn: str | None = element(tag="wwn", default=None)
|
|
409
|
+
vendor: str | None = element(tag="vendor", default=None)
|
|
410
|
+
product: str | None = element(tag="product", default=None)
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
class FileDisk(_DiskBase, FileStorage, tag="disk"):
|
|
414
|
+
"""A ``<disk>`` backed by a file; also a disk without ``type``."""
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
class BlockDisk(_DiskBase, BlockStorage, tag="disk"):
|
|
418
|
+
"""A ``<disk type='block'>``: a host block device."""
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
class DirDisk(_DiskBase, DirStorage, tag="disk"):
|
|
422
|
+
"""A ``<disk type='dir'>``: a host directory."""
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
class NetworkDisk(_DiskBase, NetworkStorage, tag="disk"):
|
|
426
|
+
"""A ``<disk type='network'>``: a remote image."""
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
class VolumeDisk(_DiskBase, VolumeStorage, tag="disk"):
|
|
430
|
+
"""A ``<disk type='volume'>``: a storage pool volume."""
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
class NvmeDisk(_DiskBase, NvmeStorage, tag="disk"):
|
|
434
|
+
"""A ``<disk type='nvme'>``: a host NVMe namespace. Since 6.0.0."""
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
class VhostUserDisk(_DiskBase, VhostUserStorage, tag="disk"):
|
|
438
|
+
"""A ``<disk type='vhostuser'>``. Since 7.1.0."""
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
class VhostVdpaDisk(_DiskBase, VhostVdpaStorage, tag="disk"):
|
|
442
|
+
"""A ``<disk type='vhostvdpa'>``. Since 9.8.0."""
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
class CtlDisk(_DiskBase, CtlStorage, tag="disk"):
|
|
446
|
+
"""A ``<disk type='ctl'>``: a FreeBSD CTL LUN (bhyve). Since 12.0.0."""
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
Disk = (
|
|
450
|
+
FileDisk
|
|
451
|
+
| BlockDisk
|
|
452
|
+
| DirDisk
|
|
453
|
+
| NetworkDisk
|
|
454
|
+
| VolumeDisk
|
|
455
|
+
| NvmeDisk
|
|
456
|
+
| VhostUserDisk
|
|
457
|
+
| VhostVdpaDisk
|
|
458
|
+
| CtlDisk
|
|
459
|
+
)
|
|
460
|
+
"""Any ``<disk>``; the variant is chosen by its ``type`` attribute."""
|
|
461
|
+
|
|
462
|
+
# The chain refers to ``BackingStore``, which is defined after its members.
|
|
463
|
+
FileBackingStore.model_rebuild()
|
|
464
|
+
BlockBackingStore.model_rebuild()
|
|
465
|
+
DirBackingStore.model_rebuild()
|
|
466
|
+
NetworkBackingStore.model_rebuild()
|
|
467
|
+
VolumeBackingStore.model_rebuild()
|
|
468
|
+
NvmeBackingStore.model_rebuild()
|
|
469
|
+
VhostUserBackingStore.model_rebuild()
|
|
470
|
+
VhostVdpaBackingStore.model_rebuild()
|
|
471
|
+
CtlBackingStore.model_rebuild()
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"""``<filesystem>``: directories and images shared with the guest.
|
|
2
|
+
|
|
3
|
+
One class per ``type``; ``Filesystem`` is their plain union. A missing ``type``
|
|
4
|
+
means ``mount``.
|
|
5
|
+
|
|
6
|
+
See https://libvirt.org/formatdomain.html#filesystems
|
|
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, PresenceFlag, ScaledInteger
|
|
15
|
+
from libvirtpy.xml.domain.devices.address import Address
|
|
16
|
+
from libvirtpy.xml.domain.devices.common import (
|
|
17
|
+
Alias,
|
|
18
|
+
DeviceAcpi,
|
|
19
|
+
DeviceBoot,
|
|
20
|
+
VirtioDriverOptions,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"BindFilesystem",
|
|
25
|
+
"BlockFilesystem",
|
|
26
|
+
"FileFilesystem",
|
|
27
|
+
"Filesystem",
|
|
28
|
+
"FilesystemBinary",
|
|
29
|
+
"FilesystemDriver",
|
|
30
|
+
"MountFilesystem",
|
|
31
|
+
"RamFilesystem",
|
|
32
|
+
"TemplateFilesystem",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class FilesystemDriver(VirtioDriverOptions, tag="driver"):
|
|
37
|
+
"""``<driver>``: how the host serves the filesystem."""
|
|
38
|
+
|
|
39
|
+
type: (
|
|
40
|
+
Literal["path", "handle", "loop", "nbd", "ploop", "virtiofs", "mtp"] | None
|
|
41
|
+
) = attr(name="type", default=None)
|
|
42
|
+
format: str | None = attr(name="format", default=None)
|
|
43
|
+
wrpolicy: Literal["immediate"] | None = attr(name="wrpolicy", default=None)
|
|
44
|
+
queue: int | None = attr(name="queue", default=None, ge=0)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class FilesystemTarget(LibvirtXmlModel, tag="target"):
|
|
48
|
+
dir: str = attr(name="dir", description="Mount tag or directory in the guest.")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class HardLimit(ScaledInteger, tag="space_hard_limit"):
|
|
52
|
+
"""``<space_hard_limit>``: maximum space of an LXC filesystem."""
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class SoftLimit(ScaledInteger, tag="space_soft_limit"):
|
|
56
|
+
"""``<space_soft_limit>``: soft space limit of an LXC filesystem."""
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class IdmapRange(LibvirtXmlModel):
|
|
60
|
+
start: int = attr(name="start", ge=0)
|
|
61
|
+
target: int = attr(name="target", ge=0)
|
|
62
|
+
count: int = attr(name="count", ge=0)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class UidRange(IdmapRange, tag="uid"):
|
|
66
|
+
"""``<uid>``: a range of user IDs."""
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class GidRange(IdmapRange, tag="gid"):
|
|
70
|
+
"""``<gid>``: a range of group IDs."""
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class FilesystemIdmap(LibvirtXmlModel, tag="idmap"):
|
|
74
|
+
"""``<idmap>``: user and group ID mapping."""
|
|
75
|
+
|
|
76
|
+
uids: list[UidRange] = element(tag="uid", default_factory=list)
|
|
77
|
+
gids: list[GidRange] = element(tag="gid", default_factory=list)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class BinaryCache(LibvirtXmlModel, tag="cache"):
|
|
81
|
+
mode: Literal["none", "always"] | None = attr(name="mode", default=None)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class BinarySandbox(LibvirtXmlModel, tag="sandbox"):
|
|
85
|
+
mode: Literal["namespace", "chroot"] | None = attr(name="mode", default=None)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class BinaryLock(LibvirtXmlModel, tag="lock"):
|
|
89
|
+
posix: OnOff | None = attr(name="posix", default=None)
|
|
90
|
+
flock: OnOff | None = attr(name="flock", default=None)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class BinaryThreadPool(LibvirtXmlModel, tag="thread_pool"):
|
|
94
|
+
size: int = attr(name="size")
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class BinaryOpenfiles(LibvirtXmlModel, tag="openfiles"):
|
|
98
|
+
max: int = attr(name="max", ge=1)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class FilesystemBinary(LibvirtXmlModel, tag="binary"):
|
|
102
|
+
"""``<binary>``: the virtiofsd helper and its options."""
|
|
103
|
+
|
|
104
|
+
path: str | None = attr(name="path", default=None)
|
|
105
|
+
xattr: OnOff | None = attr(name="xattr", default=None)
|
|
106
|
+
cache: BinaryCache | None = element(tag="cache", default=None)
|
|
107
|
+
sandbox: BinarySandbox | None = element(tag="sandbox", default=None)
|
|
108
|
+
lock: BinaryLock | None = element(tag="lock", default=None)
|
|
109
|
+
thread_pool: BinaryThreadPool | None = element(tag="thread_pool", default=None)
|
|
110
|
+
openfiles: BinaryOpenfiles | None = element(tag="openfiles", default=None)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class _FilesystemBase(LibvirtXmlModel, tag="filesystem"):
|
|
114
|
+
"""Fields every filesystem type has."""
|
|
115
|
+
|
|
116
|
+
model: (
|
|
117
|
+
Literal["virtio", "virtio-transitional", "virtio-non-transitional"] | None
|
|
118
|
+
) = attr(name="model", default=None)
|
|
119
|
+
accessmode: Literal["passthrough", "mapped", "squash"] | None = attr(
|
|
120
|
+
name="accessmode", default=None
|
|
121
|
+
)
|
|
122
|
+
multidevs: Literal["default", "remap", "forbid", "warn"] | None = attr(
|
|
123
|
+
name="multidevs", default=None
|
|
124
|
+
)
|
|
125
|
+
fmode: str | None = attr(name="fmode", default=None)
|
|
126
|
+
dmode: str | None = attr(name="dmode", default=None)
|
|
127
|
+
driver: FilesystemDriver | None = element(tag="driver", default=None)
|
|
128
|
+
target: FilesystemTarget | None = element(tag="target", default=None)
|
|
129
|
+
readonly: PresenceFlag | None = element(tag="readonly", default=None)
|
|
130
|
+
space_hard_limit: HardLimit | None = element(tag="space_hard_limit", default=None)
|
|
131
|
+
space_soft_limit: SoftLimit | None = element(tag="space_soft_limit", default=None)
|
|
132
|
+
alias: Alias | None = element(tag="alias", default=None)
|
|
133
|
+
acpi: DeviceAcpi | None = element(tag="acpi", default=None)
|
|
134
|
+
address: Address | None = element(tag="address", default=None)
|
|
135
|
+
boot: DeviceBoot | None = element(tag="boot", default=None)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
class FileSource(LibvirtXmlModel, tag="source"):
|
|
139
|
+
file: str = attr(name="file")
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
class FileFilesystem(_FilesystemBase, tag="filesystem"):
|
|
143
|
+
type: Literal["file"] = attr(name="type")
|
|
144
|
+
source: FileSource | None = element(tag="source", default=None)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class BlockSource(LibvirtXmlModel, tag="source"):
|
|
148
|
+
dev: str = attr(name="dev")
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
class BlockFilesystem(_FilesystemBase, tag="filesystem"):
|
|
152
|
+
type: Literal["block"] = attr(name="type")
|
|
153
|
+
source: BlockSource | None = element(tag="source", default=None)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class MountSource(LibvirtXmlModel, tag="source"):
|
|
157
|
+
dir: str | None = attr(name="dir", default=None)
|
|
158
|
+
socket: str | None = attr(name="socket", default=None)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
class MountFilesystem(_FilesystemBase, tag="filesystem"):
|
|
162
|
+
"""``type='mount'``, also the default when ``type`` is missing."""
|
|
163
|
+
|
|
164
|
+
type: Literal["mount"] | None = attr(name="type", default=None)
|
|
165
|
+
source: MountSource | None = element(tag="source", default=None)
|
|
166
|
+
binary: FilesystemBinary | None = element(tag="binary", default=None)
|
|
167
|
+
idmap: FilesystemIdmap | None = element(tag="idmap", default=None)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
class BindSource(LibvirtXmlModel, tag="source"):
|
|
171
|
+
dir: str = attr(name="dir")
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
class BindFilesystem(_FilesystemBase, tag="filesystem"):
|
|
175
|
+
type: Literal["bind"] = attr(name="type")
|
|
176
|
+
source: BindSource | None = element(tag="source", default=None)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
class TemplateSource(LibvirtXmlModel, tag="source"):
|
|
180
|
+
name: str = attr(name="name")
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
class TemplateFilesystem(_FilesystemBase, tag="filesystem"):
|
|
184
|
+
type: Literal["template"] = attr(name="type")
|
|
185
|
+
source: TemplateSource | None = element(tag="source", default=None)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class RamSource(LibvirtXmlModel, tag="source"):
|
|
189
|
+
usage: int = attr(name="usage", ge=0)
|
|
190
|
+
units: str | None = attr(name="units", default=None)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class RamFilesystem(_FilesystemBase, tag="filesystem"):
|
|
194
|
+
type: Literal["ram"] = attr(name="type")
|
|
195
|
+
source: RamSource | None = element(tag="source", default=None)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
Filesystem = (
|
|
199
|
+
MountFilesystem
|
|
200
|
+
| FileFilesystem
|
|
201
|
+
| BlockFilesystem
|
|
202
|
+
| BindFilesystem
|
|
203
|
+
| TemplateFilesystem
|
|
204
|
+
| RamFilesystem
|
|
205
|
+
)
|
|
206
|
+
"""Any ``<filesystem>``; the variant is chosen by its ``type`` attribute."""
|