Supply staging path for block expansion
This commit is contained in:
@@ -255,26 +255,26 @@ func (m *csiBlockMapper) publishVolumeForBlock(
|
||||
}
|
||||
|
||||
// SetUpDevice ensures the device is attached returns path where the device is located.
|
||||
func (m *csiBlockMapper) SetUpDevice() error {
|
||||
func (m *csiBlockMapper) SetUpDevice() (string, error) {
|
||||
if !m.plugin.blockEnabled {
|
||||
return errors.New("CSIBlockVolume feature not enabled")
|
||||
return "", errors.New("CSIBlockVolume feature not enabled")
|
||||
}
|
||||
klog.V(4).Infof(log("blockMapper.SetUpDevice called"))
|
||||
|
||||
// Get csiSource from spec
|
||||
if m.spec == nil {
|
||||
return errors.New(log("blockMapper.SetUpDevice spec is nil"))
|
||||
return "", errors.New(log("blockMapper.SetUpDevice spec is nil"))
|
||||
}
|
||||
|
||||
csiSource, err := getCSISourceFromSpec(m.spec)
|
||||
if err != nil {
|
||||
return errors.New(log("blockMapper.SetUpDevice failed to get CSI persistent source: %v", err))
|
||||
return "", errors.New(log("blockMapper.SetUpDevice failed to get CSI persistent source: %v", err))
|
||||
}
|
||||
|
||||
driverName := csiSource.Driver
|
||||
skip, err := m.plugin.skipAttach(driverName)
|
||||
if err != nil {
|
||||
return errors.New(log("blockMapper.SetupDevice failed to check CSIDriver for %s: %v", driverName, err))
|
||||
return "", errors.New(log("blockMapper.SetupDevice failed to check CSIDriver for %s: %v", driverName, err))
|
||||
}
|
||||
|
||||
var attachment *storage.VolumeAttachment
|
||||
@@ -284,7 +284,7 @@ func (m *csiBlockMapper) SetUpDevice() error {
|
||||
attachID := getAttachmentName(csiSource.VolumeHandle, csiSource.Driver, nodeName)
|
||||
attachment, err = m.k8s.StorageV1().VolumeAttachments().Get(context.TODO(), attachID, meta.GetOptions{})
|
||||
if err != nil {
|
||||
return errors.New(log("blockMapper.SetupDevice failed to get volume attachment [id=%v]: %v", attachID, err))
|
||||
return "", errors.New(log("blockMapper.SetupDevice failed to get volume attachment [id=%v]: %v", attachID, err))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,11 +299,11 @@ func (m *csiBlockMapper) SetUpDevice() error {
|
||||
|
||||
csiClient, err := m.csiClientGetter.Get()
|
||||
if err != nil {
|
||||
return errors.New(log("blockMapper.SetUpDevice failed to get CSI client: %v", err))
|
||||
return "", errors.New(log("blockMapper.SetUpDevice failed to get CSI client: %v", err))
|
||||
}
|
||||
|
||||
// Call NodeStageVolume
|
||||
_, err = m.stageVolumeForBlock(ctx, csiClient, accessMode, csiSource, attachment)
|
||||
stagingPath, err := m.stageVolumeForBlock(ctx, csiClient, accessMode, csiSource, attachment)
|
||||
if err != nil {
|
||||
if volumetypes.IsOperationFinishedError(err) {
|
||||
cleanupErr := m.cleanupOrphanDeviceFiles()
|
||||
@@ -312,10 +312,10 @@ func (m *csiBlockMapper) SetUpDevice() error {
|
||||
klog.V(4).Infof("Failed to clean up block volume directory %s", cleanupErr)
|
||||
}
|
||||
}
|
||||
return err
|
||||
return "", err
|
||||
}
|
||||
|
||||
return nil
|
||||
return stagingPath, nil
|
||||
}
|
||||
|
||||
func (m *csiBlockMapper) MapPodDevice() (string, error) {
|
||||
|
Reference in New Issue
Block a user