Skip to content

Commit

Permalink
the huh commit
Browse files Browse the repository at this point in the history
Signed-off-by: Dean Roehrich <[email protected]>
  • Loading branch information
roehrich-hpe committed Nov 15, 2024
1 parent 56bdd67 commit aec82de
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 30 deletions.
22 changes: 16 additions & 6 deletions api/v1alpha4/nnfstorageprofile_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ type NnfStorageProfileLustreCmdLines struct {
// Lustre target has been activated
PostActivate []string `json:"postActivate,omitempty"`

// PostMount specifies a list of commands to run on the Rabbit (Lustre client) after the Lustre
// target is activated. This includes mounting the Lustre filesystem beforehand and unmounting
// it afterward.
PostMount []string `json:"postMount,omitempty"`

// PreUnmount specifies a list of commands to run on the Rabbit (Lustre client) before the
// Lustre target is deactivated. This includes mounting the Lustre filesystem beforehand and
// unmounting it afterward.
PreUnmount []string `json:"preUnmount,omitempty"`

// PreDeactivate specifies a list of commands to run on the Rabbit before the
// Lustre target is deactivated
PreDeactivate []string `json:"preDeactivate,omitempty"`
Expand Down Expand Up @@ -178,16 +188,16 @@ type NnfStorageProfileCmdLines struct {
// MountRabbit specifies mount options for mounting on the Rabbit.
MountRabbit string `json:"mountRabbit,omitempty"`

// PreDeactivate specifies a list of commands to run on the Rabbit after the
// file system has been activated
PostActivate []string `json:"postActivate,omitempty"`
// PostMount specifies a list of commands to run on the Rabbit after the
// file system has been activated and mounted.
PostMount []string `json:"postMount,omitempty"`

// MountCompute specifies mount options for mounting on the Compute.
MountCompute string `json:"mountCompute,omitempty"`

// PreDeactivate specifies a list of commands to run on the Rabbit before the
// file system is deactivated
PreDeactivate []string `json:"preDeactivate,omitempty"`
// PreUnmount specifies a list of commands to run on the Rabbit before the
// file system is deactivated and unmounted.
PreUnmount []string `json:"preUnmount,omitempty"`
}

// NnfStorageProfileLVMVgChangeCmdLines
Expand Down
32 changes: 8 additions & 24 deletions internal/controller/filesystem_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,8 @@ func newBindFileSystem(ctx context.Context, c client.Client, nnfNodeStorage *nnf
fs.TempDir = fmt.Sprintf("/mnt/temp/%s-%d", nnfNodeStorage.Name, index)

fs.CommandArgs.Mount = "-o bind $DEVICE $MOUNT_PATH"
// TODO
fs.CommandArgs.PostMount = cmdLines.PostActivate
fs.CommandArgs.PreUnmount = cmdLines.PreDeactivate
fs.CommandArgs.PostMount = cmdLines.PostMount
fs.CommandArgs.PreUnmount = cmdLines.PreUnmount
fs.CommandArgs.Vars = map[string]string{
"$USERID": fmt.Sprintf("%d", nnfNodeStorage.Spec.UserID),
"$GROUPID": fmt.Sprintf("%d", nnfNodeStorage.Spec.GroupID),
Expand All @@ -373,9 +372,8 @@ func newGfs2FileSystem(ctx context.Context, c client.Client, nnfNodeStorage *nnf
} else {
fs.CommandArgs.Mount = cmdLines.MountCompute
}
// TODO
fs.CommandArgs.PostMount = cmdLines.PostActivate
fs.CommandArgs.PreUnmount = cmdLines.PreDeactivate
fs.CommandArgs.PostMount = cmdLines.PostMount
fs.CommandArgs.PreUnmount = cmdLines.PreUnmount
fs.CommandArgs.Mkfs = fmt.Sprintf("-O %s", cmdLines.Mkfs)
fs.CommandArgs.Vars = map[string]string{
"$CLUSTER_NAME": nnfNodeStorage.Namespace,
Expand All @@ -402,21 +400,13 @@ func newXfsFileSystem(ctx context.Context, c client.Client, nnfNodeStorage *nnfv
} else {
fs.CommandArgs.Mount = cmdLines.MountCompute
}
// TODO
fs.CommandArgs.PostMount = cmdLines.PostActivate
fs.CommandArgs.PreUnmount = cmdLines.PreDeactivate
fs.CommandArgs.PostMount = cmdLines.PostMount
fs.CommandArgs.PreUnmount = cmdLines.PreUnmount
fs.CommandArgs.Mkfs = cmdLines.Mkfs
fs.CommandArgs.Vars = map[string]string{
"$USERID": fmt.Sprintf("%d", nnfNodeStorage.Spec.UserID),
"$GROUPID": fmt.Sprintf("%d", nnfNodeStorage.Spec.GroupID),
}
// TODO
fs.CommandArgs.PostMount = []string{
"touch $MOUNT_PATH/blake-test",
}
fs.CommandArgs.PreUnmount = []string{
"ls -al $MOUNT_PATH",
}

return &fs, nil
}
Expand All @@ -441,16 +431,10 @@ func newLustreFileSystem(ctx context.Context, c client.Client, nnfNodeStorage *n
fs.CommandArgs.MountTarget = cmdLines.MountTarget
fs.CommandArgs.Mount = mountCommand
fs.CommandArgs.PostActivate = cmdLines.PostActivate
fs.CommandArgs.PostMount = cmdLines.PostMount
fs.CommandArgs.PreUnmount = cmdLines.PreUnmount
fs.CommandArgs.PreDeactivate = cmdLines.PreDeactivate
fs.TempDir = fmt.Sprintf("/mnt/temp/%s-%d", nnfNodeStorage.Name, index)
// TODO: hook these into CRD
fs.CommandArgs.PostMount = []string{
"lfs setstripe -E 64K -L mdt -E 16m -c 1 -S 16m -E 1G -c 2 -E 4G -c 4 -E 16G -c 8 -E 64G -c 16 -E -1 -c -1 $MOUNT_PATH",
}
// TODO
fs.CommandArgs.PreUnmount = []string{
"touch $MOUNT_PATH/preunmount",
}

fs.CommandArgs.Vars = map[string]string{
"$USERID": fmt.Sprintf("%d", nnfNodeStorage.Spec.UserID),
Expand Down

0 comments on commit aec82de

Please sign in to comment.