Skip to content

Commit

Permalink
nfs: only set the pool size when it exists
Browse files Browse the repository at this point in the history
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: #9205
Signed-off-by: Sébastien Han <seb@redhat.com>
(cherry picked from commit c3accdc)
  • Loading branch information
leseb authored and mergify-bot committed Nov 24, 2021
1 parent 10e6878 commit 760a8d3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/daemon/ceph/client/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}

Expand Down

0 comments on commit 760a8d3

Please sign in to comment.