From 4de1abad5edaa074b9366ac551dd57657fc89d51 Mon Sep 17 00:00:00 2001 From: Mudit Agarwal Date: Mon, 24 Aug 2020 18:15:18 +0530 Subject: [PATCH] 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 --- internal/rbd/nodeserver.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/rbd/nodeserver.go b/internal/rbd/nodeserver.go index 463b99208..a32940d24 100644 --- a/internal/rbd/nodeserver.go +++ b/internal/rbd/nodeserver.go @@ -701,7 +701,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") }