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 <rar@redhat.com>
This commit is contained in:
Rakshith R 2022-03-03 20:09:21 +05:30 committed by mergify[bot]
parent dd96024620
commit 3a64ee48c3

View File

@ -127,11 +127,11 @@ func (rsns *ReclaimSpaceNodeServer) NodeReclaimSpace(
return nil, status.Error(codes.Unimplemented, "multi-node space reclaim is not supported") return nil, status.Error(codes.Unimplemented, "multi-node space reclaim is not supported")
} }
cmd := "fstrim"
if isBlock { 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) _, stderr, err := util.ExecCommand(ctx, cmd, path)
if err != nil { if err != nil {
return nil, status.Errorf( return nil, status.Errorf(