-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure destination path exists prior to data movement #161
Conversation
To ensure that dcp behaves the same on each data movement, make sure the destination path exists before attempting data movement. This also ensures that as long as the user provides a valid path with the correct permissions, dcp will have a safe place for the destination. Path validation will need to be done upfront in nnf-sos and the nnf-dm daemon. Signed-off-by: Blake Devcich <blake.devcich@hpe.com>
@@ -145,6 +148,10 @@ func (r *DataMovementReconciler) Reconcile(ctx context.Context, req ctrl.Request | |||
return ctrl.Result{}, client.IgnoreNotFound(err) | |||
} | |||
|
|||
statusUpdater := updater.NewStatusUpdater[*nnfv1alpha1.NnfDataMovementStatus](dm) | |||
defer func() { err = statusUpdater.CloseWithStatusUpdate(ctx, r.Client.Status(), err) }() | |||
// defer func() { dm.Status.SetResourceErrorAndLog(err, log) }() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete?
|
||
func createDestinationDir(dest string, uid, gid uint32) error { | ||
// Use exec.Command() rather than os.MkDirAll so we can set the UID/GID | ||
mkdirCmd := exec.Command("mkdir", "-p", dest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may consider something like https://github.com/NearNodeFlash/nnf-sos/blob/master/pkg/command/cmd.go.
Those Run() methods allow timeout and grab stderr and stdout in the log.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome idea. Hmm, nnf-dm already has an indirect vendor of EC. Should be easy to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I will extend that to add the ability to run as specific UID/GID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR for that is here: NearNodeFlash/nnf-sos#277
Gid: gid, | ||
}, | ||
} | ||
if err := mkdirCmd.Run(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try mkdirCmd.CombinedOutput()
, so you can log everything, stdout and stderr.
https://pkg.go.dev/os/exec#Cmd.CombinedOutput
Signed-off-by: Blake Devcich <blake.devcich@hpe.com>
Signed-off-by: Blake Devcich <blake.devcich@hpe.com>
Signed-off-by: Blake Devcich <blake.devcich@hpe.com>
I'd like to merge this and continue to find/fix any issues in other PRs |
This reverts commit fca4131. This has impacts on lustre-lustre data movement. This will be held until the full mkdir + index mount directory solution is implemented via mpirun. See the `idx-mount-dirs` branch.
This reverts commit fca4131. This has impacts on lustre-lustre data movement. This will be held until the full mkdir + index mount directory solution is implemented via mpirun. See the `idx-mount-dirs` branch.
This change un-reverts PR #161 with a couple twists: account for index mount directories and use mpirun to perform the actions. Logic was added to prepare the destination directory by performing a `mkdir -p` on the user supplied destination. This logic ensures that the correct pathing is performed by determining the filetype (dir vs file) on both the source and destination paths. In addition to the supplied destination path, if the source filesystem is determined to have index mount directories (i.e. xfs/gfs2), those directories are created on the destination path to ensure that all data is retained. - All necessary filesystem interaction is ran through mpirun so that the proper mpi worker nodes are used to prepare the destination. This required for lustre2lustre data movement. - These file system interactions (i.e. `stat`, `mkdir`) are performed through `setpriv` to ensure that all interactions are done as the supplied UID/GID (from the workflow). - The hostfile createion logic now standsalone since these new mpirun calls need the hostfile before the final data movement command is built - Added in some local system calls when using unit tests since mpirun is not available in textenv Signed-off-by: Blake Devcich <blake.devcich@hpe.com>
…167) This change un-reverts PR #161 with a couple twists: account for index mount directories and use mpirun to perform the actions. Logic was added to prepare the destination directory by performing a `mkdir -p` on the user supplied destination. This logic ensures that the correct pathing is performed by determining the filetype (dir vs file) on both the source and destination paths. In addition to the supplied destination path, if the source filesystem is determined to have index mount directories (i.e. xfs/gfs2), those directories are created on the destination path to ensure that all data is retained. - All necessary filesystem interaction is ran through mpirun so that the proper mpi worker nodes are used to prepare the destination. This required for lustre2lustre data movement. - These file system interactions (i.e. `stat`, `mkdir`) are performed through `setpriv` to ensure that all interactions are done as the supplied UID/GID (from the workflow). - The hostfile createion logic now standsalone since these new mpirun calls need the hostfile before the final data movement command is built - Added in some local system calls when using unit tests since mpirun is not available in textenv Signed-off-by: Blake Devcich <blake.devcich@hpe.com>
To ensure that dcp behaves the same on each data movement, make sure the destination path exists before attempting data movement.
This also ensures that as long as the user provides a valid path with the correct permissions, dcp will have a safe place for the destination.
Path validation will need to be done upfront in nnf-sos and the nnf-dm daemon.