mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-12 06:20:11 +01:00
fix(mount): creating directory with 0755 permission (#262)
Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
parent
0e3098920c
commit
2e5e61d255
1 changed files with 3 additions and 7 deletions
|
|
@ -254,16 +254,12 @@ func MountDataset(vol *apis.ZFSVolume, mount *MountInfo) error {
|
||||||
|
|
||||||
// MountFilesystem mounts the disk to the specified path
|
// MountFilesystem mounts the disk to the specified path
|
||||||
func MountFilesystem(vol *apis.ZFSVolume, mount *MountInfo) error {
|
func MountFilesystem(vol *apis.ZFSVolume, mount *MountInfo) error {
|
||||||
if err := os.MkdirAll(mount.MountPath, 0000); err != nil {
|
// creating the directory with 0755 permission so that it can be accessed by other person.
|
||||||
|
// if the directory already exist(old k8s), the creator should set the proper permission.
|
||||||
|
if err := os.MkdirAll(mount.MountPath, 0755); err != nil {
|
||||||
return status.Errorf(codes.Internal, "Could not create dir {%q}, err: %v", mount.MountPath, err)
|
return status.Errorf(codes.Internal, "Could not create dir {%q}, err: %v", mount.MountPath, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// in case if the dir already exists, above call returns nil
|
|
||||||
// so permission needs to be updated
|
|
||||||
if err := os.Chmod(mount.MountPath, 0000); err != nil {
|
|
||||||
return status.Errorf(codes.Internal, "Could not change mode of dir {%q}, err: %v", mount.MountPath, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
switch vol.Spec.VolumeType {
|
switch vol.Spec.VolumeType {
|
||||||
case VolTypeDataset:
|
case VolTypeDataset:
|
||||||
return MountDataset(vol, mount)
|
return MountDataset(vol, mount)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue