@@ -255,26 +255,26 @@ func (m *csiBlockMapper) publishVolumeForBlock(
255
255
}
256
256
257
257
// SetUpDevice ensures the device is attached returns path where the device is located.
258
- func (m * csiBlockMapper ) SetUpDevice () error {
258
+ func (m * csiBlockMapper ) SetUpDevice () ( string , error ) {
259
259
if ! m .plugin .blockEnabled {
260
- return errors .New ("CSIBlockVolume feature not enabled" )
260
+ return "" , errors .New ("CSIBlockVolume feature not enabled" )
261
261
}
262
262
klog .V (4 ).Infof (log ("blockMapper.SetUpDevice called" ))
263
263
264
264
// Get csiSource from spec
265
265
if m .spec == nil {
266
- return errors .New (log ("blockMapper.SetUpDevice spec is nil" ))
266
+ return "" , errors .New (log ("blockMapper.SetUpDevice spec is nil" ))
267
267
}
268
268
269
269
csiSource , err := getCSISourceFromSpec (m .spec )
270
270
if err != nil {
271
- return errors .New (log ("blockMapper.SetUpDevice failed to get CSI persistent source: %v" , err ))
271
+ return "" , errors .New (log ("blockMapper.SetUpDevice failed to get CSI persistent source: %v" , err ))
272
272
}
273
273
274
274
driverName := csiSource .Driver
275
275
skip , err := m .plugin .skipAttach (driverName )
276
276
if err != nil {
277
- return errors .New (log ("blockMapper.SetupDevice failed to check CSIDriver for %s: %v" , driverName , err ))
277
+ return "" , errors .New (log ("blockMapper.SetupDevice failed to check CSIDriver for %s: %v" , driverName , err ))
278
278
}
279
279
280
280
var attachment * storage.VolumeAttachment
@@ -284,7 +284,7 @@ func (m *csiBlockMapper) SetUpDevice() error {
284
284
attachID := getAttachmentName (csiSource .VolumeHandle , csiSource .Driver , nodeName )
285
285
attachment , err = m .k8s .StorageV1 ().VolumeAttachments ().Get (context .TODO (), attachID , meta.GetOptions {})
286
286
if err != nil {
287
- return errors .New (log ("blockMapper.SetupDevice failed to get volume attachment [id=%v]: %v" , attachID , err ))
287
+ return "" , errors .New (log ("blockMapper.SetupDevice failed to get volume attachment [id=%v]: %v" , attachID , err ))
288
288
}
289
289
}
290
290
@@ -299,11 +299,11 @@ func (m *csiBlockMapper) SetUpDevice() error {
299
299
300
300
csiClient , err := m .csiClientGetter .Get ()
301
301
if err != nil {
302
- return errors .New (log ("blockMapper.SetUpDevice failed to get CSI client: %v" , err ))
302
+ return "" , errors .New (log ("blockMapper.SetUpDevice failed to get CSI client: %v" , err ))
303
303
}
304
304
305
305
// Call NodeStageVolume
306
- _ , err = m .stageVolumeForBlock (ctx , csiClient , accessMode , csiSource , attachment )
306
+ stagingPath , err : = m .stageVolumeForBlock (ctx , csiClient , accessMode , csiSource , attachment )
307
307
if err != nil {
308
308
if volumetypes .IsOperationFinishedError (err ) {
309
309
cleanupErr := m .cleanupOrphanDeviceFiles ()
@@ -312,10 +312,10 @@ func (m *csiBlockMapper) SetUpDevice() error {
312
312
klog .V (4 ).Infof ("Failed to clean up block volume directory %s" , cleanupErr )
313
313
}
314
314
}
315
- return err
315
+ return "" , err
316
316
}
317
317
318
- return nil
318
+ return stagingPath , nil
319
319
}
320
320
321
321
func (m * csiBlockMapper ) MapPodDevice () (string , error ) {
0 commit comments