rbd: NodeExpandVolume() should use StagingTargetPath

Form kubernetes v1.19 onwards NodeRequest is getting volume path
in StagingTargetPath instead of VolumePath, cephcsi should also
use the same.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
(cherry picked from commit 4de1abad5e)
This commit is contained in:
Mudit Agarwal 2020-08-24 18:15:18 +05:30 committed by mergify[bot]
parent f119bf19c1
commit 947321619f

View File

@ -704,7 +704,16 @@ func (ns *NodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandV
if volumeID == "" {
return nil, status.Error(codes.InvalidArgument, "volume ID must be provided")
}
volumePath := req.GetVolumePath()
// Get volume path
// With Kubernetes version>=v1.19.0, expand request carries volume_path and
// staging_target_path, what csi requires is staging_target_path.
volumePath := req.GetStagingTargetPath()
if volumePath == "" {
// If Kubernetes version < v1.19.0 the volume_path would be
// having the staging_target_path information
volumePath = req.GetVolumePath()
}
if volumePath == "" {
return nil, status.Error(codes.InvalidArgument, "volume path must be provided")
}