From f0b8a3f626ecb46a0fe0f22e0254383e5fbfd82f Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Thu, 2 Sep 2021 21:31:17 +0530 Subject: [PATCH] rbd: use String() method of MirrorImageState in return error MirrorImageState (type C.rbd_mirror_image_state_t) has a string method which can be used while returning error in the replication controller. Previously, we were using int return in the error which is not the proper usage. Signed-off-by: Humble Chirammal --- internal/rbd/replicationcontrollerserver.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/rbd/replicationcontrollerserver.go b/internal/rbd/replicationcontrollerserver.go index a72348ae8..e0389c6d3 100644 --- a/internal/rbd/replicationcontrollerserver.go +++ b/internal/rbd/replicationcontrollerserver.go @@ -324,8 +324,7 @@ func (rs *ReplicationServer) DisableVolumeReplication(ctx context.Context, case librbd.MirrorImageEnabled: return disableVolumeReplication(rbdVol, mirroringInfo, force) default: - // TODO: use string instead of int for returning valid error message - return nil, status.Errorf(codes.InvalidArgument, "image is in %d Mode", mirroringInfo.State) + return nil, status.Errorf(codes.InvalidArgument, "image is in %s Mode", mirroringInfo.State) } return &replication.DisableVolumeReplicationResponse{}, nil