Audit log and follow klog standard

This commit is contained in:
xu.chen 2020-03-23 10:15:35 +08:00 committed by mergify[bot]
parent 2124f6e775
commit 399f0b0d89
13 changed files with 63 additions and 63 deletions

View File

@ -111,7 +111,7 @@ func main() {
os.Exit(0) os.Exit(0)
} }
klog.Infof("Driver version: %s and Git version: %s", util.DriverVersion, util.GitCommit) klog.V(1).Infof("Driver version: %s and Git version: %s", util.DriverVersion, util.GitCommit)
var cp util.CachePersister var cp util.CachePersister
if conf.Vtype == "" { if conf.Vtype == "" {
@ -138,7 +138,7 @@ func main() {
if pidErr != nil { if pidErr != nil {
klog.Errorf("Failed to get the PID limit, can not reconfigure: %v", pidErr) klog.Errorf("Failed to get the PID limit, can not reconfigure: %v", pidErr)
} else { } else {
klog.Infof("Initial PID limit is set to %d", currentLimit) klog.V(1).Infof("Initial PID limit is set to %d", currentLimit)
err = util.SetPIDLimit(conf.PidLimit) err = util.SetPIDLimit(conf.PidLimit)
if err != nil { if err != nil {
klog.Errorf("Failed to set new PID limit to %d: %v", conf.PidLimit, err) klog.Errorf("Failed to set new PID limit to %d: %v", conf.PidLimit, err)
@ -147,7 +147,7 @@ func main() {
if conf.PidLimit == -1 { if conf.PidLimit == -1 {
s = " (max)" s = " (max)"
} }
klog.Infof("Reconfigured PID limit to %d%s", conf.PidLimit, s) klog.V(1).Infof("Reconfigured PID limit to %d%s", conf.PidLimit, s)
} }
} }
} }
@ -166,7 +166,7 @@ func main() {
} }
} }
klog.Infof("Starting driver type: %v with name: %v", conf.Vtype, dname) klog.V(1).Infof("Starting driver type: %v with name: %v", conf.Vtype, dname)
switch conf.Vtype { switch conf.Vtype {
case rbdType: case rbdType:
driver := rbd.NewDriver() driver := rbd.NewDriver()

View File

@ -72,7 +72,7 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
// Existence and conflict checks // Existence and conflict checks
if acquired := cs.VolumeLocks.TryAcquire(requestName); !acquired { if acquired := cs.VolumeLocks.TryAcquire(requestName); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), requestName) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), requestName)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, requestName) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, requestName)
} }
defer cs.VolumeLocks.Release(requestName) defer cs.VolumeLocks.Release(requestName)
@ -126,7 +126,7 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
return nil, err return nil, err
} }
klog.Infof(util.Log(ctx, "cephfs: successfully created backing volume named %s for request name %s"), klog.V(4).Infof(util.Log(ctx, "cephfs: successfully created backing volume named %s for request name %s"),
vID.FsSubvolName, requestName) vID.FsSubvolName, requestName)
return &csi.CreateVolumeResponse{ return &csi.CreateVolumeResponse{
@ -149,7 +149,7 @@ func (cs *ControllerServer) deleteVolumeDeprecated(ctx context.Context, req *csi
ce := &controllerCacheEntry{} ce := &controllerCacheEntry{}
if err := cs.MetadataStore.Get(string(volID), ce); err != nil { if err := cs.MetadataStore.Get(string(volID), ce); err != nil {
if err, ok := err.(*util.CacheEntryNotFound); ok { if err, ok := err.(*util.CacheEntryNotFound); ok {
klog.Infof(util.Log(ctx, "cephfs: metadata for volume %s not found, assuming the volume to be already deleted (%v)"), volID, err) klog.Warningf(util.Log(ctx, "cephfs: metadata for volume %s not found, assuming the volume to be already deleted (%v)"), volID, err)
return &csi.DeleteVolumeResponse{}, nil return &csi.DeleteVolumeResponse{}, nil
} }
@ -166,7 +166,7 @@ func (cs *ControllerServer) deleteVolumeDeprecated(ctx context.Context, req *csi
// mons may have changed since create volume, // mons may have changed since create volume,
// retrieve the latest mons and override old mons // retrieve the latest mons and override old mons
if mon, secretsErr := util.GetMonValFromSecret(secrets); secretsErr == nil && len(mon) > 0 { if mon, secretsErr := util.GetMonValFromSecret(secrets); secretsErr == nil && len(mon) > 0 {
klog.Infof(util.Log(ctx, "overriding monitors [%q] with [%q] for volume %s"), ce.VolOptions.Monitors, mon, volID) klog.V(3).Infof(util.Log(ctx, "overriding monitors [%q] with [%q] for volume %s"), ce.VolOptions.Monitors, mon, volID)
ce.VolOptions.Monitors = mon ce.VolOptions.Monitors = mon
} }
@ -180,7 +180,7 @@ func (cs *ControllerServer) deleteVolumeDeprecated(ctx context.Context, req *csi
defer cr.DeleteCredentials() defer cr.DeleteCredentials()
if acquired := cs.VolumeLocks.TryAcquire(string(volID)); !acquired { if acquired := cs.VolumeLocks.TryAcquire(string(volID)); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, string(volID)) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, string(volID))
} }
defer cs.VolumeLocks.Release(string(volID)) defer cs.VolumeLocks.Release(string(volID))
@ -199,7 +199,7 @@ func (cs *ControllerServer) deleteVolumeDeprecated(ctx context.Context, req *csi
return nil, status.Error(codes.Internal, err.Error()) return nil, status.Error(codes.Internal, err.Error())
} }
klog.Infof(util.Log(ctx, "cephfs: successfully deleted volume %s"), volID) klog.V(4).Infof(util.Log(ctx, "cephfs: successfully deleted volume %s"), volID)
return &csi.DeleteVolumeResponse{}, nil return &csi.DeleteVolumeResponse{}, nil
} }
@ -216,7 +216,7 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
// lock out parallel delete operations // lock out parallel delete operations
if acquired := cs.VolumeLocks.TryAcquire(string(volID)); !acquired { if acquired := cs.VolumeLocks.TryAcquire(string(volID)); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, string(volID)) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, string(volID))
} }
defer cs.VolumeLocks.Release(string(volID)) defer cs.VolumeLocks.Release(string(volID))
@ -288,7 +288,7 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
return nil, status.Error(codes.Internal, err.Error()) return nil, status.Error(codes.Internal, err.Error())
} }
klog.Infof(util.Log(ctx, "cephfs: successfully deleted volume %s"), volID) klog.V(4).Infof(util.Log(ctx, "cephfs: successfully deleted volume %s"), volID)
return &csi.DeleteVolumeResponse{}, nil return &csi.DeleteVolumeResponse{}, nil
} }
@ -323,7 +323,7 @@ func (cs *ControllerServer) ControllerExpandVolume(ctx context.Context, req *csi
// lock out parallel delete operations // lock out parallel delete operations
if acquired := cs.VolumeLocks.TryAcquire(volID); !acquired { if acquired := cs.VolumeLocks.TryAcquire(volID); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID)
} }
defer cs.VolumeLocks.Release(volID) defer cs.VolumeLocks.Release(volID)

