Merge pull request #329 from andyzhangx/chmod-logging

cleanup: refine mount logging
This commit is contained in:
Andy Zhang 2022-05-05 20:33:01 +08:00 committed by GitHub
commit 1bd5bb03b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,14 +120,15 @@ func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
return nil, status.Error(codes.Internal, err.Error()) return nil, status.Error(codes.Internal, err.Error())
} }
klog.V(2).Infof("volumeID(%v): mount targetPath(%s) with permissions(0%o)", volumeID, targetPath, mountPermissions)
if performChmodOp { if performChmodOp {
klog.V(2).Infof("volumeID(%v): chmod targetPath(%s) with permissions(0%o)", volumeID, targetPath, mountPermissions)
if err := os.Chmod(targetPath, os.FileMode(mountPermissions)); err != nil { if err := os.Chmod(targetPath, os.FileMode(mountPermissions)); err != nil {
return nil, status.Error(codes.Internal, err.Error()) return nil, status.Error(codes.Internal, err.Error())
} }
} else { } else {
klog.V(2).Infof("skip chmod on targetPath(%s) since mountPermissions is set as 0", targetPath) klog.V(2).Infof("skip chmod on targetPath(%s) since mountPermissions is set as 0", targetPath)
} }
klog.V(2).Infof("volume(%s) mount %s on %s succeeded", volumeID, source, targetPath)
return &csi.NodePublishVolumeResponse{}, nil return &csi.NodePublishVolumeResponse{}, nil
} }