From 947321619f32911a31fc7ccca79a2178bc1b1e3e 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 (cherry picked from commit 4de1abad5edaa074b9366ac551dd57657fc89d51) --- 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 78c50e81d..348029018 100644 --- a/internal/rbd/nodeserver.go +++ b/internal/rbd/nodeserver.go @@ -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") }