Skip to content

Commit

Permalink
fix: panic on Windows node when getFreeSpace failed on volume path
Browse files Browse the repository at this point in the history
  • Loading branch information
andyzhangx authored and k8s-infra-cherrypick-robot committed Jun 21, 2024
1 parent b9c0a37 commit cb97007
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/azuredisk/azure_common_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,10 @@ func (d *DriverCore) GetVolumeStats(ctx context.Context, m *mount.SafeFormatAndM

if proxy, ok := m.Interface.(mounter.CSIProxyMounter); ok {
volUsage, err := proxy.GetVolumeStats(ctx, target)
// cache the volume stats per volume
d.volStatsCache.Set(volumeID, *volUsage)
if err == nil && volUsage != nil {
// cache the volume stats per volume
d.volStatsCache.Set(volumeID, *volUsage)
}
return []*csi.VolumeUsage{volUsage}, err
}
return []*csi.VolumeUsage{}, fmt.Errorf("could not cast to csi proxy class")
Expand Down

0 comments on commit cb97007

Please sign in to comment.