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,36 @@
|
|
|
1
|
+
"""``<secret>``: a secret value (passphrase, key) kept by libvirt.
|
|
2
|
+
|
|
3
|
+
See https://libvirt.org/formatsecret.html
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from typing import Literal
|
|
7
|
+
|
|
8
|
+
from pydantic_xml import attr, element
|
|
9
|
+
|
|
10
|
+
from libvirtpy.xml._base import LibvirtXmlModel
|
|
11
|
+
from libvirtpy.xml._types import Uuid, YesNo
|
|
12
|
+
|
|
13
|
+
__all__ = ["Secret", "SecretUsage"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class SecretUsage(LibvirtXmlModel, tag="usage"):
|
|
17
|
+
"""``<usage>``: what the secret is for.
|
|
18
|
+
|
|
19
|
+
The usage ``type`` decides which child names the user: ``volume`` has a
|
|
20
|
+
``<volume>`` path, ``iscsi`` a ``<target>``, the others a ``<name>``.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
type: Literal["volume", "ceph", "iscsi", "tls", "vtpm"] = attr(name="type")
|
|
24
|
+
volume: str | None = element(tag="volume", default=None)
|
|
25
|
+
name: str | None = element(tag="name", default=None)
|
|
26
|
+
target: str | None = element(tag="target", default=None)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class Secret(LibvirtXmlModel, tag="secret"):
|
|
30
|
+
"""``<secret>``: metadata of a secret (the value itself is not in the XML)."""
|
|
31
|
+
|
|
32
|
+
ephemeral: YesNo | None = attr(name="ephemeral", default=None)
|
|
33
|
+
private: YesNo | None = attr(name="private", default=None)
|
|
34
|
+
uuid: Uuid | None = element(tag="uuid", default=None)
|
|
35
|
+
description: str | None = element(tag="description", default=None)
|
|
36
|
+
usage: SecretUsage | None = element(tag="usage", default=None)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Models for domain snapshots. See https://libvirt.org/formatsnapshot.html"""
|
|
2
|
+
|
|
3
|
+
from libvirtpy.xml.snapshot.snapshot import (
|
|
4
|
+
BlockSnapshotDisk,
|
|
5
|
+
DomainReference,
|
|
6
|
+
FileSnapshotDisk,
|
|
7
|
+
InactiveDomain,
|
|
8
|
+
NetworkSnapshotDisk,
|
|
9
|
+
Snapshot,
|
|
10
|
+
SnapshotCookie,
|
|
11
|
+
SnapshotDisk,
|
|
12
|
+
SnapshotDiskDriver,
|
|
13
|
+
SnapshotMemory,
|
|
14
|
+
SnapshotParent,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
"BlockSnapshotDisk",
|
|
19
|
+
"DomainReference",
|
|
20
|
+
"FileSnapshotDisk",
|
|
21
|
+
"InactiveDomain",
|
|
22
|
+
"NetworkSnapshotDisk",
|
|
23
|
+
"Snapshot",
|
|
24
|
+
"SnapshotCookie",
|
|
25
|
+
"SnapshotDisk",
|
|
26
|
+
"SnapshotDiskDriver",
|
|
27
|
+
"SnapshotMemory",
|
|
28
|
+
"SnapshotParent",
|
|
29
|
+
]
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""``<domainsnapshot>``: a snapshot of a domain.
|
|
2
|
+
|
|
3
|
+
A snapshot embeds the domain definition at that time and describes its disks
|
|
4
|
+
with the same storage sources as a ``<disk>``, so this module uses the
|
|
5
|
+
``domain`` package.
|
|
6
|
+
|
|
7
|
+
See https://libvirt.org/formatsnapshot.html
|
|
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.metadata import RawChildren
|
|
16
|
+
from libvirtpy.xml._types import PresenceFlag, Uuid
|
|
17
|
+
from libvirtpy.xml.domain import Domain
|
|
18
|
+
from libvirtpy.xml.domain.storage_source import (
|
|
19
|
+
BlockStorage,
|
|
20
|
+
FileStorage,
|
|
21
|
+
MetadataCache,
|
|
22
|
+
NetworkStorage,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
__all__ = [
|
|
26
|
+
"BlockSnapshotDisk",
|
|
27
|
+
"DomainReference",
|
|
28
|
+
"FileSnapshotDisk",
|
|
29
|
+
"InactiveDomain",
|
|
30
|
+
"NetworkSnapshotDisk",
|
|
31
|
+
"Snapshot",
|
|
32
|
+
"SnapshotCookie",
|
|
33
|
+
"SnapshotDisk",
|
|
34
|
+
"SnapshotDiskDriver",
|
|
35
|
+
"SnapshotMemory",
|
|
36
|
+
"SnapshotParent",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class DomainReference(LibvirtXmlModel, tag="domain"):
|
|
41
|
+
"""``<domain>`` that only names the domain by its UUID."""
|
|
42
|
+
|
|
43
|
+
uuid: Uuid = element(tag="uuid")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class InactiveDomain(Domain, tag="inactiveDomain"):
|
|
47
|
+
"""``<inactiveDomain>``: the persistent definition, if it differs from the live."""
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class SnapshotCookie(RawChildren, tag="cookie"):
|
|
51
|
+
"""``<cookie>``: hypervisor private data, kept as XML strings."""
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class SnapshotMemory(LibvirtXmlModel, tag="memory"):
|
|
55
|
+
"""``<memory>``: whether and where the guest memory is saved."""
|
|
56
|
+
|
|
57
|
+
snapshot: Literal["no", "internal", "external"] = attr(name="snapshot")
|
|
58
|
+
file: str | None = attr(name="file", default=None)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class SnapshotParent(LibvirtXmlModel, tag="parent"):
|
|
62
|
+
name: str = element(tag="name")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class SnapshotDiskDriver(LibvirtXmlModel, tag="driver"):
|
|
66
|
+
"""``<driver>``: the image format of an external snapshot file."""
|
|
67
|
+
|
|
68
|
+
type: str | None = attr(name="type", default=None)
|
|
69
|
+
metadata_cache: MetadataCache | None = element(tag="metadata_cache", default=None)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class _SnapshotDiskBase(LibvirtXmlModel):
|
|
73
|
+
"""Fields every snapshot disk has, whatever its ``type``."""
|
|
74
|
+
|
|
75
|
+
name: str = attr(
|
|
76
|
+
name="name", description="Target of the disk (``vda``) or its source path."
|
|
77
|
+
)
|
|
78
|
+
snapshot: Literal["no", "internal", "external", "manual"] | None = attr(
|
|
79
|
+
name="snapshot", default=None
|
|
80
|
+
)
|
|
81
|
+
driver: SnapshotDiskDriver | None = element(tag="driver", default=None)
|
|
82
|
+
snapshot_delete_in_progress: PresenceFlag | None = element(
|
|
83
|
+
tag="snapshotDeleteInProgress", default=None
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class FileSnapshotDisk(_SnapshotDiskBase, FileStorage, tag="disk"):
|
|
88
|
+
"""A snapshot disk that is a file; also one without ``type``."""
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class BlockSnapshotDisk(_SnapshotDiskBase, BlockStorage, tag="disk"):
|
|
92
|
+
"""A snapshot disk of ``type='block'``."""
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class NetworkSnapshotDisk(_SnapshotDiskBase, NetworkStorage, tag="disk"):
|
|
96
|
+
"""A snapshot disk of ``type='network'``."""
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
SnapshotDisk = FileSnapshotDisk | BlockSnapshotDisk | NetworkSnapshotDisk
|
|
100
|
+
"""Any snapshot ``<disk>``; the variant is chosen by its ``type`` attribute."""
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class SnapshotDisks(LibvirtXmlModel, tag="disks"):
|
|
104
|
+
disks: list[SnapshotDisk] = element(tag="disk", default_factory=list)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class RevertDisks(LibvirtXmlModel, tag="revertDisks"):
|
|
108
|
+
disks: list[SnapshotDisk] = element(tag="disk", default_factory=list)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class Snapshot(LibvirtXmlModel, tag="domainsnapshot"):
|
|
112
|
+
"""``<domainsnapshot>``: a snapshot of a domain."""
|
|
113
|
+
|
|
114
|
+
name: str | None = element(tag="name", default=None)
|
|
115
|
+
description: str | None = element(tag="description", default=None)
|
|
116
|
+
state: (
|
|
117
|
+
Literal[
|
|
118
|
+
"running",
|
|
119
|
+
"blocked",
|
|
120
|
+
"paused",
|
|
121
|
+
"shutdown",
|
|
122
|
+
"shutoff",
|
|
123
|
+
"crashed",
|
|
124
|
+
"disk-snapshot",
|
|
125
|
+
]
|
|
126
|
+
| None
|
|
127
|
+
) = element(tag="state", default=None)
|
|
128
|
+
creation_time: str | None = element(tag="creationTime", default=None)
|
|
129
|
+
parent: SnapshotParent | None = element(tag="parent", default=None)
|
|
130
|
+
memory: SnapshotMemory | None = element(tag="memory", default=None)
|
|
131
|
+
disks: SnapshotDisks | None = element(tag="disks", default=None)
|
|
132
|
+
revert_disks: RevertDisks | None = element(tag="revertDisks", default=None)
|
|
133
|
+
domain: Domain | DomainReference | None = element(tag="domain", default=None)
|
|
134
|
+
inactive_domain: InactiveDomain | None = element(tag="inactiveDomain", default=None)
|
|
135
|
+
active: str | None = element(tag="active", default=None)
|
|
136
|
+
cookie: SnapshotCookie | None = element(tag="cookie", default=None)
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""Models for storage pools and volumes. See https://libvirt.org/formatstorage.html"""
|
|
2
|
+
|
|
3
|
+
from libvirtpy.xml._shared.storage import (
|
|
4
|
+
Allocation,
|
|
5
|
+
Capacity,
|
|
6
|
+
HostPciAddress,
|
|
7
|
+
Permissions,
|
|
8
|
+
ScsiAdapter,
|
|
9
|
+
ScsiParentAddress,
|
|
10
|
+
StorageCipher,
|
|
11
|
+
StorageEncryption,
|
|
12
|
+
StorageIvgen,
|
|
13
|
+
StorageSecret,
|
|
14
|
+
Timestamps,
|
|
15
|
+
)
|
|
16
|
+
from libvirtpy.xml.storage.pool import (
|
|
17
|
+
FS_NAMESPACE,
|
|
18
|
+
RBD_NAMESPACE,
|
|
19
|
+
Pool,
|
|
20
|
+
PoolAuth,
|
|
21
|
+
PoolAuthSecret,
|
|
22
|
+
PoolAvailable,
|
|
23
|
+
PoolDevice,
|
|
24
|
+
PoolDir,
|
|
25
|
+
PoolFeatures,
|
|
26
|
+
PoolFormat,
|
|
27
|
+
PoolHost,
|
|
28
|
+
PoolSource,
|
|
29
|
+
PoolTarget,
|
|
30
|
+
PoolType,
|
|
31
|
+
)
|
|
32
|
+
from libvirtpy.xml.storage.volume import (
|
|
33
|
+
Volume,
|
|
34
|
+
VolumeBackingStore,
|
|
35
|
+
VolumeFeatures,
|
|
36
|
+
VolumeFormat,
|
|
37
|
+
VolumePhysical,
|
|
38
|
+
VolumeSource,
|
|
39
|
+
VolumeTarget,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
__all__ = [
|
|
43
|
+
"FS_NAMESPACE",
|
|
44
|
+
"RBD_NAMESPACE",
|
|
45
|
+
"Allocation",
|
|
46
|
+
"Capacity",
|
|
47
|
+
"HostPciAddress",
|
|
48
|
+
"Permissions",
|
|
49
|
+
"Pool",
|
|
50
|
+
"PoolAuth",
|
|
51
|
+
"PoolAuthSecret",
|
|
52
|
+
"PoolAvailable",
|
|
53
|
+
"PoolDevice",
|
|
54
|
+
"PoolDir",
|
|
55
|
+
"PoolFeatures",
|
|
56
|
+
"PoolFormat",
|
|
57
|
+
"PoolHost",
|
|
58
|
+
"PoolSource",
|
|
59
|
+
"PoolTarget",
|
|
60
|
+
"PoolType",
|
|
61
|
+
"ScsiAdapter",
|
|
62
|
+
"ScsiParentAddress",
|
|
63
|
+
"StorageCipher",
|
|
64
|
+
"StorageEncryption",
|
|
65
|
+
"StorageIvgen",
|
|
66
|
+
"StorageSecret",
|
|
67
|
+
"Timestamps",
|
|
68
|
+
"Volume",
|
|
69
|
+
"VolumeBackingStore",
|
|
70
|
+
"VolumeFeatures",
|
|
71
|
+
"VolumeFormat",
|
|
72
|
+
"VolumePhysical",
|
|
73
|
+
"VolumeSource",
|
|
74
|
+
"VolumeTarget",
|
|
75
|
+
]
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"""``<pool>``: a storage pool.
|
|
2
|
+
|
|
3
|
+
All pool types (``dir``, ``fs``, ``netfs``, ``logical``, ``disk``, ``iscsi``,
|
|
4
|
+
``rbd``, ...) share one ``Pool`` model: they differ by which optional children
|
|
5
|
+
of ``<source>`` they use (hosts for network pools, devices for disk pools, ...),
|
|
6
|
+
and libvirt, not the model, checks which combinations are valid.
|
|
7
|
+
|
|
8
|
+
See https://libvirt.org/formatstorage.html
|
|
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 (
|
|
17
|
+
Allocation,
|
|
18
|
+
Capacity,
|
|
19
|
+
Permissions,
|
|
20
|
+
ScsiAdapter,
|
|
21
|
+
)
|
|
22
|
+
from libvirtpy.xml._types import ScaledInteger, Uuid, YesNo
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"FS_NAMESPACE",
|
|
26
|
+
"RBD_NAMESPACE",
|
|
27
|
+
"Pool",
|
|
28
|
+
"PoolAuth",
|
|
29
|
+
"PoolAuthSecret",
|
|
30
|
+
"PoolAvailable",
|
|
31
|
+
"PoolDevice",
|
|
32
|
+
"PoolDir",
|
|
33
|
+
"PoolFeatures",
|
|
34
|
+
"PoolFormat",
|
|
35
|
+
"PoolHost",
|
|
36
|
+
"PoolSource",
|
|
37
|
+
"PoolTarget",
|
|
38
|
+
"PoolType",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
FS_NAMESPACE = "http://libvirt.org/schemas/storagepool/fs/1.0"
|
|
42
|
+
RBD_NAMESPACE = "http://libvirt.org/schemas/storagepool/rbd/1.0"
|
|
43
|
+
|
|
44
|
+
PoolType = Literal[
|
|
45
|
+
"dir",
|
|
46
|
+
"fs",
|
|
47
|
+
"netfs",
|
|
48
|
+
"logical",
|
|
49
|
+
"disk",
|
|
50
|
+
"iscsi",
|
|
51
|
+
"iscsi-direct",
|
|
52
|
+
"scsi",
|
|
53
|
+
"mpath",
|
|
54
|
+
"rbd",
|
|
55
|
+
"sheepdog",
|
|
56
|
+
"gluster",
|
|
57
|
+
"zfs",
|
|
58
|
+
"vstorage",
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class PoolAvailable(ScaledInteger, tag="available"):
|
|
63
|
+
"""``<available>``: the free space of the pool."""
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class PoolCowState(LibvirtXmlModel, tag="cow"):
|
|
67
|
+
state: YesNo = attr(name="state")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class PoolFeatures(LibvirtXmlModel, tag="features"):
|
|
71
|
+
"""``<features>``: file system features of the pool."""
|
|
72
|
+
|
|
73
|
+
cow: PoolCowState | None = element(tag="cow", default=None)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class FreeExtent(LibvirtXmlModel, tag="freeExtent"):
|
|
77
|
+
start: int = attr(name="start", ge=0)
|
|
78
|
+
end: int = attr(name="end", ge=0)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class PoolDevice(LibvirtXmlModel, tag="device"):
|
|
82
|
+
"""``<device>``: a device of a disk, fs or logical pool."""
|
|
83
|
+
|
|
84
|
+
path: str = attr(name="path")
|
|
85
|
+
part_separator: YesNo | None = attr(name="part_separator", default=None)
|
|
86
|
+
free_extents: list[FreeExtent] = element(tag="freeExtent", default_factory=list)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class PoolHost(LibvirtXmlModel, tag="host"):
|
|
90
|
+
name: str = attr(name="name")
|
|
91
|
+
port: int | None = attr(name="port", default=None, ge=0, le=65535)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class PoolDir(LibvirtXmlModel, tag="dir"):
|
|
95
|
+
path: str = attr(name="path")
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class PoolVendor(LibvirtXmlModel, tag="vendor"):
|
|
99
|
+
name: str | None = attr(name="name", default=None)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class PoolProduct(LibvirtXmlModel, tag="product"):
|
|
103
|
+
name: str | None = attr(name="name", default=None)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class PoolFormat(LibvirtXmlModel, tag="format"):
|
|
107
|
+
"""``<format>``: the file system or partition table type."""
|
|
108
|
+
|
|
109
|
+
type: str = attr(name="type", description="e.g. ``ext4``, ``nfs``, ``gpt``.")
|
|
110
|
+
vendor: PoolVendor | None = element(tag="vendor", default=None)
|
|
111
|
+
product: PoolProduct | None = element(tag="product", default=None)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class PoolProtocol(LibvirtXmlModel, tag="protocol"):
|
|
115
|
+
ver: str | None = attr(name="ver", default=None)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class PoolAuthSecret(LibvirtXmlModel, tag="secret"):
|
|
119
|
+
"""``<secret>`` of a pool: a libvirt secret by ``uuid`` or ``usage``."""
|
|
120
|
+
|
|
121
|
+
uuid: Uuid | None = attr(name="uuid", default=None)
|
|
122
|
+
usage: str | None = attr(name="usage", default=None)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class PoolAuth(LibvirtXmlModel, tag="auth"):
|
|
126
|
+
"""``<auth>``: credentials for a network pool."""
|
|
127
|
+
|
|
128
|
+
type: Literal["chap", "ceph"] = attr(name="type")
|
|
129
|
+
username: str = attr(name="username")
|
|
130
|
+
secret: PoolAuthSecret = element(tag="secret")
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class PoolInitiatorIqn(LibvirtXmlModel, tag="iqn"):
|
|
134
|
+
name: str = attr(name="name")
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class PoolInitiator(LibvirtXmlModel, tag="initiator"):
|
|
138
|
+
iqn: PoolInitiatorIqn = element(tag="iqn")
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class PoolSource(LibvirtXmlModel, tag="source"):
|
|
142
|
+
"""``<source>``: where the pool's storage comes from."""
|
|
143
|
+
|
|
144
|
+
hosts: list[PoolHost] = element(tag="host", default_factory=list)
|
|
145
|
+
devices: list[PoolDevice] = element(tag="device", default_factory=list)
|
|
146
|
+
dir: PoolDir | None = element(tag="dir", default=None)
|
|
147
|
+
names: list[str] = element(tag="name", default_factory=list)
|
|
148
|
+
format: PoolFormat | None = element(tag="format", default=None)
|
|
149
|
+
protocol: PoolProtocol | None = element(tag="protocol", default=None)
|
|
150
|
+
adapter: ScsiAdapter | None = element(tag="adapter", default=None)
|
|
151
|
+
auth: PoolAuth | None = element(tag="auth", default=None)
|
|
152
|
+
initiator: PoolInitiator | None = element(tag="initiator", default=None)
|
|
153
|
+
vendor: PoolVendor | None = element(tag="vendor", default=None)
|
|
154
|
+
product: PoolProduct | None = element(tag="product", default=None)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
class PoolTarget(LibvirtXmlModel, tag="target"):
|
|
158
|
+
"""``<target>``: where the pool is mapped in the host file system."""
|
|
159
|
+
|
|
160
|
+
path: str | None = element(tag="path", default=None)
|
|
161
|
+
permissions: Permissions | None = element(tag="permissions", default=None)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class RefreshVolume(LibvirtXmlModel, tag="volume"):
|
|
165
|
+
allocation: Literal["default", "capacity"] | None = attr(
|
|
166
|
+
name="allocation", default=None
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
class PoolRefresh(LibvirtXmlModel, tag="refresh"):
|
|
171
|
+
"""``<refresh>``: how the pool refreshes its volume list. Since 6.7.0."""
|
|
172
|
+
|
|
173
|
+
volume: RefreshVolume | None = element(tag="volume", default=None)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
class MountOption(LibvirtXmlModel, tag="option", ns="fs", nsmap={"fs": FS_NAMESPACE}):
|
|
177
|
+
name: str = attr(name="name")
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
class MountOptions(
|
|
181
|
+
LibvirtXmlModel, tag="mount_opts", ns="fs", nsmap={"fs": FS_NAMESPACE}
|
|
182
|
+
):
|
|
183
|
+
"""``<fs:mount_opts>``: extra mount options of an ``fs`` or ``netfs`` pool."""
|
|
184
|
+
|
|
185
|
+
options: list[MountOption] = element(tag="option", default_factory=list)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class RbdOption(LibvirtXmlModel, tag="option", ns="rbd", nsmap={"rbd": RBD_NAMESPACE}):
|
|
189
|
+
name: str = attr(name="name")
|
|
190
|
+
value: str = attr(name="value")
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class RbdConfigOptions(
|
|
194
|
+
LibvirtXmlModel, tag="config_opts", ns="rbd", nsmap={"rbd": RBD_NAMESPACE}
|
|
195
|
+
):
|
|
196
|
+
"""``<rbd:config_opts>``: extra librbd settings."""
|
|
197
|
+
|
|
198
|
+
options: list[RbdOption] = element(tag="option", default_factory=list)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
class Pool(LibvirtXmlModel, tag="pool"):
|
|
202
|
+
"""``<pool>``: a storage pool."""
|
|
203
|
+
|
|
204
|
+
type: PoolType = attr(name="type")
|
|
205
|
+
name: str | None = element(tag="name", default=None)
|
|
206
|
+
uuid: Uuid | None = element(tag="uuid", default=None)
|
|
207
|
+
capacity: Capacity | None = element(tag="capacity", default=None)
|
|
208
|
+
allocation: Allocation | None = element(tag="allocation", default=None)
|
|
209
|
+
available: PoolAvailable | None = element(tag="available", default=None)
|
|
210
|
+
features: PoolFeatures | None = element(tag="features", default=None)
|
|
211
|
+
source: PoolSource | None = element(tag="source", default=None)
|
|
212
|
+
target: PoolTarget | None = element(tag="target", default=None)
|
|
213
|
+
refresh: PoolRefresh | None = element(tag="refresh", default=None)
|
|
214
|
+
mount_options: MountOptions | None = element(
|
|
215
|
+
tag="mount_opts", ns="fs", nsmap={"fs": FS_NAMESPACE}, default=None
|
|
216
|
+
)
|
|
217
|
+
rbd_config_options: RbdConfigOptions | None = element(
|
|
218
|
+
tag="config_opts", ns="rbd", nsmap={"rbd": RBD_NAMESPACE}, default=None
|
|
219
|
+
)
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"""``<volume>``: a storage volume.
|
|
2
|
+
|
|
3
|
+
See https://libvirt.org/formatstorage.html#storage-volume-xml
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from typing import Literal
|
|
7
|
+
|
|
8
|
+
from pydantic_xml import attr, element
|
|
9
|
+
|
|
10
|
+
from libvirtpy.xml._base import LibvirtXmlModel
|
|
11
|
+
from libvirtpy.xml._shared.storage import (
|
|
12
|
+
Allocation,
|
|
13
|
+
Capacity,
|
|
14
|
+
Permissions,
|
|
15
|
+
StorageEncryption,
|
|
16
|
+
Timestamps,
|
|
17
|
+
)
|
|
18
|
+
from libvirtpy.xml._types import PresenceFlag, ScaledInteger
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"Volume",
|
|
22
|
+
"VolumeBackingStore",
|
|
23
|
+
"VolumeFeatures",
|
|
24
|
+
"VolumeFormat",
|
|
25
|
+
"VolumePhysical",
|
|
26
|
+
"VolumeSource",
|
|
27
|
+
"VolumeTarget",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class VolumePhysical(ScaledInteger, tag="physical"):
|
|
32
|
+
"""``<physical>``: the size of the volume on the host file system."""
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class VolumeExtent(LibvirtXmlModel, tag="extent"):
|
|
36
|
+
start: int = attr(name="start", ge=0)
|
|
37
|
+
end: int = attr(name="end", ge=0)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class VolumeSourceDevice(LibvirtXmlModel, tag="device"):
|
|
41
|
+
path: str = attr(name="path")
|
|
42
|
+
extents: list[VolumeExtent] = element(tag="extent", default_factory=list)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class VolumeSource(LibvirtXmlModel, tag="source"):
|
|
46
|
+
"""``<source>``: the devices a volume was allocated from."""
|
|
47
|
+
|
|
48
|
+
devices: list[VolumeSourceDevice] = element(tag="device", default_factory=list)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class VolumeFormat(LibvirtXmlModel, tag="format"):
|
|
52
|
+
type: str = attr(name="type", description="e.g. ``raw`` or ``qcow2``.")
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class ClusterSize(ScaledInteger, tag="clusterSize"):
|
|
56
|
+
"""``<clusterSize>``: the qcow2 cluster size."""
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class VolumeFeatures(LibvirtXmlModel, tag="features"):
|
|
60
|
+
"""``<features>`` of a qcow2 volume."""
|
|
61
|
+
|
|
62
|
+
lazy_refcounts: PresenceFlag | None = element(tag="lazy_refcounts", default=None)
|
|
63
|
+
extended_l2: PresenceFlag | None = element(tag="extended_l2", default=None)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class VolumeTarget(LibvirtXmlModel, tag="target"):
|
|
67
|
+
"""``<target>``: how the volume looks on the host."""
|
|
68
|
+
|
|
69
|
+
path: str | None = element(tag="path", default=None)
|
|
70
|
+
format: VolumeFormat | None = element(tag="format", default=None)
|
|
71
|
+
permissions: Permissions | None = element(tag="permissions", default=None)
|
|
72
|
+
timestamps: Timestamps | None = element(tag="timestamps", default=None)
|
|
73
|
+
encryption: StorageEncryption | None = element(tag="encryption", default=None)
|
|
74
|
+
compat: str | None = element(tag="compat", default=None)
|
|
75
|
+
nocow: PresenceFlag | None = element(tag="nocow", default=None)
|
|
76
|
+
cluster_size: ClusterSize | None = element(tag="clusterSize", default=None)
|
|
77
|
+
features: VolumeFeatures | None = element(tag="features", default=None)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class VolumeBackingStore(LibvirtXmlModel, tag="backingStore"):
|
|
81
|
+
"""``<backingStore>``: the image this volume is a copy-on-write layer of."""
|
|
82
|
+
|
|
83
|
+
path: str = element(tag="path")
|
|
84
|
+
format: VolumeFormat | None = element(tag="format", default=None)
|
|
85
|
+
permissions: Permissions | None = element(tag="permissions", default=None)
|
|
86
|
+
timestamps: Timestamps | None = element(tag="timestamps", default=None)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class Volume(LibvirtXmlModel, tag="volume"):
|
|
90
|
+
"""``<volume>``: a storage volume."""
|
|
91
|
+
|
|
92
|
+
type: Literal["file", "block", "dir", "network", "netdir"] | None = attr(
|
|
93
|
+
name="type", default=None
|
|
94
|
+
)
|
|
95
|
+
name: str = element(tag="name")
|
|
96
|
+
key: str | None = element(tag="key", default=None)
|
|
97
|
+
source: VolumeSource | None = element(tag="source", default=None)
|
|
98
|
+
capacity: Capacity | None = element(tag="capacity", default=None)
|
|
99
|
+
allocation: Allocation | None = element(tag="allocation", default=None)
|
|
100
|
+
physical: VolumePhysical | None = element(tag="physical", default=None)
|
|
101
|
+
target: VolumeTarget | None = element(tag="target", default=None)
|
|
102
|
+
backing_store: VolumeBackingStore | None = element(tag="backingStore", default=None)
|
libvirtpy/xml/sysinfo.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""``<sysinfo>`` as a standalone document: the host's SMBIOS data.
|
|
2
|
+
|
|
3
|
+
A domain's ``<sysinfo>`` is a subset of it (``libvirtpy.xml.domain.Sysinfo``).
|
|
4
|
+
|
|
5
|
+
See https://libvirt.org/formatdomain.html#smbios-system-information
|
|
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._shared.sysinfo import (
|
|
14
|
+
FwcfgEntry,
|
|
15
|
+
SysinfoBaseBoard,
|
|
16
|
+
SysinfoBios,
|
|
17
|
+
SysinfoChassis,
|
|
18
|
+
SysinfoMemoryDevice,
|
|
19
|
+
SysinfoOemStrings,
|
|
20
|
+
SysinfoProcessor,
|
|
21
|
+
SysinfoSystem,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
__all__ = ["Sysinfo"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class Sysinfo(LibvirtXmlModel, tag="sysinfo"):
|
|
28
|
+
"""``<sysinfo>``: SMBIOS groups, or ``type='fwcfg'`` entries."""
|
|
29
|
+
|
|
30
|
+
type: Literal["smbios", "fwcfg"] = attr(name="type")
|
|
31
|
+
bios: SysinfoBios | None = element(tag="bios", default=None)
|
|
32
|
+
system: SysinfoSystem | None = element(tag="system", default=None)
|
|
33
|
+
base_boards: list[SysinfoBaseBoard] = element(tag="baseBoard", default_factory=list)
|
|
34
|
+
chassis: SysinfoChassis | None = element(tag="chassis", default=None)
|
|
35
|
+
processors: list[SysinfoProcessor] = element(tag="processor", default_factory=list)
|
|
36
|
+
memory_devices: list[SysinfoMemoryDevice] = element(
|
|
37
|
+
tag="memory_device", default_factory=list
|
|
38
|
+
)
|
|
39
|
+
oem_strings: SysinfoOemStrings | None = element(tag="oemStrings", default=None)
|
|
40
|
+
entries: list[FwcfgEntry] = element(tag="entry", default_factory=list)
|