Skip to content

Commit b44a4c8

Browse files
tas50claude
andcommitted
✨ Add ZFS resources to OS provider
Add zfs, zfs.pool, and zfs.dataset resources for querying ZFS storage pools and datasets (filesystems, volumes, snapshots, bookmarks). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 540cb1b commit b44a4c8

File tree

7 files changed

+2177
-28
lines changed

7 files changed

+2177
-28
lines changed

.github/actions/spelling/expect.txt

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
aad
22
ACCOUNTADMIN
3-
ACTIVEMQ
43
advancedthreatprotection
54
alloydb
65
alpn
76
antispam
87
appslot
98
arp
10-
artifactregistry
119
atlassian
1210
auditlog
1311
Auths
1412
autoaccept
1513
autoclose
14+
autoexpand
15+
autoreplace
16+
autotrim
1617
autoprovision
1718
Autoscalers
1819
awsapps
@@ -24,20 +25,18 @@ backupshorttermretentionpolicy
2425
bigquery
2526
bigtable
2627
blackhole
27-
Blobstore
2828
BYOS
2929
bytematchstatement
3030
cavium
3131
cdn
3232
certificatechains
33-
ciscocatalyst
3433
clcerts
3534
cloudflare
3635
Clusterwide
3736
cmek
3837
cmnd
39-
cname
4038
cooldown
39+
compressratio
4140
copywrite
4241
cpe
4342
cryptokey
@@ -50,15 +49,16 @@ datapath
5049
DATAUSER
5150
datetime
5251
ddos
52+
dedupratio
5353
deliverychannel
5454
dfw
5555
directoryservice
56+
documentdb
57+
draid
5658
dlp
5759
dlq
5860
dlv
5961
dnskey
60-
documentdb
61-
Doublings
6262
dsse
6363
eas
6464
Ecmp
@@ -68,23 +68,19 @@ ekus
6868
elbv
6969
endpointslice
7070
EPP
71-
ETL
7271
exo
7372
failback
7473
fargate
75-
filestore
7674
filesz
7775
firefox
7876
firestore
7977
FLEXGROUP
8078
FLEXVOL
81-
fortios
8279
frontmatter
8380
ftps
8481
fumadocs
8582
gcfs
8683
gcs
87-
GENEVE
8884
geomatchstatement
8985
gistfile
9086
gotestsum
@@ -112,8 +108,6 @@ ipsetreferencestatement
112108
istio
113109
jira
114110
jsonbody
115-
junos
116-
KFP
117111
kqueue
118112
KSK
119113
labelmatchstatement
@@ -129,20 +123,18 @@ managedzone
129123
maxmemory
130124
mcp
131125
mcr
132-
meid
133126
memorydb
127+
meid
134128
messagestoragepolicy
135129
mfs
136130
mgroup
137131
minfree
138132
MINIMALUSER
139133
mkey
140-
Mpim
141-
msk
142134
MULTIAZ
135+
Mpim
143136
naflags
144137
natgateway
145-
networkfirewall
146138
networkinterface
147139
nexthop
148140
nmap
@@ -166,7 +158,6 @@ openssl
166158
openzfs
167159
orstatement
168160
ospf
169-
panos
170161
parallelquery
171162
PAYG
172163
persistentvolume
@@ -179,27 +170,20 @@ postgre
179170
POWERUSER
180171
priorityclass
181172
psc
182-
PTn
183173
pushconfig
184-
Pzi
185-
Pzs
186-
pzs
187174
querypack
188-
RABBITMQ
175+
raidz
189176
ratebasedstatement
190177
recaptcha
191178
regexmatchstatement
192179
regexpatternsetreferencestatement
193180
resourcegroup
194181
resourcequota
195-
rpo
196-
RRULE
197182
rtsp
198183
rulegroup
199184
rulegroupreferencestatement
200185
saas
201186
Sas
202-
SASL
203187
sbom
204188
scim
205189
scm
@@ -233,13 +217,16 @@ toplevel
233217
tpu
234218
transitgateway
235219
udid
220+
UNAVAIL
236221
uefi
237222
Uocm
238223
usb
239224
Utc
240225
valkey
241226
VAULTNAME
242227
vdcs
228+
vdev
229+
vdevs
243230
VGeneration
244231
virtualmachine
245232
vlans
@@ -255,6 +242,7 @@ workdir
255242
WORKSPACESUSER
256243
workspacesweb
257244
xssmatchstatement
258-
yara
245+
zfs
246+
zpool
259247
zrt
260-
ZSTD
248+
zstd