View File

@ -80,7 +80,7 @@ func (ns *NodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol
volID := volumeID(req.GetVolumeId()) volID := volumeID(req.GetVolumeId())
if acquired := ns.VolumeLocks.TryAcquire(req.GetVolumeId()); !acquired { if acquired := ns.VolumeLocks.TryAcquire(req.GetVolumeId()); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, req.GetVolumeId()) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, req.GetVolumeId())
} }
defer ns.VolumeLocks.Release(req.GetVolumeId()) defer ns.VolumeLocks.Release(req.GetVolumeId())
@ -117,7 +117,7 @@ func (ns *NodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol
} }
if isMnt { if isMnt {
klog.Infof(util.Log(ctx, "cephfs: volume %s is already mounted to %s, skipping"), volID, stagingTargetPath) klog.V(4).Infof(util.Log(ctx, "cephfs: volume %s is already mounted to %s, skipping"), volID, stagingTargetPath)
return &csi.NodeStageVolumeResponse{}, nil return &csi.NodeStageVolumeResponse{}, nil
} }
@ -126,7 +126,7 @@ func (ns *NodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol
return nil, err return nil, err
} }
klog.Infof(util.Log(ctx, "cephfs: successfully mounted volume %s to %s"), volID, stagingTargetPath) klog.V(4).Infof(util.Log(ctx, "cephfs: successfully mounted volume %s to %s"), volID, stagingTargetPath)
return &csi.NodeStageVolumeResponse{}, nil return &csi.NodeStageVolumeResponse{}, nil
} }
@ -169,7 +169,7 @@ func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
volID := req.GetVolumeId() volID := req.GetVolumeId()
if acquired := ns.VolumeLocks.TryAcquire(volID); !acquired { if acquired := ns.VolumeLocks.TryAcquire(volID); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID)
} }
defer ns.VolumeLocks.Release(volID) defer ns.VolumeLocks.Release(volID)
@ -195,7 +195,7 @@ func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
} }
if isMnt { if isMnt {
klog.Infof(util.Log(ctx, "cephfs: volume %s is already bind-mounted to %s"), volID, targetPath) klog.V(4).Infof(util.Log(ctx, "cephfs: volume %s is already bind-mounted to %s"), volID, targetPath)
return &csi.NodePublishVolumeResponse{}, nil return &csi.NodePublishVolumeResponse{}, nil
} }
@ -206,7 +206,7 @@ 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.Infof(util.Log(ctx, "cephfs: successfully bind-mounted volume %s to %s"), volID, targetPath) klog.V(4).Infof(util.Log(ctx, "cephfs: successfully bind-mounted volume %s to %s"), volID, targetPath)
// #nosec - allow anyone to write inside the target path // #nosec - allow anyone to write inside the target path
err = os.Chmod(targetPath, 0777) err = os.Chmod(targetPath, 0777)
@ -229,7 +229,7 @@ func (ns *NodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
targetPath := req.GetTargetPath() targetPath := req.GetTargetPath()
if acquired := ns.VolumeLocks.TryAcquire(volID); !acquired { if acquired := ns.VolumeLocks.TryAcquire(volID); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID)
} }
defer ns.VolumeLocks.Release(volID) defer ns.VolumeLocks.Release(volID)
@ -244,7 +244,7 @@ func (ns *NodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
return nil, status.Error(codes.Internal, err.Error()) return nil, status.Error(codes.Internal, err.Error())
} }
klog.Infof(util.Log(ctx, "cephfs: successfully unbinded volume %s from %s"), req.GetVolumeId(), targetPath) klog.V(4).Infof(util.Log(ctx, "cephfs: successfully unbinded volume %s from %s"), req.GetVolumeId(), targetPath)
return &csi.NodeUnpublishVolumeResponse{}, nil return &csi.NodeUnpublishVolumeResponse{}, nil
} }
@ -258,7 +258,7 @@ func (ns *NodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstag
volID := req.GetVolumeId() volID := req.GetVolumeId()
if acquired := ns.VolumeLocks.TryAcquire(volID); !acquired { if acquired := ns.VolumeLocks.TryAcquire(volID); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID)
} }
defer ns.VolumeLocks.Release(volID) defer ns.VolumeLocks.Release(volID)
@ -269,7 +269,7 @@ func (ns *NodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstag
return nil, status.Error(codes.Internal, err.Error()) return nil, status.Error(codes.Internal, err.Error())
} }
klog.Infof(util.Log(ctx, "cephfs: successfully unmounted volume %s from %s"), req.GetVolumeId(), stagingTargetPath) klog.V(4).Infof(util.Log(ctx, "cephfs: successfully unmounted volume %s from %s"), req.GetVolumeId(), stagingTargetPath)
return &csi.NodeUnstageVolumeResponse{}, nil return &csi.NodeUnstageVolumeResponse{}, nil
} }

