From 9260f4fe9f5966b6ca460d23c615a297fa11028c Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 15 Aug 2023 13:13:14 +0200 Subject: [PATCH] file: ignore exit code 22 when adding datapool Ignore the exit code 22 when adding the datapool to a filesystem. updates: #12673 Signed-off-by: Madhu Rajanna (cherry picked from commit bd9b42d221883836f68fc4ea64820bff5ac6d5f9) --- pkg/daemon/ceph/client/filesystem.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/daemon/ceph/client/filesystem.go b/pkg/daemon/ceph/client/filesystem.go index 4d2bd3621..03132c2d4 100644 --- a/pkg/daemon/ceph/client/filesystem.go +++ b/pkg/daemon/ceph/client/filesystem.go @@ -21,6 +21,7 @@ import ( "encoding/json" "fmt" "strconv" + "syscall" "time" "github.com/pkg/errors" @@ -168,6 +169,14 @@ func AddDataPoolToFilesystem(context *clusterd.Context, clusterInfo *ClusterInfo args := []string{"fs", "add_data_pool", name, poolName} _, err := NewCephCommand(context, clusterInfo, args).Run() if err != nil { + // Reef disallows calling add_data_pool for a pool that has already + // been added, so ignore the error code. + // Previous releases do not return an error when an existing data pool is added. + if clusterInfo.CephVersion.IsAtLeastReef() { + if code, ok := exec.ExitStatus(err); ok && code == int(syscall.EINVAL) { + return nil + } + } return errors.Wrapf(err, "failed to add pool %q to file system %q. (%v)", poolName, name, err) } return nil