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
537537 }
538538 }
539539
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+ }
543545 }
544546
545547 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
661663 }
662664 }
663665
664- ns .DeviceCache .RemoveVolume (volumeID )
666+ if ns .DeviceCache != nil {
667+ ns .DeviceCache .RemoveVolume (volumeID )
668+ }
665669
666670 klog .V (4 ).Infof ("NodeUnstageVolume succeeded on %v from %s" , volumeID , stagingTargetPath )
667671 return & csi.NodeUnstageVolumeResponse {}, nil
You can’t perform that action at this time.
0 commit comments