Skip to content

Commit

Permalink
chore(CSI-224): add more logs to catch the race
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyberezansky committed Jul 28, 2024
1 parent 45c15bb commit 4b1448f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pkg/wekafs/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package wekafs

import (
"context"
"errors"
"fmt"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/rs/zerolog"
Expand Down Expand Up @@ -365,6 +366,7 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
volume, err := NewVolumeFromId(ctx, volumeID, client, cs)
if err != nil {
// Should return ok on incorrect ID (by CSI spec)
logger.Error().Err(err).Str("volume_id", volumeID).Msg("Failed to create volume object from ID")
result = "SUCCESS"
return &csi.DeleteVolumeResponse{}, nil
}
Expand All @@ -382,7 +384,8 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
}
// cleanup
if err != nil {
if err == ErrFilesystemHasUnderlyingSnapshots {
logger.Error().Err(err).Msg("Failed to delete volume")
if errors.Is(err, ErrFilesystemHasUnderlyingSnapshots) {
return &csi.DeleteVolumeResponse{}, err
}
return DeleteVolumeError(ctx, codes.Internal, err.Error())
Expand Down
2 changes: 2 additions & 0 deletions pkg/wekafs/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func (gc *innerPathVolGc) triggerGc(ctx context.Context, fs string, apiClient *a
}

func (gc *innerPathVolGc) triggerGcVolume(ctx context.Context, volume *Volume) {
logger := log.Ctx(ctx).With().Str("volume_id", volume.GetId()).Logger()
logger.Info().Msg("Triggering garbage collection of volume")
fsName := volume.FilesystemName
gc.Lock()
defer gc.Unlock()
Expand Down
3 changes: 2 additions & 1 deletion pkg/wekafs/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ func (m *wekaMount) incRef(ctx context.Context, apiClient *apiclient.ApiClient)
return err
}
} else if !m.isMounted() {
logger.Warn().Str("mount_point", m.mountPoint).Int("refcount", m.refCount).Msg("Mount not exists although should!")
t := PathIsWekaMount(ctx, m.mountPoint)
logger.Warn().Str("mount_point", m.mountPoint).Int("refcount", m.refCount).Bool("is_mounted", t).Msg("Mount not exists although should!")
if err := m.doMount(ctx, apiClient, m.mountOptions); err != nil {
return err
}
Expand Down

0 comments on commit 4b1448f

Please sign in to comment.