Skip to content

Commit 00cc64b

Browse files
committed
Add a talm.discovered.system_disk_nvme_id helper
Signed-off-by: Konstantin Nesterov <konstantin@careerlunch.com>
1 parent 0a276f2 commit 00cc64b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

charts/talm/templates/_helpers.tpl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,22 @@
4040
{{- end }}
4141
{{- end }}
4242

43+
{{- define "talm.discovered.system_disk_nvme_id" }}
44+
{{- $diskName := (include "talm.discovered.system_disk_name" .) }}
45+
{{- $diskStablePath := "" }}
46+
{{- range (lookup "disks" "" "").items }}
47+
{{- if and (eq .spec.dev_path $diskName) (eq .spec.transport "nvme") .spec.wwid }}
48+
{{- $diskStablePath = (printf "/dev/disk/by-id/nvme-%s" .spec.wwid) }}
49+
{{- break }}
50+
{{- end }}
51+
{{- end }}
52+
{{- if $diskStablePath }}
53+
{{- $diskStablePath }}
54+
{{- else }}
55+
{{- fail (printf "Unable to determine a stable NVMe disk path for the disk %s" $diskName) }}
56+
{{- end }}
57+
{{- end }}
58+
4359
{{- define "talm.discovered.default_addresses" }}
4460
{{- with (lookup "nodeaddress" "" "default") }}
4561
{{- toJson .spec.addresses }}

0 commit comments

Comments
 (0)