From be8c3c4b721705106f5a0b325b2cede2b077be8f Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Thu, 14 May 2020 14:28:55 +0200 Subject: [PATCH] cleanup: return InvalidPoolID on error in GetPoolID() InvalidPoolID has recently been added, and can be used in other location too. As GetPoolID is updated with this patch set, return InvalidPoolID on errors too. Signed-off-by: Niels de Vos --- internal/util/cephcmds.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/util/cephcmds.go b/internal/util/cephcmds.go index a5f4920f2..19ab4961a 100644 --- a/internal/util/cephcmds.go +++ b/internal/util/cephcmds.go @@ -92,15 +92,15 @@ func getPools(ctx context.Context, monitors string, cr *Credentials) ([]cephStor func GetPoolID(monitors string, cr *Credentials, poolName string) (int64, error) { conn, err := connPool.Get(monitors, cr.ID, cr.KeyFile) if err != nil { - return 0, err + return InvalidPoolID, err } defer connPool.Put(conn) id, err := conn.GetPoolByName(poolName) if err == rados.ErrNotFound { - return 0, ErrPoolNotFound{poolName, fmt.Errorf("pool (%s) not found in Ceph cluster", poolName)} + return InvalidPoolID, ErrPoolNotFound{poolName, fmt.Errorf("pool (%s) not found in Ceph cluster", poolName)} } else if err != nil { - return 0, err + return InvalidPoolID, err } return id, nil