providers/os/resources/os.lr

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2645,3 +2645,111 @@ private mdadm.device @defaults("name state") {
26452645
// Device state (e.g., active sync, spare, faulty)
26462646
state string
26472647
}
2648+
2649+
// ZFS storage pool and dataset management
2650+
zfs @defaults("pools") {
2651+
// ZFS version string
2652+
version() string
2653+
// ZFS storage pools
2654+
pools() []zfs.pool
2655+
// All ZFS datasets (filesystems, volumes, snapshots, bookmarks)
2656+
datasets() []zfs.dataset
2657+
}
2658+
2659+
// ZFS storage pool
2660+
zfs.pool @defaults("name health sizeBytes") {
2661+
init(name string)
2662+
// Pool name
2663+
name string
2664+
// Pool GUID
2665+
guid string
2666+
// Health status (ONLINE, DEGRADED, FAULTED, OFFLINE, REMOVED, UNAVAIL)
2667+
health string
2668+
// Total size in bytes
2669+
sizeBytes int
2670+
// Allocated space in bytes
2671+
allocatedBytes int
2672+
// Free space in bytes
2673+
freeBytes int
2674+
// Fragmentation percentage
2675+
fragmentation int
2676+
// Percentage of pool space used (0-100)
2677+
percentUsed int
2678+
// Deduplication ratio
2679+
dedupratio float
2680+
// Whether the pool is read-only
2681+
readonly bool
2682+
// Whether auto-expand is enabled
2683+
autoexpand bool
2684+
// Whether auto-replace is enabled
2685+
autoreplace bool
2686+
// Whether auto-trim is enabled
2687+
autotrim bool
2688+
// Top-level virtual device groups (mirrors, raidz, etc.)
2689+
vdevs() []zfs.pool.vdev
2690+
// All pool properties (lazy-loaded via zpool get all)
2691+
properties() map[string]string
2692+
}
2693+
2694+
// ZFS virtual device (vdev) in a pool's topology
2695+
zfs.pool.vdev @defaults("name type state numDevices") {
2696+
// Vdev name (e.g., "raidz2-0", "mirror-0", "sda")
2697+
name string
2698+
// Vdev type (mirror, raidz, raidz2, raidz3, disk, file, draid, etc.)
2699+
type string
2700+
// Vdev state (ONLINE, DEGRADED, FAULTED, OFFLINE, REMOVED, UNAVAIL)
2701+
state string
2702+
// Device path (for leaf vdevs, empty for groups)
2703+
path string
2704+
// Read error count
2705+
readErrors int
2706+
// Write error count
2707+
writeErrors int
2708+
// Checksum error count
2709+
checksumErrors int
2710+
// Slow I/O count
2711+
slowIos int
2712+
// Number of child devices
2713+
numDevices int
2714+
// Child vdevs/devices
2715+
devices []zfs.pool.vdev
2716+
}
2717+
2718+
// ZFS dataset (filesystem, volume, snapshot, or bookmark)
2719+
zfs.dataset @defaults("name type usedBytes") {
2720+
init(name string)
2721+
// Full dataset name (pool/path or pool/path@snap)
2722+
name string
2723+
// Dataset type (filesystem, volume, snapshot, bookmark)
2724+
type string
2725+
// Used space in bytes
2726+
usedBytes int
2727+
// Available space in bytes
2728+
availableBytes int
2729+
// Referenced space in bytes
2730+
referencedBytes int
2731+
// Mount point (empty for volumes/snapshots)
2732+
mountpoint string
2733+
// Compression algorithm (off, lz4, gzip, zstd, etc.)
2734+
compression string
2735+
// Compression ratio
2736+
compressratio float
2737+
// Whether the dataset is currently mounted
2738+
mounted bool
2739+
// Record size in bytes
2740+
recordsizeBytes int
2741+
// Quota in bytes (0 = none)
2742+
quotaBytes int
2743+
// Reservation in bytes (0 = none)
2744+
reservationBytes int
2745+
// Origin snapshot (for clones, empty otherwise)
2746+
origin string
2747+
// Creation time
2748+
creation time
2749+
// Encryption algorithm (off, aes-256-gcm, etc.)
2750+
encryption string
2751+
// All dataset properties (lazy-loaded via zfs get all)
2752+
properties() map[string]string
2753+
// Snapshots of this dataset
2754+
snapshots() []zfs.dataset
2755+
}

0 commit comments

Comments
 (0)