File tree 1 file changed +17
-1
lines changed
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,18 @@ func (s *service) NodePublishVolume(
110
110
"publish volume info 'device' key required" )
111
111
}
112
112
113
+ if len (req .GetVolumeId ()) == 0 {
114
+ return nil , status .Error (codes .InvalidArgument , "Volume ID cannot be empty" )
115
+ }
116
+
117
+ if len (req .GetTargetPath ()) == 0 {
118
+ return nil , status .Error (codes .InvalidArgument , "Target Path cannot be empty" )
119
+ }
120
+
121
+ if req .GetVolumeCapability () == nil {
122
+ return nil , status .Error (codes .InvalidArgument , "Volume Capability cannot be empty" )
123
+ }
124
+
113
125
s .volsRWL .Lock ()
114
126
defer s .volsRWL .Unlock ()
115
127
@@ -135,7 +147,11 @@ func (s *service) NodePublishVolume(
135
147
}
136
148
137
149
// Publish the volume.
138
- v .Attributes [nodeMntPathKey ] = device
150
+ if req .GetStagingTargetPath () != "" {
151
+ v .Attributes [nodeMntPathKey ] = req .GetStagingTargetPath ()
152
+ } else {
153
+ v .Attributes [nodeMntPathKey ] = device
154
+ }
139
155
s .vols [i ] = v
140
156
141
157
return & csi.NodePublishVolumeResponse {}, nil
You can’t perform that action at this time.
0 commit comments