From c3accdcc3aa7b7900d3fbddcf9cd7e56d7c1206c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Tue, 23 Nov 2021 11:07:43 +0100 Subject: [PATCH] nfs: only set the pool size when it exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For CRD not using the new nfs spec that includes the pool settings, applying the "size" property won't work since it is set to 0. The pool still gets created but returns an error. The loop is re-queued but on the second run the pool is detected so no further configuration is done. Closes: https://github.com/rook/rook/issues/9205 Signed-off-by: Sébastien Han --- pkg/daemon/ceph/client/pool.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/daemon/ceph/client/pool.go b/pkg/daemon/ceph/client/pool.go index 5813c3df5c92..421f2e2a5a1c 100644 --- a/pkg/daemon/ceph/client/pool.go +++ b/pkg/daemon/ceph/client/pool.go @@ -408,8 +408,11 @@ func CreateReplicatedPoolForApp(context *clusterd.Context, clusterInfo *ClusterI if !clusterSpec.IsStretchCluster() { // the pool is type replicated, set the size for the pool now that it's been created - if err := SetPoolReplicatedSizeProperty(context, clusterInfo, poolName, strconv.FormatUint(uint64(pool.Replicated.Size), 10)); err != nil { - return errors.Wrapf(err, "failed to set size property to replicated pool %q to %d", poolName, pool.Replicated.Size) + // Only set the size if not 0, otherwise ceph will fail to set size to 0 + if pool.Replicated.Size > 0 { + if err := SetPoolReplicatedSizeProperty(context, clusterInfo, poolName, strconv.FormatUint(uint64(pool.Replicated.Size), 10)); err != nil { + return errors.Wrapf(err, "failed to set size property to replicated pool %q to %d", poolName, pool.Replicated.Size) + } } }