mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
rbd: use the new go-ceph rbd.ErrExist for checking rbd.GroupCreate()
The go-ceph rbd.GroupCreate() now returns ErrExist in case the group that is created, already exists. The previous check only ever matched the string comparison, which is prone to errors in case the contents is modified by go-ceph. Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
88b964fe18
commit
10076ca11f
@ -20,7 +20,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/ceph/go-ceph/rados"
|
||||
librbd "github.com/ceph/go-ceph/rbd"
|
||||
@ -164,7 +163,7 @@ func (vg *volumeGroup) Create(ctx context.Context) error {
|
||||
|
||||
err = librbd.GroupCreate(ioctx, name)
|
||||
if err != nil {
|
||||
if !errors.Is(rados.ErrObjectExists, err) && !strings.Contains(err.Error(), "rbd: ret=-17, File exists") {
|
||||
if !errors.Is(err, librbd.ErrExist) {
|
||||
return fmt.Errorf("failed to create volume group %q: %w", name, err)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user