View File

@ -157,15 +157,15 @@ func loadAvailableMounters(conf *util.Config) error {
release := string(utsname.Release[:64]) release := string(utsname.Release[:64])
if conf.ForceKernelCephFS || kernelSupportsQuota(release) { if conf.ForceKernelCephFS || kernelSupportsQuota(release) {
klog.Infof("loaded mounter: %s", volumeMounterKernel) klog.V(1).Infof("loaded mounter: %s", volumeMounterKernel)
availableMounters = append(availableMounters, volumeMounterKernel) availableMounters = append(availableMounters, volumeMounterKernel)
} else { } else {
klog.Infof("kernel version < 4.17 might not support quota feature, hence not loading kernel client") klog.V(1).Infof("kernel version < 4.17 might not support quota feature, hence not loading kernel client")
} }
} }
if fuseMounterProbe.Run() == nil { if fuseMounterProbe.Run() == nil {
klog.Infof("loaded mounter: %s", volumeMounterFuse) klog.V(1).Infof("loaded mounter: %s", volumeMounterFuse)
availableMounters = append(availableMounters, volumeMounterFuse) availableMounters = append(availableMounters, volumeMounterFuse)
} }
@ -200,7 +200,7 @@ func newMounter(volOptions *volumeOptions) (volumeMounter, error) {
if chosenMounter == "" { if chosenMounter == "" {
// Otherwise pick whatever is left // Otherwise pick whatever is left
chosenMounter = availableMounters[0] chosenMounter = availableMounters[0]
klog.Infof("requested mounter: %s, chosen mounter: %s", wantMounter, chosenMounter) klog.V(4).Infof("requested mounter: %s, chosen mounter: %s", wantMounter, chosenMounter)
} }
// Create the mounter // Create the mounter

View File

@ -83,7 +83,7 @@ func (d *CSIDriver) AddControllerServiceCapabilities(cl []csi.ControllerServiceC
var csc []*csi.ControllerServiceCapability var csc []*csi.ControllerServiceCapability
for _, c := range cl { for _, c := range cl {
klog.Infof("Enabling controller service capability: %v", c.String()) klog.V(1).Infof("Enabling controller service capability: %v", c.String())
csc = append(csc, NewControllerServiceCapability(c)) csc = append(csc, NewControllerServiceCapability(c))
} }
@ -94,7 +94,7 @@ func (d *CSIDriver) AddControllerServiceCapabilities(cl []csi.ControllerServiceC
func (d *CSIDriver) AddVolumeCapabilityAccessModes(vc []csi.VolumeCapability_AccessMode_Mode) []*csi.VolumeCapability_AccessMode { func (d *CSIDriver) AddVolumeCapabilityAccessModes(vc []csi.VolumeCapability_AccessMode_Mode) []*csi.VolumeCapability_AccessMode {
var vca []*csi.VolumeCapability_AccessMode var vca []*csi.VolumeCapability_AccessMode
for _, c := range vc { for _, c := range vc {
klog.Infof("Enabling volume access mode: %v", c.String()) klog.V(1).Infof("Enabling volume access mode: %v", c.String())
vca = append(vca, NewVolumeCapabilityAccessMode(c)) vca = append(vca, NewVolumeCapabilityAccessMode(c))
} }
d.vc = vca d.vc = vca

View File

@ -113,7 +113,7 @@ func (s *nonBlockingGRPCServer) serve(endpoint, hstOptions string, ids csi.Ident
if ns != nil { if ns != nil {
csi.RegisterNodeServer(server, ns) csi.RegisterNodeServer(server, ns)
} }
klog.Infof("Listening for connections on address: %#v", listener.Addr()) klog.V(1).Infof("Listening for connections on address: %#v", listener.Addr())
if metrics { if metrics {
ho := strings.Split(hstOptions, ",") ho := strings.Split(hstOptions, ",")
if len(ho) != 3 { if len(ho) != 3 {

View File

@ -41,7 +41,7 @@ func getLiveness(timeout time.Duration, csiConn *grpc.ClientConn) {
ctx, cancel := context.WithTimeout(context.Background(), timeout) ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel() defer cancel()
klog.Info("Sending probe request to CSI driver") klog.V(5).Info("Sending probe request to CSI driver")
ready, err := rpc.Probe(ctx, csiConn) ready, err := rpc.Probe(ctx, csiConn)
if err != nil { if err != nil {
liveness.Set(0) liveness.Set(0)
@ -55,7 +55,7 @@ func getLiveness(timeout time.Duration, csiConn *grpc.ClientConn) {
return return
} }
liveness.Set(1) liveness.Set(1)
klog.Infof("Health check succeeded") klog.V(3).Infof("Health check succeeded")
} }
func recordLiveness(endpoint string, pollTime, timeout time.Duration) { func recordLiveness(endpoint string, pollTime, timeout time.Duration) {
@ -81,7 +81,7 @@ func recordLiveness(endpoint string, pollTime, timeout time.Duration) {
} }
func Run(conf *util.Config) { func Run(conf *util.Config) {
klog.Infof("Liveness Running") klog.V(3).Infof("Liveness Running")
// start liveness collection // start liveness collection
go recordLiveness(conf.Endpoint, conf.PollTime, conf.PoolTimeout) go recordLiveness(conf.Endpoint, conf.PollTime, conf.PoolTimeout)

View File

@ -141,7 +141,7 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
// Existence and conflict checks // Existence and conflict checks
if acquired := cs.VolumeLocks.TryAcquire(req.GetName()); !acquired { if acquired := cs.VolumeLocks.TryAcquire(req.GetName()); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), req.GetName()) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), req.GetName())
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, req.GetName()) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, req.GetName())
} }
defer cs.VolumeLocks.Release(req.GetName()) defer cs.VolumeLocks.Release(req.GetName())
@ -291,7 +291,7 @@ func (cs *ControllerServer) DeleteLegacyVolume(ctx context.Context, req *csi.Del
} }
if acquired := cs.VolumeLocks.TryAcquire(volumeID); !acquired { if acquired := cs.VolumeLocks.TryAcquire(volumeID); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volumeID) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volumeID)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volumeID) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volumeID)
} }
defer cs.VolumeLocks.Release(volumeID) defer cs.VolumeLocks.Release(volumeID)
@ -300,7 +300,7 @@ func (cs *ControllerServer) DeleteLegacyVolume(ctx context.Context, req *csi.Del
defer rbdVol.Destroy() defer rbdVol.Destroy()
if err := cs.MetadataStore.Get(volumeID, rbdVol); err != nil { if err := cs.MetadataStore.Get(volumeID, rbdVol); err != nil {
if err, ok := err.(*util.CacheEntryNotFound); ok { if err, ok := err.(*util.CacheEntryNotFound); ok {
klog.V(3).Infof(util.Log(ctx, "metadata for legacy volume %s not found, assuming the volume to be already deleted (%v)"), volumeID, err) klog.Warningf(util.Log(ctx, "metadata for legacy volume %s not found, assuming the volume to be already deleted (%v)"), volumeID, err)
return &csi.DeleteVolumeResponse{}, nil return &csi.DeleteVolumeResponse{}, nil
} }
@ -318,7 +318,7 @@ func (cs *ControllerServer) DeleteLegacyVolume(ctx context.Context, req *csi.Del
klog.V(4).Infof(util.Log(ctx, "deleting legacy volume %s"), rbdVol.VolName) klog.V(4).Infof(util.Log(ctx, "deleting legacy volume %s"), rbdVol.VolName)
if err := deleteImage(ctx, rbdVol, cr); err != nil { if err := deleteImage(ctx, rbdVol, cr); err != nil {
// TODO: can we detect "already deleted" situations here and proceed? // TODO: can we detect "already deleted" situations here and proceed?
klog.V(3).Infof(util.Log(ctx, "failed to delete legacy rbd image: %s/%s with error: %v"), rbdVol.Pool, rbdVol.VolName, err) klog.Errorf(util.Log(ctx, "failed to delete legacy rbd image: %s/%s with error: %v"), rbdVol.Pool, rbdVol.VolName, err)
return nil, status.Error(codes.Internal, err.Error()) return nil, status.Error(codes.Internal, err.Error())
} }
@ -350,7 +350,7 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
} }
if acquired := cs.VolumeLocks.TryAcquire(volumeID); !acquired { if acquired := cs.VolumeLocks.TryAcquire(volumeID); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volumeID) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volumeID)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volumeID) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volumeID)
} }
defer cs.VolumeLocks.Release(volumeID) defer cs.VolumeLocks.Release(volumeID)
@ -392,7 +392,7 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
// to lead us to the image, hence the imageOMap needs to be garbage collected, by calling // to lead us to the image, hence the imageOMap needs to be garbage collected, by calling
// unreserve for the same // unreserve for the same
if acquired := cs.VolumeLocks.TryAcquire(rbdVol.RequestName); !acquired { if acquired := cs.VolumeLocks.TryAcquire(rbdVol.RequestName); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), rbdVol.RequestName) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), rbdVol.RequestName)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, rbdVol.RequestName) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, rbdVol.RequestName)
} }
defer cs.VolumeLocks.Release(rbdVol.RequestName) defer cs.VolumeLocks.Release(rbdVol.RequestName)
@ -406,7 +406,7 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
// lock out parallel create requests against the same volume name as we // lock out parallel create requests against the same volume name as we
// cleanup the image and associated omaps for the same // cleanup the image and associated omaps for the same
if acquired := cs.VolumeLocks.TryAcquire(rbdVol.RequestName); !acquired { if acquired := cs.VolumeLocks.TryAcquire(rbdVol.RequestName); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), rbdVol.RequestName) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), rbdVol.RequestName)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, rbdVol.RequestName) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, rbdVol.RequestName)
} }
defer cs.VolumeLocks.Release(rbdVol.RequestName) defer cs.VolumeLocks.Release(rbdVol.RequestName)
@ -427,7 +427,7 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
if rbdVol.Encrypted { if rbdVol.Encrypted {
if err = rbdVol.KMS.DeletePassphrase(rbdVol.VolID); err != nil { if err = rbdVol.KMS.DeletePassphrase(rbdVol.VolID); err != nil {
klog.V(3).Infof(util.Log(ctx, "failed to clean the passphrase for volume %s: %s"), rbdVol.VolID, err) klog.Warningf(util.Log(ctx, "failed to clean the passphrase for volume %s: %s"), rbdVol.VolID, err)
} }
} }
@ -505,7 +505,7 @@ func (cs *ControllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
rbdSnap.RequestName = req.GetName() rbdSnap.RequestName = req.GetName()
if acquired := cs.SnapshotLocks.TryAcquire(req.GetName()); !acquired { if acquired := cs.SnapshotLocks.TryAcquire(req.GetName()); !acquired {
klog.Infof(util.Log(ctx, util.SnapshotOperationAlreadyExistsFmt), req.GetName()) klog.Errorf(util.Log(ctx, util.SnapshotOperationAlreadyExistsFmt), req.GetName())
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, req.GetName()) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, req.GetName())
} }
defer cs.SnapshotLocks.Release(req.GetName()) defer cs.SnapshotLocks.Release(req.GetName())
@ -648,7 +648,7 @@ func (cs *ControllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteS
} }
if acquired := cs.SnapshotLocks.TryAcquire(snapshotID); !acquired { if acquired := cs.SnapshotLocks.TryAcquire(snapshotID); !acquired {
klog.Infof(util.Log(ctx, util.SnapshotOperationAlreadyExistsFmt), snapshotID) klog.Errorf(util.Log(ctx, util.SnapshotOperationAlreadyExistsFmt), snapshotID)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, snapshotID) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, snapshotID)
} }
defer cs.SnapshotLocks.Release(snapshotID) defer cs.SnapshotLocks.Release(snapshotID)
@ -678,7 +678,7 @@ func (cs *ControllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteS
// safeguarding against parallel create or delete requests against the // safeguarding against parallel create or delete requests against the
// same name. // same name.
if acquired := cs.SnapshotLocks.TryAcquire(rbdSnap.RequestName); !acquired { if acquired := cs.SnapshotLocks.TryAcquire(rbdSnap.RequestName); !acquired {
klog.Infof(util.Log(ctx, util.SnapshotOperationAlreadyExistsFmt), rbdSnap.RequestName) klog.Errorf(util.Log(ctx, util.SnapshotOperationAlreadyExistsFmt), rbdSnap.RequestName)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, rbdSnap.RequestName) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, rbdSnap.RequestName)
} }
defer cs.SnapshotLocks.Release(rbdSnap.RequestName) defer cs.SnapshotLocks.Release(rbdSnap.RequestName)
@ -692,7 +692,7 @@ func (cs *ControllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteS
// safeguard against parallel create or delete requests against the same // safeguard against parallel create or delete requests against the same
// name // name
if acquired := cs.SnapshotLocks.TryAcquire(rbdSnap.RequestName); !acquired { if acquired := cs.SnapshotLocks.TryAcquire(rbdSnap.RequestName); !acquired {
klog.Infof(util.Log(ctx, util.SnapshotOperationAlreadyExistsFmt), rbdSnap.RequestName) klog.Errorf(util.Log(ctx, util.SnapshotOperationAlreadyExistsFmt), rbdSnap.RequestName)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, rbdSnap.RequestName) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, rbdSnap.RequestName)
} }
defer cs.SnapshotLocks.Release(rbdSnap.RequestName) defer cs.SnapshotLocks.Release(rbdSnap.RequestName)
@ -735,7 +735,7 @@ func (cs *ControllerServer) ControllerExpandVolume(ctx context.Context, req *csi
// lock out parallel requests against the same volume ID // lock out parallel requests against the same volume ID
if acquired := cs.VolumeLocks.TryAcquire(volID); !acquired { if acquired := cs.VolumeLocks.TryAcquire(volID); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID)
} }
defer cs.VolumeLocks.Release(volID) defer cs.VolumeLocks.Release(volID)

