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,149 @@
|
|
|
1
|
+
"""``<memory>``, ``<currentMemory>`` and ``<maxMemory>``.
|
|
2
|
+
|
|
3
|
+
See https://libvirt.org/formatdomain.html#memory-allocation
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from typing import Literal
|
|
7
|
+
|
|
8
|
+
from pydantic import Field
|
|
9
|
+
from pydantic_xml import attr, element
|
|
10
|
+
|
|
11
|
+
from libvirtpy.xml._base import LibvirtXmlModel
|
|
12
|
+
from libvirtpy.xml._types import (
|
|
13
|
+
OnOff,
|
|
14
|
+
PresenceFlag,
|
|
15
|
+
ScaledInteger,
|
|
16
|
+
SizeUnit,
|
|
17
|
+
size_to_bytes,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"CurrentMemory",
|
|
22
|
+
"HardLimit",
|
|
23
|
+
"HugePage",
|
|
24
|
+
"HugePages",
|
|
25
|
+
"MaxMemory",
|
|
26
|
+
"MemTune",
|
|
27
|
+
"Memory",
|
|
28
|
+
"MemoryAccess",
|
|
29
|
+
"MemoryAllocation",
|
|
30
|
+
"MemoryBacking",
|
|
31
|
+
"MemorySource",
|
|
32
|
+
"MinGuarantee",
|
|
33
|
+
"SoftLimit",
|
|
34
|
+
"SwapHardLimit",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
# libvirt reads a size without ``unit`` as KiB.
|
|
38
|
+
_DEFAULT_UNIT = "KiB"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class Memory(LibvirtXmlModel, tag="memory"):
|
|
42
|
+
"""``<memory>``: the maximum memory allocation at boot."""
|
|
43
|
+
|
|
44
|
+
value: int = Field(ge=0, description="Element text: the amount, in ``unit``.")
|
|
45
|
+
unit: SizeUnit | None = attr(name="unit", default=None)
|
|
46
|
+
dump_core: OnOff | None = attr(
|
|
47
|
+
name="dumpCore",
|
|
48
|
+
default=None,
|
|
49
|
+
description="Include guest memory in core dumps. Since 0.10.2.",
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
def to_bytes(self) -> int:
|
|
53
|
+
"""Return the amount in bytes (a missing ``unit`` means KiB)."""
|
|
54
|
+
return size_to_bytes(self.value, self.unit or _DEFAULT_UNIT)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class CurrentMemory(LibvirtXmlModel, tag="currentMemory"):
|
|
58
|
+
"""``<currentMemory>``: the actual allocation, may be below ``<memory>``."""
|
|
59
|
+
|
|
60
|
+
value: int = Field(ge=0, description="Element text: the amount, in ``unit``.")
|
|
61
|
+
unit: SizeUnit | None = attr(name="unit", default=None)
|
|
62
|
+
|
|
63
|
+
def to_bytes(self) -> int:
|
|
64
|
+
"""Return the amount in bytes (a missing ``unit`` means KiB)."""
|
|
65
|
+
return size_to_bytes(self.value, self.unit or _DEFAULT_UNIT)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class MaxMemory(LibvirtXmlModel, tag="maxMemory"):
|
|
69
|
+
"""``<maxMemory>``: the run time maximum for memory hotplug. Since 1.2.14."""
|
|
70
|
+
|
|
71
|
+
value: int = Field(ge=0, description="Element text: the amount, in ``unit``.")
|
|
72
|
+
unit: SizeUnit | None = attr(name="unit", default=None)
|
|
73
|
+
slots: int | None = attr(
|
|
74
|
+
name="slots", default=None, description="Number of hotplug slots."
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
def to_bytes(self) -> int:
|
|
78
|
+
"""Return the amount in bytes (a missing ``unit`` means KiB)."""
|
|
79
|
+
return size_to_bytes(self.value, self.unit or _DEFAULT_UNIT)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class HugePage(LibvirtXmlModel, tag="page"):
|
|
83
|
+
"""``<page>``: a huge page size, optionally limited to some NUMA nodes."""
|
|
84
|
+
|
|
85
|
+
size: int = attr(name="size", ge=0)
|
|
86
|
+
unit: SizeUnit | None = attr(name="unit", default=None)
|
|
87
|
+
nodeset: str | None = attr(name="nodeset", default=None)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class HugePages(LibvirtXmlModel, tag="hugepages"):
|
|
91
|
+
"""``<hugepages>``: back the guest memory with huge pages."""
|
|
92
|
+
|
|
93
|
+
pages: list[HugePage] = element(tag="page", default_factory=list)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class MemorySource(LibvirtXmlModel, tag="source"):
|
|
97
|
+
"""``<source>``: how the guest memory is allocated. Since 4.10.0."""
|
|
98
|
+
|
|
99
|
+
type: Literal["file", "anonymous", "memfd"] = attr(name="type")
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class MemoryAccess(LibvirtXmlModel, tag="access"):
|
|
103
|
+
"""``<access>``: whether the memory is shared with other processes."""
|
|
104
|
+
|
|
105
|
+
mode: Literal["shared", "private"] = attr(name="mode")
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class MemoryAllocation(LibvirtXmlModel, tag="allocation"):
|
|
109
|
+
"""``<allocation>``: when and how the memory is allocated. Since 8.2.0."""
|
|
110
|
+
|
|
111
|
+
mode: Literal["immediate", "ondemand"] | None = attr(name="mode", default=None)
|
|
112
|
+
threads: int | None = attr(name="threads", default=None, ge=0)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class MemoryBacking(LibvirtXmlModel, tag="memoryBacking"):
|
|
116
|
+
"""``<memoryBacking>``: how the host backs the guest memory."""
|
|
117
|
+
|
|
118
|
+
hugepages: HugePages | None = element(tag="hugepages", default=None)
|
|
119
|
+
nosharepages: PresenceFlag | None = element(tag="nosharepages", default=None)
|
|
120
|
+
locked: PresenceFlag | None = element(tag="locked", default=None)
|
|
121
|
+
source: MemorySource | None = element(tag="source", default=None)
|
|
122
|
+
access: MemoryAccess | None = element(tag="access", default=None)
|
|
123
|
+
allocation: MemoryAllocation | None = element(tag="allocation", default=None)
|
|
124
|
+
discard: PresenceFlag | None = element(tag="discard", default=None)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class HardLimit(ScaledInteger, tag="hard_limit"):
|
|
128
|
+
"""``<hard_limit>``: the maximum memory the guest may use."""
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class SoftLimit(ScaledInteger, tag="soft_limit"):
|
|
132
|
+
"""``<soft_limit>``: the memory limit enforced under contention."""
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class MinGuarantee(ScaledInteger, tag="min_guarantee"):
|
|
136
|
+
"""``<min_guarantee>``: the guaranteed memory (Xen)."""
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class SwapHardLimit(ScaledInteger, tag="swap_hard_limit"):
|
|
140
|
+
"""``<swap_hard_limit>``: the maximum of memory plus swap."""
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class MemTune(LibvirtXmlModel, tag="memtune"):
|
|
144
|
+
"""``<memtune>``: memory limits of the guest process."""
|
|
145
|
+
|
|
146
|
+
hard_limit: HardLimit | None = element(tag="hard_limit", default=None)
|
|
147
|
+
soft_limit: SoftLimit | None = element(tag="soft_limit", default=None)
|
|
148
|
+
min_guarantee: MinGuarantee | None = element(tag="min_guarantee", default=None)
|
|
149
|
+
swap_hard_limit: SwapHardLimit | None = element(tag="swap_hard_limit", default=None)
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"""Small domain-level elements: ``<pm>``, ``<keywrap>``, ``<perf>``, ``<resource>``,
|
|
2
|
+
``<idmap>`` and ``<iommufd>``.
|
|
3
|
+
|
|
4
|
+
See https://libvirt.org/formatdomain.html#power-management and the sections on
|
|
5
|
+
key wrap, performance monitoring events, resource partitioning and
|
|
6
|
+
user namespace mapping.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Literal
|
|
10
|
+
|
|
11
|
+
from pydantic_xml import attr, element
|
|
12
|
+
|
|
13
|
+
from libvirtpy.xml._base import LibvirtXmlModel
|
|
14
|
+
from libvirtpy.xml._types import YesNo
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"GidRange",
|
|
18
|
+
"Idmap",
|
|
19
|
+
"Iommufd",
|
|
20
|
+
"Keywrap",
|
|
21
|
+
"KeywrapCipher",
|
|
22
|
+
"Perf",
|
|
23
|
+
"PerfEvent",
|
|
24
|
+
"Pm",
|
|
25
|
+
"PmSuspend",
|
|
26
|
+
"Resource",
|
|
27
|
+
"ResourceFibrechannel",
|
|
28
|
+
"UidRange",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class PmSuspend(LibvirtXmlModel):
|
|
33
|
+
"""Base of ``<suspend-to-mem>`` and ``<suspend-to-disk>``."""
|
|
34
|
+
|
|
35
|
+
enabled: YesNo | None = attr(name="enabled", default=None)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class SuspendToMem(PmSuspend, tag="suspend-to-mem"):
|
|
39
|
+
"""``<suspend-to-mem>``: the S3 power state."""
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class SuspendToDisk(PmSuspend, tag="suspend-to-disk"):
|
|
43
|
+
"""``<suspend-to-disk>``: the S4 power state."""
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class Pm(LibvirtXmlModel, tag="pm"):
|
|
47
|
+
"""``<pm>``: guest power management."""
|
|
48
|
+
|
|
49
|
+
suspend_to_mem: SuspendToMem | None = element(tag="suspend-to-mem", default=None)
|
|
50
|
+
suspend_to_disk: SuspendToDisk | None = element(tag="suspend-to-disk", default=None)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class KeywrapCipher(LibvirtXmlModel, tag="cipher"):
|
|
54
|
+
name: Literal["aes", "dea"] = attr(name="name")
|
|
55
|
+
state: Literal["on", "off"] = attr(name="state")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class Keywrap(LibvirtXmlModel, tag="keywrap"):
|
|
59
|
+
"""``<keywrap>``: s390 cryptographic key wrapping."""
|
|
60
|
+
|
|
61
|
+
ciphers: list[KeywrapCipher] = element(tag="cipher", default_factory=list)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class PerfEvent(LibvirtXmlModel, tag="event"):
|
|
65
|
+
name: str = attr(name="name", description="e.g. ``cmt`` or ``cpu_cycles``.")
|
|
66
|
+
enabled: YesNo = attr(name="enabled")
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class Perf(LibvirtXmlModel, tag="perf"):
|
|
70
|
+
"""``<perf>``: performance monitoring events. Since 2.0.0."""
|
|
71
|
+
|
|
72
|
+
events: list[PerfEvent] = element(tag="event", default_factory=list)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class ResourceFibrechannel(LibvirtXmlModel, tag="fibrechannel"):
|
|
76
|
+
appid: str = attr(name="appid", pattern=r"^[ -~]{1,128}$")
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class Resource(LibvirtXmlModel, tag="resource"):
|
|
80
|
+
"""``<resource>``: the cgroup partition the guest runs in."""
|
|
81
|
+
|
|
82
|
+
partition: str | None = element(tag="partition", default=None)
|
|
83
|
+
fibrechannel: ResourceFibrechannel | None = element(
|
|
84
|
+
tag="fibrechannel", default=None
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class IdRange(LibvirtXmlModel):
|
|
89
|
+
start: int = attr(name="start", ge=0)
|
|
90
|
+
target: int = attr(name="target", ge=0)
|
|
91
|
+
count: int = attr(name="count", ge=0)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class UidRange(IdRange, tag="uid"):
|
|
95
|
+
"""``<uid>``: a range of user IDs of the container."""
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class GidRange(IdRange, tag="gid"):
|
|
99
|
+
"""``<gid>``: a range of group IDs of the container."""
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class Idmap(LibvirtXmlModel, tag="idmap"):
|
|
103
|
+
"""``<idmap>``: user and group ID mapping of an LXC container."""
|
|
104
|
+
|
|
105
|
+
uids: list[UidRange] = element(tag="uid", default_factory=list)
|
|
106
|
+
gids: list[GidRange] = element(tag="gid", default_factory=list)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class Iommufd(LibvirtXmlModel, tag="iommufd"):
|
|
110
|
+
"""``<iommufd>``: use the iommufd backend for passthrough devices."""
|
|
111
|
+
|
|
112
|
+
enabled: YesNo = attr(name="enabled")
|
|
113
|
+
fdgroup: str | None = attr(name="fdgroup", default=None)
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"""Extension namespaces of other drivers: ``vmware:``, ``lxc:``, ``xen:``, ``bhyve:``.
|
|
2
|
+
|
|
3
|
+
The ``qemu:`` namespace has its own module, ``libvirtpy.xml.domain.qemu``.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from typing import Literal
|
|
7
|
+
|
|
8
|
+
from pydantic_xml import attr, element
|
|
9
|
+
|
|
10
|
+
from libvirtpy.xml._base import LibvirtXmlModel
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"BHYVE_NAMESPACE",
|
|
14
|
+
"LXC_NAMESPACE",
|
|
15
|
+
"VMWARE_NAMESPACE",
|
|
16
|
+
"XEN_NAMESPACE",
|
|
17
|
+
"BhyveArg",
|
|
18
|
+
"BhyveCommandline",
|
|
19
|
+
"LxcNamespace",
|
|
20
|
+
"LxcShare",
|
|
21
|
+
"VmwareDatacenterPath",
|
|
22
|
+
"XenArg",
|
|
23
|
+
"XenCommandline",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
VMWARE_NAMESPACE = "http://libvirt.org/schemas/domain/vmware/1.0"
|
|
27
|
+
LXC_NAMESPACE = "http://libvirt.org/schemas/domain/lxc/1.0"
|
|
28
|
+
XEN_NAMESPACE = "http://libvirt.org/schemas/domain/xen/1.0"
|
|
29
|
+
BHYVE_NAMESPACE = "http://libvirt.org/schemas/domain/bhyve/1.0"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class VmwareDatacenterPath(
|
|
33
|
+
LibvirtXmlModel,
|
|
34
|
+
tag="datacenterpath",
|
|
35
|
+
ns="vmware",
|
|
36
|
+
nsmap={"vmware": VMWARE_NAMESPACE},
|
|
37
|
+
):
|
|
38
|
+
"""``<vmware:datacenterpath>``: the datacenter of the guest on ESX."""
|
|
39
|
+
|
|
40
|
+
value: str
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class LxcShare(LibvirtXmlModel):
|
|
44
|
+
"""Base of the ``<lxc:share*>`` elements: share a namespace with something."""
|
|
45
|
+
|
|
46
|
+
type: Literal["name", "pid", "netns"] = attr(name="type")
|
|
47
|
+
value: str = attr(name="value")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
_LXC = {"lxc": LXC_NAMESPACE}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class LxcShareNet(LxcShare, tag="sharenet", ns="lxc", nsmap=_LXC):
|
|
54
|
+
"""``<lxc:sharenet>``: share the network namespace."""
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class LxcShareIpc(LxcShare, tag="shareipc", ns="lxc", nsmap=_LXC):
|
|
58
|
+
"""``<lxc:shareipc>``: share the IPC namespace."""
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class LxcShareUts(LxcShare, tag="shareuts", ns="lxc", nsmap=_LXC):
|
|
62
|
+
"""``<lxc:shareuts>``: share the UTS namespace."""
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class LxcNamespace(LibvirtXmlModel, tag="namespace", ns="lxc", nsmap=_LXC):
|
|
66
|
+
"""``<lxc:namespace>``: namespace sharing of an LXC container."""
|
|
67
|
+
|
|
68
|
+
sharenet: LxcShareNet | None = element(tag="sharenet", default=None)
|
|
69
|
+
shareipc: LxcShareIpc | None = element(tag="shareipc", default=None)
|
|
70
|
+
shareuts: LxcShareUts | None = element(tag="shareuts", default=None)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class XenArg(LibvirtXmlModel, tag="arg", ns="xen", nsmap={"xen": XEN_NAMESPACE}):
|
|
74
|
+
value: str = attr(name="value")
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class XenCommandline(
|
|
78
|
+
LibvirtXmlModel, tag="commandline", ns="xen", nsmap={"xen": XEN_NAMESPACE}
|
|
79
|
+
):
|
|
80
|
+
"""``<xen:commandline>``: extra arguments for the Xen toolstack."""
|
|
81
|
+
|
|
82
|
+
args: list[XenArg] = element(tag="arg", default_factory=list)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class BhyveArg(
|
|
86
|
+
LibvirtXmlModel, tag="arg", ns="bhyve", nsmap={"bhyve": BHYVE_NAMESPACE}
|
|
87
|
+
):
|
|
88
|
+
value: str = attr(name="value")
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class BhyveCommandline(
|
|
92
|
+
LibvirtXmlModel, tag="commandline", ns="bhyve", nsmap={"bhyve": BHYVE_NAMESPACE}
|
|
93
|
+
):
|
|
94
|
+
"""``<bhyve:commandline>``: extra arguments for bhyve."""
|
|
95
|
+
|
|
96
|
+
args: list[BhyveArg] = element(tag="arg", default_factory=list)
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"""Guest NUMA topology: ``<cpu><numa>``.
|
|
2
|
+
|
|
3
|
+
See https://libvirt.org/formatdomain.html#cpu-model-and-topology
|
|
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 SizeUnit, YesNo
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"Numa",
|
|
15
|
+
"NumaBandwidth",
|
|
16
|
+
"NumaCache",
|
|
17
|
+
"NumaCacheLine",
|
|
18
|
+
"NumaCacheSize",
|
|
19
|
+
"NumaCell",
|
|
20
|
+
"NumaDistances",
|
|
21
|
+
"NumaInterconnects",
|
|
22
|
+
"NumaLatency",
|
|
23
|
+
"NumaMemNode",
|
|
24
|
+
"NumaSibling",
|
|
25
|
+
"NumaTune",
|
|
26
|
+
"NumaTuneMemory",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
InterconnectType = Literal["access", "read", "write"]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class NumaSibling(LibvirtXmlModel, tag="sibling"):
|
|
33
|
+
"""``<sibling>``: the distance from this cell to cell ``id``."""
|
|
34
|
+
|
|
35
|
+
id: int = attr(name="id", ge=0)
|
|
36
|
+
value: int = attr(name="value", ge=10, le=255)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class NumaDistances(LibvirtXmlModel, tag="distances"):
|
|
40
|
+
"""``<distances>``: NUMA distances from this cell. Since 3.10.0."""
|
|
41
|
+
|
|
42
|
+
siblings: list[NumaSibling] = element(tag="sibling", default_factory=list)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class NumaCacheSize(LibvirtXmlModel, tag="size"):
|
|
46
|
+
value: int = attr(name="value", ge=0)
|
|
47
|
+
unit: SizeUnit = attr(name="unit")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class NumaCacheLine(LibvirtXmlModel, tag="line"):
|
|
51
|
+
value: int = attr(name="value", ge=0)
|
|
52
|
+
unit: SizeUnit = attr(name="unit")
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class NumaCache(LibvirtXmlModel, tag="cache"):
|
|
56
|
+
"""``<cache>`` in a NUMA ``<cell>``: a memory side cache. Since 6.6.0."""
|
|
57
|
+
|
|
58
|
+
level: int = attr(name="level", ge=0)
|
|
59
|
+
associativity: Literal["none", "direct", "full"] = attr(name="associativity")
|
|
60
|
+
policy: Literal["none", "writeback", "writethrough"] = attr(name="policy")
|
|
61
|
+
size: NumaCacheSize = element(tag="size")
|
|
62
|
+
line: NumaCacheLine = element(tag="line")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class NumaCell(LibvirtXmlModel, tag="cell"):
|
|
66
|
+
"""``<cell>``: one guest NUMA node."""
|
|
67
|
+
|
|
68
|
+
id: int | None = attr(name="id", default=None, ge=0)
|
|
69
|
+
cpus: str | None = attr(
|
|
70
|
+
name="cpus", default=None, description="vCPUs of the cell, e.g. ``0-3``."
|
|
71
|
+
)
|
|
72
|
+
memory: int = attr(name="memory", ge=0, description="Amount, in ``unit``.")
|
|
73
|
+
unit: SizeUnit | None = attr(name="unit", default=None)
|
|
74
|
+
mem_access: Literal["shared", "private"] | None = attr(
|
|
75
|
+
name="memAccess", default=None
|
|
76
|
+
)
|
|
77
|
+
discard: YesNo | None = attr(name="discard", default=None)
|
|
78
|
+
distances: NumaDistances | None = element(tag="distances", default=None)
|
|
79
|
+
caches: list[NumaCache] = element(tag="cache", default_factory=list)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class NumaLatency(LibvirtXmlModel, tag="latency"):
|
|
83
|
+
"""``<latency>``: access latency between two cells, in nanoseconds."""
|
|
84
|
+
|
|
85
|
+
initiator: int = attr(name="initiator", ge=0)
|
|
86
|
+
target: int = attr(name="target", ge=0)
|
|
87
|
+
cache: int | None = attr(name="cache", default=None, ge=0)
|
|
88
|
+
type: InterconnectType = attr(name="type")
|
|
89
|
+
value: int = attr(name="value", ge=0)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class NumaBandwidth(LibvirtXmlModel, tag="bandwidth"):
|
|
93
|
+
"""``<bandwidth>``: bandwidth between two cells, in ``unit`` per second."""
|
|
94
|
+
|
|
95
|
+
initiator: int = attr(name="initiator", ge=0)
|
|
96
|
+
target: int = attr(name="target", ge=0)
|
|
97
|
+
cache: int | None = attr(name="cache", default=None, ge=0)
|
|
98
|
+
type: InterconnectType = attr(name="type")
|
|
99
|
+
value: int = attr(name="value", ge=0)
|
|
100
|
+
unit: SizeUnit = attr(name="unit")
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class NumaInterconnects(LibvirtXmlModel, tag="interconnects"):
|
|
104
|
+
"""``<interconnects>``: Heterogeneous Memory Attribute Table data."""
|
|
105
|
+
|
|
106
|
+
latencies: list[NumaLatency] = element(tag="latency", default_factory=list)
|
|
107
|
+
bandwidths: list[NumaBandwidth] = element(tag="bandwidth", default_factory=list)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class Numa(LibvirtXmlModel, tag="numa"):
|
|
111
|
+
"""``<numa>`` in ``<cpu>``: the guest NUMA topology."""
|
|
112
|
+
|
|
113
|
+
cells: list[NumaCell] = element(tag="cell", default_factory=list)
|
|
114
|
+
interconnects: NumaInterconnects | None = element(tag="interconnects", default=None)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
NumaMode = Literal["strict", "preferred", "interleave", "restrictive"]
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class NumaTuneMemory(LibvirtXmlModel, tag="memory"):
|
|
121
|
+
"""``<memory>`` of ``<numatune>``: the default NUMA policy of the guest."""
|
|
122
|
+
|
|
123
|
+
mode: NumaMode | None = attr(name="mode", default=None)
|
|
124
|
+
placement: Literal["static", "auto"] | None = attr(name="placement", default=None)
|
|
125
|
+
nodeset: str | None = attr(name="nodeset", default=None)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
class NumaMemNode(LibvirtXmlModel, tag="memnode"):
|
|
129
|
+
"""``<memnode>``: the NUMA policy of one guest node."""
|
|
130
|
+
|
|
131
|
+
cellid: int = attr(name="cellid", ge=0)
|
|
132
|
+
mode: NumaMode = attr(name="mode")
|
|
133
|
+
nodeset: str = attr(name="nodeset")
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class NumaTune(LibvirtXmlModel, tag="numatune"):
|
|
137
|
+
"""``<numatune>``: how guest memory is placed on host NUMA nodes."""
|
|
138
|
+
|
|
139
|
+
memory: NumaTuneMemory | None = element(tag="memory", default=None)
|
|
140
|
+
memnodes: list[NumaMemNode] = element(tag="memnode", default_factory=list)
|