You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add documentation for the variable override section of the NnfStorageProfile. Include
examples for overriding $LV_NAME.
Signed-off-by: Matt Richerson <matthew.richerson@hpe.com>
Copy file name to clipboardExpand all lines: docs/guides/storage-profiles/readme.md
+155Lines changed: 155 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -836,6 +836,161 @@ The following variables are available to `preMountMGTCommands`:
836
836
| `$JOBID` | Job ID from the Workflow |
837
837
| `$FS_NAME` | Lustre file system name |
838
838
839
+
### Variable Override
840
+
841
+
The `variableOverride` fields in a storage profile allow overriding the default values of environment variables used in command lines and internally by the NNF software. This is an advanced feature that provides fine-grained control over storage configuration.
842
+
843
+
When a variable is overridden, the NNF software uses the new value internally when manipulating block devices and file systems; not just for expanding `$VARIABLE` references in command lines. For example, overriding `$LV_NAME` changes the actual logical volume name that the NNF software uses to perform checks and run internal commands.
844
+
845
+
Variables are expanded recursively so that variable values can reference other variables. This allows building values based on job, workflow, and directive identifiers in a similar way to what the NNF software does internally.
846
+
847
+
848
+
#### Overridable Variables by File System Type
849
+
850
+
##### XFS, GFS2, and Raw Allocations
851
+
852
+
For XFS, GFS2, and Raw file systems, add `variableOverride` at the storage type level:
853
+
854
+
```yaml
855
+
xfsStorage:
856
+
variableOverride:
857
+
"$VG_NAME": "custom-vg"
858
+
"$LV_NAME": "custom-lv"
859
+
```
860
+
861
+
| Variable | Default | Description |
862
+
|----------|---------|-------------|
863
+
| `$JOBID` | From workflow | Job ID from the workflow |
864
+
| `$USERID` | From workflow | User ID of the job submitter |
865
+
| `$GROUPID` | From workflow | Group ID of the job submitter |
866
+
| `$WORKFLOW_UID` | From workflow | Kubernetes UID of the workflow resource |
867
+
| `$DIRECTIVE_INDEX` | From workflow | Index of the directive within the workflow |
868
+
| `$VG_NAME` | Auto-generated from workflow UID | Volume group name used by LVM |
869
+
| `$LV_NAME` | Auto-generated | Logical volume name used by LVM |
870
+
| `$PERCENT_VG` | Calculated based on allocation | Size as percentage of volume group |
871
+
| `$FSTYPE` | `xfs`, `gfs2`, or `none` | File system type passed to mkfs |
872
+
| `$MOUNT_TARGET` | `directory` or `file` | Whether mount target is a file or directory |
873
+
| `$TEMP_DIR` | Auto-generated | Temporary directory for operations |
874
+
| `$MOUNT_PATH` | `/mnt/nnf/<workflow-uid>-<index>` | Path where file system is mounted (affects DW_JOB_* variables) |
875
+
876
+
##### Lustre Allocations
877
+
878
+
For Lustre file systems, `variableOverride` can be specified at the target level (mgtOptions, mdtOptions, mgtMdtOptions, ostOptions) or for client operations (clientOptions):
| `$JOBID` | From workflow | Job ID from the workflow |
895
+
| `$USERID` | From workflow | User ID of the job submitter |
896
+
| `$GROUPID` | From workflow | Group ID of the job submitter |
897
+
| `$WORKFLOW_UID` | From workflow | Kubernetes UID of the workflow resource |
898
+
| `$DIRECTIVE_INDEX` | From workflow | Index of the directive within the workflow |
899
+
| `$ZPOOL_NAME` | Auto-generated from workflow UID | ZFS pool name |
900
+
| `$ZPOOL_DATA_SET` | Target type (mgt, mdt, ost) | ZFS dataset name within pool |
901
+
| `$FSNAME` | Auto-generated | Lustre file system name |
902
+
| `$TARGET_TYPE` | mgt, mdt, mgtmdt, or ost | Type of Lustre target |
903
+
| `$TARGET_PATH` | Auto-generated | Mount path for the target |
904
+
| `$MGS_NID` | Auto-discovered | NID of the MGS |
905
+
| `$BACKFS` | zfs | Backing file system type |
906
+
907
+
**Client-level variables (clientOptions):**
908
+
909
+
| Variable | Default | Description |
910
+
|----------|---------|-------------|
911
+
| `$JOBID` | From workflow | Job ID from the workflow |
912
+
| `$USERID` | From workflow | User ID of the job submitter |
913
+
| `$GROUPID` | From workflow | Group ID of the job submitter |
914
+
| `$WORKFLOW_UID` | From workflow | Kubernetes UID of the workflow resource |
915
+
| `$DIRECTIVE_INDEX` | From workflow | Index of the directive within the workflow |
916
+
| `$MOUNT_PATH` | `/mnt/nnf/<workflow-uid>-<index>` | Path where Lustre client is mounted (affects DW_JOB_* variables) |
917
+
918
+
#### Example: Custom Logical Volume Name for XFS
919
+
920
+
This example shows how to override the logical volume name for an XFS file system. The `$LV_NAME` variable is used both in command lines and internally by the NNF software when creating the LVM logical volume.
921
+
922
+
```yaml
923
+
apiVersion: nnf.cray.hpe.com/v1alpha10
924
+
kind: NnfStorageProfile
925
+
metadata:
926
+
name: custom-lv-name
927
+
namespace: nnf-system
928
+
data:
929
+
default: false
930
+
xfsStorage:
931
+
variableOverride:
932
+
"$LV_NAME": "shared-lv"
933
+
blockDeviceCommands:
934
+
rabbitCommands:
935
+
pvCreate: $DEVICE
936
+
pvRemove: $DEVICE
937
+
vgCreate: --addtag $JOBID $VG_NAME $DEVICE_LIST
938
+
vgRemove: $VG_NAME
939
+
lvCreate: --zero n --activate n --size $LV_SIZE --stripes $DEVICE_NUM --stripesize=32KiB --name $LV_NAME $VG_NAME
940
+
lvRemove: $VG_NAME/$LV_NAME
941
+
lvChange:
942
+
activate: --activate y $VG_NAME/$LV_NAME
943
+
deactivate: --activate n $VG_NAME/$LV_NAME
944
+
computeCommands:
945
+
lvChange:
946
+
activate: --activate y $VG_NAME/$LV_NAME
947
+
deactivate: --activate n $VG_NAME/$LV_NAME
948
+
fileSystemCommands:
949
+
rabbitCommands:
950
+
mkfs: $DEVICE
951
+
mount: $DEVICE $MOUNT_PATH
952
+
unmount: $MOUNT_PATH
953
+
computeCommands:
954
+
mount: $DEVICE $MOUNT_PATH
955
+
unmount: $MOUNT_PATH
956
+
```
957
+
958
+
#### Example: Custom Mount Path with DW_JOB_* Integration
959
+
960
+
The `$MOUNT_PATH` variable is special because it affects the path that gets reported to the workload manager in the `DW_JOB_*` environment variables. This example shows a custom mount path that will be visible to user jobs.
961
+
962
+
```yaml
963
+
apiVersion: nnf.cray.hpe.com/v1alpha10
964
+
kind: NnfStorageProfile
965
+
metadata:
966
+
name: custom-mount-path
967
+
namespace: nnf-system
968
+
data:
969
+
default: false
970
+
xfsStorage:
971
+
variableOverride:
972
+
"$MOUNT_PATH": "/scratch/$JOBID"
973
+
# ... rest of configuration
974
+
```
975
+
976
+
#### Example: Recursive Variable Expansion
977
+
978
+
Variables can reference other variables, which are expanded recursively. This is useful for building paths that include system-provided values:
0 commit comments