Skip to content

Commit d71edee

Browse files
committed
feat: add LVM status resource definitions
Add resource types for physical volumes, volume groups, and logical volumes to track LVM inventory and state. Provides read-only discovery through the resource API for visibility into existing LVM setup. Signed-off-by: Mateusz Urbanek <mateusz.urbanek@siderolabs.com>
1 parent 4aeba1c commit d71edee

34 files changed

Lines changed: 7756 additions & 219 deletions
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
syntax = "proto3";
2+
3+
package talos.resource.definitions.storage;
4+
5+
option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/storage";
6+
option java_package = "dev.talos.api.resource.definitions.storage";
7+
8+
// LVMLogicalVolumeStatusSpec is the spec for LVMLogicalVolumeStatus resource.
9+
//
10+
// Fields mirror selected columns of `lvs -a -o +all --reportformat json --units b --nosuffix`.
11+
// See lvs(8) for the source-of-truth definitions of each column.
12+
message LVMLogicalVolumeStatusSpec {
13+
// Path is the LV path (lv_path), e.g. /dev/vg0/data. Empty for hidden LVs.
14+
string path = 1;
15+
// DMPath is the device-mapper path (lv_dm_path), always populated when active.
16+
string dm_path = 2;
17+
// Name is the LV short name (lv_name).
18+
string name = 3;
19+
// FullName is the qualified LV name (lv_full_name), e.g. "vg0/data".
20+
string full_name = 4;
21+
// VGName is the parent volume group name (vg_name).
22+
string vg_name = 5;
23+
// UUID is the stable LV identifier (lv_uuid).
24+
string uuid = 6;
25+
// Layout is the LV layout (lv_layout), e.g. "linear", "raid1", "thin,pool".
26+
string layout = 7;
27+
// Role is the LV role (lv_role), e.g. "public", "private,thin,pool,data".
28+
string role = 8;
29+
// Permissions reflects lv_permissions.
30+
string permissions = 9;
31+
// AllocationPolicy reflects lv_allocation_policy.
32+
string allocation_policy = 10;
33+
// AllocationLocked is the raw lv_allocation_locked column ("locked" / "").
34+
string allocation_locked = 11;
35+
// FixedMinor is the raw lv_fixed_minor column ("fixed" / "").
36+
string fixed_minor = 12;
37+
// Active is the raw lv_active column ("active" / "" / "unknown").
38+
string active = 13;
39+
// ActiveLocally is the raw lv_active_locally column ("active locally" / "" / "unknown").
40+
string active_locally = 14;
41+
// ActiveRemotely is the raw lv_active_remotely column ("active remotely" / "" / "unknown").
42+
string active_remotely = 15;
43+
// ActiveExclusively is the raw lv_active_exclusively column ("active exclusively" / "" / "unknown").
44+
string active_exclusively = 16;
45+
// Suspended is the raw lv_suspended column ("suspended" / "" / "unknown").
46+
string suspended = 17;
47+
// DeviceOpen is the raw lv_device_open column ("open" / "" / "unknown").
48+
string device_open = 18;
49+
// SkipActivation is the raw lv_skip_activation column ("skip activation" / "").
50+
string skip_activation = 19;
51+
// Merging is the raw lv_merging column ("merging" / "").
52+
string merging = 20;
53+
// Converting is the raw lv_converting column ("converting" / "").
54+
string converting = 21;
55+
// Size is the raw lv_size column in bytes.
56+
string size = 22;
57+
// MetadataSize is the raw lv_metadata_size column in bytes ("" when not applicable).
58+
string metadata_size = 23;
59+
// ReadAhead is the raw lv_read_ahead column ("auto" or a byte count).
60+
string read_ahead = 24;
61+
// KernelMajor is the raw lv_kernel_major column ("-1" when inactive, otherwise a number).
62+
string kernel_major = 25;
63+
// KernelMinor is the raw lv_kernel_minor column ("-1" when inactive, otherwise a number).
64+
string kernel_minor = 26;
65+
// Origin is the LV name this LV is a snapshot/thin clone of (origin); empty otherwise.
66+
string origin = 27;
67+
// OriginSize is the raw origin_size column in bytes ("" when not applicable).
68+
string origin_size = 28;
69+
// PoolLV is the parent thin/cache pool name (pool_lv); empty when not pool-backed.
70+
string pool_lv = 29;
71+
// DataLV is the data sub-LV name (data_lv); empty when not applicable.
72+
string data_lv = 30;
73+
// MetadataLV is the metadata sub-LV name (metadata_lv); empty when not applicable.
74+
string metadata_lv = 31;
75+
// MovePV is the source PV of an in-progress pvmove (move_pv); empty otherwise.
76+
string move_pv = 32;
77+
// ConvertLV is the target LV of an in-progress lvconvert (convert_lv); empty otherwise.
78+
string convert_lv = 33;
79+
// WhenFull reflects lv_when_full ("error" / "queue" / "").
80+
string when_full = 34;
81+
// Tags is the list of tags attached to the LV (lv_tags).
82+
repeated string tags = 35;
83+
}
84+
85+
// LVMPhysicalVolumeStatusSpec is the spec for LVMPhysicalVolumeStatus resource.
86+
//
87+
// Fields mirror selected columns of `pvs -a -o +all --reportformat json --units b --nosuffix`.
88+
// Numeric / tri-state columns are exposed as raw strings so LVM's sentinels
89+
// ("", "-1") are surfaced verbatim. See pvs(8) for the source-of-truth
90+
// definitions of each column.
91+
message LVMPhysicalVolumeStatusSpec {
92+
// Device is the block-device path backing the PV (pv_name).
93+
string device = 1;
94+
// VGName is the parent volume group name; empty if the PV is not in a VG.
95+
string vg_name = 2;
96+
// UUID is the stable PV identifier written to the PV label (pv_uuid).
97+
string uuid = 3;
98+
// Format is the on-disk metadata format (pv_fmt), e.g. "lvm2".
99+
string format = 4;
100+
// Allocatable is the raw pv_allocatable column ("allocatable" / "").
101+
string allocatable = 5;
102+
// Exported is the raw pv_exported column ("exported" / "").
103+
string exported = 6;
104+
// Missing is the raw pv_missing column ("missing" / "").
105+
string missing = 7;
106+
// InUse is the raw pv_in_use column ("used" / "").
107+
string in_use = 8;
108+
// Size is the raw pv_size column in bytes.
109+
string size = 9;
110+
// DeviceSize is the raw dev_size column in bytes.
111+
string device_size = 10;
112+
// Free is the raw pv_free column in bytes.
113+
string free = 11;
114+
// Used is the raw pv_used column in bytes.
115+
string used = 12;
116+
// PECount is the raw pv_pe_count column.
117+
string pe_count = 13;
118+
// PEAllocCount is the raw pv_pe_alloc_count column.
119+
string pe_alloc_count = 14;
120+
// Major is the raw pv_major column ("-1" for orphan PVs, otherwise the kernel major).
121+
string major = 15;
122+
// Minor is the raw pv_minor column ("-1" for orphan PVs, otherwise the kernel minor).
123+
string minor = 16;
124+
// Tags is the list of tags attached to the PV (pv_tags).
125+
repeated string tags = 17;
126+
}
127+
128+
// LVMRefreshRequestSpec is the spec for LVMRefreshRequest.
129+
message LVMRefreshRequestSpec {
130+
int64 request = 1;
131+
}
132+
133+
// LVMRefreshStatusSpec is the spec for LVMRefreshStatus.
134+
message LVMRefreshStatusSpec {
135+
int64 request = 1;
136+
}
137+
138+
// LVMVolumeGroupStatusSpec is the spec for LVMVolumeGroupStatus resource.
139+
//
140+
// Fields mirror selected columns of `vgs -a -o +all --reportformat json --units b --nosuffix`.
141+
// Numeric / tri-state columns are exposed as raw strings so LVM's sentinels
142+
// ("", "-1", "unknown", "unmanaged", "auto", …) are surfaced verbatim. See
143+
// vgs(8) for the source-of-truth definitions of each column.
144+
message LVMVolumeGroupStatusSpec {
145+
// Name is the volume group name (vg_name).
146+
string name = 1;
147+
// UUID is the stable VG identifier (vg_uuid).
148+
string uuid = 2;
149+
// Format is the on-disk metadata format (vg_fmt), e.g. "lvm2".
150+
string format = 3;
151+
// Permissions reflects vg_permissions ("writeable" / "read-only" / "unknown" / "").
152+
string permissions = 4;
153+
// Extendable is the raw vg_extendable column ("extendable" / "").
154+
string extendable = 5;
155+
// Exported is the raw vg_exported column ("exported" / "").
156+
string exported = 6;
157+
// Partial is the raw vg_partial column ("partial" / "").
158+
string partial = 7;
159+
// AllocationPolicy reflects vg_allocation_policy.
160+
string allocation_policy = 8;
161+
// Clustered is the raw vg_clustered column ("clustered" / "").
162+
string clustered = 9;
163+
// Shared is the raw vg_shared column ("shared" / "").
164+
string shared = 10;
165+
// Size is the raw vg_size column in bytes.
166+
string size = 11;
167+
// Free is the raw vg_free column in bytes.
168+
string free = 12;
169+
// ExtentSize is the raw vg_extent_size column in bytes.
170+
string extent_size = 13;
171+
// ExtentCount is the raw vg_extent_count column.
172+
string extent_count = 14;
173+
// FreeExtentCount is the raw vg_free_count column.
174+
string free_extent_count = 15;
175+
// MaxLV is the raw max_lv column; "0" means no limit.
176+
string max_lv = 16;
177+
// MaxPV is the raw max_pv column; "0" means no limit.
178+
string max_pv = 17;
179+
// LVCount is the raw lv_count column.
180+
string lv_count = 18;
181+
// PVCount is the raw pv_count column.
182+
string pv_count = 19;
183+
// SnapCount is the raw snap_count column.
184+
string snap_count = 20;
185+
// MissingPVCount is the raw vg_missing_pv_count column.
186+
string missing_pv_count = 21;
187+
// SeqNo is the raw vg_seqno column.
188+
string seq_no = 22;
189+
// LockType is the raw vg_lock_type column.
190+
string lock_type = 23;
191+
// SystemID is the system_id stamped into VG metadata (vg_systemid).
192+
string system_id = 24;
193+
// Tags is the list of tags attached to the VG (vg_tags).
194+
repeated string tags = 25;
195+
}
196+

hack/release.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@ Talos is now compatible with etcd v3.6.x only (the default version was etcd 3.6.
136136
Talos now supports mounting and provisioning `btrfs` filesystem for user volumes and existing volumes.
137137
138138
Support for `btrfs` is enabled by installing `btrfs` system extension.
139+
"""
140+
141+
[notes.lvm_status]
142+
title = "LVM Status"
143+
description = """\
144+
Talos now provides detailed LVM status information, allowing for better monitoring and management of LVM volumes.
145+
New resources `LVMPhysicalVolumeStatus`, `LVMVolumeGroupStatus`, and `LVMLogicalVolumeStatus` expose PV, VG, and LV details.
146+
`DiscoveredVolume` resources for logical volumes are listed by their kernel name (e.g. `dm-0`). To resolve the `<vg>/<lv>` for a given device, use the `Disks` or `BlockSymlinks` resources, which carry the udev-managed symlinks (e.g. `/dev/disk/by-id/dm-name-<vg>-<lv>`).
139147
"""
140148

141149
[make_deps]

0 commit comments

Comments
 (0)