Skip to content

Commit 827dd9d

Browse files
banjohajp-io
andauthored
feat: add preflight to check for XFS filesystem with ftype=0 (#2338)
* feat: add preflight check for XFS with ftype=0 Signed-off-by: Evans Mungai <[email protected]> * Update pkg-new/preflights/host-preflight.yaml Co-authored-by: Alex Parker <[email protected]> * Update XFS preflight check with more descriptive message Signed-off-by: Evans Mungai <[email protected]> --------- Signed-off-by: Evans Mungai <[email protected]> Co-authored-by: Alex Parker <[email protected]>
1 parent 5c52173 commit 827dd9d

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

pkg-new/preflights/host-preflight.yaml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,20 @@ spec:
172172
dir="{{ .DataDir }}"
173173
while [ "$dir" != "/" ]; do find "$dir" -maxdepth 0 ! -perm -111; dir=$(dirname "$dir"); done
174174
find "/" -maxdepth 0 ! -perm -111
175+
- run:
176+
collectorName: 'xfs_info-data-dir'
177+
command: 'sh'
178+
args:
179+
- '-c'
180+
- >
181+
# Get filesystem type
182+
fstype=$(findmnt -n -o FSTYPE --target "{{ .DataDir }}")
183+
if [ "$fstype" = "xfs" ]; then
184+
echo "Filesystem is XFS. Running xfs_info..."
185+
xfs_info "{{ .DataDir }}"
186+
else
187+
echo "Filesystem is not XFS (detected: $fstype). Skipping xfs_info."
188+
fi
175189
analyzers:
176190
- cpu:
177191
checkName: CPU
@@ -937,7 +951,7 @@ spec:
937951
The node IP {{ .NodeIP }} cannot be within the Pod CIDR range {{ .PodCIDR.CIDR }}. Use --pod-cidr to specify a different Pod CIDR, or use --network-interface to specify a different network interface.
938952
{{- end }}
939953
- pass:
940-
when: "false"
954+
when: "false"
941955
message: The node IP {{ .NodeIP }} is not within the Pod CIDR range {{ .PodCIDR.CIDR }}.
942956
- subnetContainsIP:
943957
checkName: Node IP in Service CIDR Check
@@ -1194,3 +1208,14 @@ spec:
11941208
- fail:
11951209
message: >-
11961210
The following directories lack execute permissions: {{ `{{ .Dirs | trim | splitList "\n" | join ", " }}` }}.
1211+
- textAnalyze:
1212+
checkName: Check filesystem on data directory path
1213+
fileName: host-collectors/run-host/xfs_info-data-dir.txt
1214+
regex: 'ftype=0'
1215+
outcomes:
1216+
- fail:
1217+
when: "true"
1218+
message: "The XFS filesystem at {{ .DataDir }} is configured with ftype=0, which is not supported. Reformat the filesystem with ftype=1, or choose a different data directory on a supported filesystem."
1219+
- pass:
1220+
when: "false"
1221+
message: "The filesystem at {{ .DataDir }} is either not XFS or is XFS with ftype=1."

0 commit comments

Comments
 (0)