From c374edcbaa2a5dd364a9d526728e1629cd666a82 Mon Sep 17 00:00:00 2001 From: Rakshith R Date: Thu, 3 Mar 2022 20:09:21 +0530 Subject: [PATCH] rbd: return unimplemented error for block-mode reclaimspace req blkdiscard cmd discards all data on the block device which is not desired. Hence, return unimplemented code if the volume access mode is block. Signed-off-by: Rakshith R (cherry picked from commit 3a64ee48c3eed8131ad8eef0a889a89d56ffab17) --- internal/csi-addons/rbd/reclaimspace.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/csi-addons/rbd/reclaimspace.go b/internal/csi-addons/rbd/reclaimspace.go index ab6c56c13..ff9f1a8f4 100644 --- a/internal/csi-addons/rbd/reclaimspace.go +++ b/internal/csi-addons/rbd/reclaimspace.go @@ -127,11 +127,11 @@ func (rsns *ReclaimSpaceNodeServer) NodeReclaimSpace( return nil, status.Error(codes.Unimplemented, "multi-node space reclaim is not supported") } - cmd := "fstrim" if isBlock { - cmd = "blkdiscard" + return nil, status.Error(codes.Unimplemented, "block-mode space reclaim is not supported") } + cmd := "fstrim" _, stderr, err := util.ExecCommand(ctx, cmd, path) if err != nil { return nil, status.Errorf(