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 @@ -512,9 +512,11 @@ func (ns *GCENodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStage
512
512
}
513
513
}
514
514
515
- err = ns .DeviceCache .AddVolume (volumeID )
516
- if err != nil {
517
- klog .Warningf ("Error adding volume %s to cache: %v" , volumeID , err )
515
+ if ns .DeviceCache != nil {
516
+ err = ns .DeviceCache .AddVolume (volumeID )
517
+ if err != nil {
518
+ klog .Warningf ("Error adding volume %s to cache: %v" , volumeID , err )
519
+ }
518
520
}
519
521
520
522
klog .V (4 ).Infof ("NodeStageVolume succeeded on %v to %s" , volumeID , stagingTargetPath )
@@ -631,7 +633,9 @@ func (ns *GCENodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUns
631
633
}
632
634
}
633
635
634
- ns .DeviceCache .RemoveVolume (volumeID )
636
+ if ns .DeviceCache != nil {
637
+ ns .DeviceCache .RemoveVolume (volumeID )
638
+ }
635
639
636
640
klog .V (4 ).Infof ("NodeUnstageVolume succeeded on %v from %s" , volumeID , stagingTargetPath )
637
641
return & csi.NodeUnstageVolumeResponse {}, nil
You can’t perform that action at this time.
0 commit comments