View File

@ -97,7 +97,7 @@ func (ns *NodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol
defer cr.DeleteCredentials() defer cr.DeleteCredentials()
if acquired := ns.VolumeLocks.TryAcquire(volID); !acquired { if acquired := ns.VolumeLocks.TryAcquire(volID); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID)
} }
defer ns.VolumeLocks.Release(volID) defer ns.VolumeLocks.Release(volID)
@ -122,7 +122,7 @@ func (ns *NodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol
} }
if !isNotMnt { if !isNotMnt {
klog.Infof(util.Log(ctx, "rbd: volume %s is already mounted to %s, skipping"), volID, stagingTargetPath) klog.V(4).Infof(util.Log(ctx, "rbd: volume %s is already mounted to %s, skipping"), volID, stagingTargetPath)
return &csi.NodeStageVolumeResponse{}, nil return &csi.NodeStageVolumeResponse{}, nil
} }
@ -177,7 +177,7 @@ func (ns *NodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol
return nil, status.Error(codes.Internal, err.Error()) return nil, status.Error(codes.Internal, err.Error())
} }
klog.Infof(util.Log(ctx, "rbd: successfully mounted volume %s to stagingTargetPath %s"), req.GetVolumeId(), stagingTargetPath) klog.V(4).Infof(util.Log(ctx, "rbd: successfully mounted volume %s to stagingTargetPath %s"), req.GetVolumeId(), stagingTargetPath)
return &csi.NodeStageVolumeResponse{}, nil return &csi.NodeStageVolumeResponse{}, nil
} }
@ -314,7 +314,7 @@ func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
stagingPath += "/" + volID stagingPath += "/" + volID
if acquired := ns.VolumeLocks.TryAcquire(volID); !acquired { if acquired := ns.VolumeLocks.TryAcquire(volID); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID)
} }
defer ns.VolumeLocks.Release(volID) defer ns.VolumeLocks.Release(volID)
@ -335,7 +335,7 @@ func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
return nil, err return nil, err
} }
klog.Infof(util.Log(ctx, "rbd: successfully mounted stagingPath %s to targetPath %s"), stagingPath, targetPath) klog.V(4).Infof(util.Log(ctx, "rbd: successfully mounted stagingPath %s to targetPath %s"), stagingPath, targetPath)
return &csi.NodePublishVolumeResponse{}, nil return &csi.NodePublishVolumeResponse{}, nil
} }
@ -478,7 +478,7 @@ func (ns *NodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
volID := req.GetVolumeId() volID := req.GetVolumeId()
if acquired := ns.VolumeLocks.TryAcquire(volID); !acquired { if acquired := ns.VolumeLocks.TryAcquire(volID); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID)
} }
defer ns.VolumeLocks.Release(volID) defer ns.VolumeLocks.Release(volID)
@ -507,7 +507,7 @@ func (ns *NodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
return nil, status.Error(codes.Internal, err.Error()) return nil, status.Error(codes.Internal, err.Error())
} }
klog.Infof(util.Log(ctx, "rbd: successfully unbound volume %s from %s"), req.GetVolumeId(), targetPath) klog.V(4).Infof(util.Log(ctx, "rbd: successfully unbound volume %s from %s"), req.GetVolumeId(), targetPath)
return &csi.NodeUnpublishVolumeResponse{}, nil return &csi.NodeUnpublishVolumeResponse{}, nil
} }
@ -535,7 +535,7 @@ func (ns *NodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstag
volID := req.GetVolumeId() volID := req.GetVolumeId()
if acquired := ns.VolumeLocks.TryAcquire(volID); !acquired { if acquired := ns.VolumeLocks.TryAcquire(volID); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volID)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volID)
} }
defer ns.VolumeLocks.Release(volID) defer ns.VolumeLocks.Release(volID)
@ -596,7 +596,7 @@ func (ns *NodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstag
return nil, status.Error(codes.Internal, err.Error()) return nil, status.Error(codes.Internal, err.Error())
} }
klog.Infof(util.Log(ctx, "successfully unmounted volume (%s) from staging path (%s)"), klog.V(4).Infof(util.Log(ctx, "successfully unmounted volume (%s) from staging path (%s)"),
req.GetVolumeId(), stagingTargetPath) req.GetVolumeId(), stagingTargetPath)
if err = cleanupRBDImageMetadataStash(stagingParentPath); err != nil { if err = cleanupRBDImageMetadataStash(stagingParentPath); err != nil {
@ -619,7 +619,7 @@ func (ns *NodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandV
} }
if acquired := ns.VolumeLocks.TryAcquire(volumeID); !acquired { if acquired := ns.VolumeLocks.TryAcquire(volumeID); !acquired {
klog.Infof(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volumeID) klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), volumeID)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volumeID) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volumeID)
} }
defer ns.VolumeLocks.Release(volumeID) defer ns.VolumeLocks.Release(volumeID)

