File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -537,9 +537,11 @@ func (ns *GCENodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStage
537
537
}
538
538
}
539
539
540
- err = ns .DeviceCache .AddVolume (volumeID )
541
- if err != nil {
542
- klog .Warningf ("Error adding volume %s to cache: %v" , volumeID , err )
540
+ if ns .DeviceCache != nil {
541
+ err = ns .DeviceCache .AddVolume (volumeID )
542
+ if err != nil {
543
+ klog .Warningf ("Error adding volume %s to cache: %v" , volumeID , err )
544
+ }
543
545
}
544
546
545
547
klog .V (4 ).Infof ("NodeStageVolume succeeded on %v to %s" , volumeID , stagingTargetPath )
@@ -661,7 +663,9 @@ func (ns *GCENodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUns
661
663
}
662
664
}
663
665
664
- ns .DeviceCache .RemoveVolume (volumeID )
666
+ if ns .DeviceCache != nil {
667
+ ns .DeviceCache .RemoveVolume (volumeID )
668
+ }
665
669
666
670
klog .V (4 ).Infof ("NodeUnstageVolume succeeded on %v from %s" , volumeID , stagingTargetPath )
667
671
return & csi.NodeUnstageVolumeResponse {}, nil
You can’t perform that action at this time.
0 commit comments