View File

@ -314,7 +314,7 @@ func detachRBDImageOrDeviceSpec(ctx context.Context, imageOrDeviceSpec string, i
(strings.Contains(string(output), fmt.Sprintf(rbdUnmapCmdkRbdMissingMap, imageOrDeviceSpec)) || (strings.Contains(string(output), fmt.Sprintf(rbdUnmapCmdkRbdMissingMap, imageOrDeviceSpec)) ||
strings.Contains(string(output), fmt.Sprintf(rbdUnmapCmdNbdMissingMap, imageOrDeviceSpec))) { strings.Contains(string(output), fmt.Sprintf(rbdUnmapCmdNbdMissingMap, imageOrDeviceSpec))) {
// Devices found not to be mapped are treated as a successful detach // Devices found not to be mapped are treated as a successful detach
klog.Infof(util.Log(ctx, "image or device spec (%s) not mapped"), imageOrDeviceSpec) klog.V(5).Infof(util.Log(ctx, "image or device spec (%s) not mapped"), imageOrDeviceSpec)
return nil return nil
} }
return fmt.Errorf("rbd: unmap for spec (%s) failed (%v): (%s)", imageOrDeviceSpec, err, string(output)) return fmt.Errorf("rbd: unmap for spec (%s) failed (%v): (%s)", imageOrDeviceSpec, err, string(output))

View File

@ -238,11 +238,11 @@ func rbdManagerTaskDeleteImage(ctx context.Context, pOpts *rbdVolume, cr *util.C
if err != nil { if err != nil {
if strings.Contains(string(output), rbdTaskRemoveCmdInvalidString1) && if strings.Contains(string(output), rbdTaskRemoveCmdInvalidString1) &&
strings.Contains(string(output), rbdTaskRemoveCmdInvalidString2) { strings.Contains(string(output), rbdTaskRemoveCmdInvalidString2) {
klog.Infof(util.Log(ctx, "cluster with cluster ID (%s) does not support Ceph manager based rbd image"+ klog.Warningf(util.Log(ctx, "cluster with cluster ID (%s) does not support Ceph manager based rbd image"+
" deletion (minimum ceph version required is v14.2.3)"), pOpts.ClusterID) " deletion (minimum ceph version required is v14.2.3)"), pOpts.ClusterID)
return false, err return false, err
} else if strings.HasPrefix(string(output), rbdTaskRemoveCmdAccessDeniedMessage) { } else if strings.HasPrefix(string(output), rbdTaskRemoveCmdAccessDeniedMessage) {
klog.Infof(util.Log(ctx, "access denied to Ceph MGR-based RBD image deletion "+ klog.Warningf(util.Log(ctx, "access denied to Ceph MGR-based RBD image deletion "+
"on cluster ID (%s)"), pOpts.ClusterID) "on cluster ID (%s)"), pOpts.ClusterID)
return false, err return false, err
} }
@ -261,7 +261,7 @@ func deleteImage(ctx context.Context, pOpts *rbdVolume, cr *util.Credentials) er
return err return err
} }
if found { if found {
klog.Info(util.Log(ctx, "rbd is still being used "), image) klog.Errorf(util.Log(ctx, "rbd is still being used "), image)
return fmt.Errorf("rbd %s is still being used", image) return fmt.Errorf("rbd %s is still being used", image)
} }

View File

@ -42,13 +42,13 @@ type CachePersister interface {
// NewCachePersister returns CachePersister based on store // NewCachePersister returns CachePersister based on store
func NewCachePersister(metadataStore, pluginPath string) (CachePersister, error) { func NewCachePersister(metadataStore, pluginPath string) (CachePersister, error) {
if metadataStore == "k8s_configmap" { if metadataStore == "k8s_configmap" {
klog.Infof("cache-perister: using kubernetes configmap as metadata cache persister") klog.V(4).Infof("cache-perister: using kubernetes configmap as metadata cache persister")
k8scm := &K8sCMCache{} k8scm := &K8sCMCache{}
k8scm.Client = NewK8sClient() k8scm.Client = NewK8sClient()
k8scm.Namespace = GetK8sNamespace() k8scm.Namespace = GetK8sNamespace()
return k8scm, nil return k8scm, nil
} else if metadataStore == "node" { } else if metadataStore == "node" {
klog.Infof("cache-persister: using node as metadata cache persister") klog.V(4).Infof("cache-persister: using node as metadata cache persister")
nc := &NodeCache{} nc := &NodeCache{}
nc.BasePath = pluginPath nc.BasePath = pluginPath
nc.CacheDir = "controller" nc.CacheDir = "controller"

View File

@ -85,7 +85,7 @@ func decodeObj(fpath, pattern string, file os.FileInfo, destObj interface{}) err
// #nosec // #nosec
fp, err := os.Open(path.Join(fpath, file.Name())) fp, err := os.Open(path.Join(fpath, file.Name()))
if err != nil { if err != nil {
klog.Infof("node-cache: open file: %s err %v", file.Name(), err) klog.V(4).Infof("node-cache: open file: %s err %v", file.Name(), err)
return errDec return errDec
} }
decoder := json.NewDecoder(fp) decoder := json.NewDecoder(fp)