ceph: validate pools for stretch clusters
Pools in stretch clusters will all use the same crush rule that is generated by the operator when configuring the cluster for stretch mode, with replica 4 and two replicas per failure domain. Pools cannot create new crush rules, so we require that replica be 4 when the pools is created, EC is not allowed, and no new crush rule will be created. Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
This commit is contained in:
16 files changed
+133
-102
No files matched your search
@@ -223,7 +223,7 @@ func (r *ReconcileCephBlockPool) reconcile(request reconcile.Request) (reconcile
|
||||
}
|
||||
|
||||
// validate the pool settings
|
||||
if err := ValidatePool(r.context, clusterInfo, cephBlockPool); err != nil {
|
||||
if err := ValidatePool(r.context, clusterInfo, &cephCluster.Spec, cephBlockPool); err != nil {
|
||||
return opcontroller.ImmediateRetryResult, errors.Wrapf(err, "invalid pool CR %q spec", cephBlockPool.Name)
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ func (r *ReconcileCephBlockPool) reconcile(request reconcile.Request) (reconcile
|
||||
}
|
||||
|
||||
// CREATE/UPDATE
|
||||
reconcileResponse, err = r.reconcileCreatePool(clusterInfo, cephBlockPool, cephCluster.Spec)
|
||||
reconcileResponse, err = r.reconcileCreatePool(clusterInfo, &cephCluster.Spec, cephBlockPool)
|
||||
if err != nil {
|
||||
updateStatus(r.client, request.NamespacedName, cephv1.ConditionFailure, nil)
|
||||
return reconcileResponse, errors.Wrapf(err, "failed to create pool %q.", cephBlockPool.GetName())
|
||||
@@ -294,8 +294,8 @@ func (r *ReconcileCephBlockPool) reconcile(request reconcile.Request) (reconcile
|
||||
return reconcile.Result{}, nil
|
||||
}
|
||||
|
||||
func (r *ReconcileCephBlockPool) reconcileCreatePool(clusterInfo *cephclient.ClusterInfo, cephBlockPool *cephv1.CephBlockPool, cluster cephv1.ClusterSpec) (reconcile.Result, error) {
|
||||
err := createPool(r.context, clusterInfo, cephBlockPool, cluster)
|
||||
func (r *ReconcileCephBlockPool) reconcileCreatePool(clusterInfo *cephclient.ClusterInfo, cephCluster *cephv1.ClusterSpec, cephBlockPool *cephv1.CephBlockPool) (reconcile.Result, error) {
|
||||
err := createPool(r.context, clusterInfo, cephCluster, cephBlockPool)
|
||||
if err != nil {
|
||||
return opcontroller.ImmediateRetryResult, errors.Wrapf(err, "failed to create pool %q.", cephBlockPool.GetName())
|
||||
}
|
||||
@@ -305,10 +305,10 @@ func (r *ReconcileCephBlockPool) reconcileCreatePool(clusterInfo *cephclient.Clu
|
||||
}
|
||||
|
||||
// Create the pool
|
||||
func createPool(context *clusterd.Context, clusterInfo *cephclient.ClusterInfo, p *cephv1.CephBlockPool, cluster cephv1.ClusterSpec) error {
|
||||
func createPool(context *clusterd.Context, clusterInfo *cephclient.ClusterInfo, clusterSpec *cephv1.ClusterSpec, p *cephv1.CephBlockPool) error {
|
||||
// create the pool
|
||||
logger.Infof("creating pool %q in namespace %q", p.Name, p.Namespace)
|
||||
if err := cephclient.CreatePoolWithProfile(context, clusterInfo, p.Name, p.Spec, poolApplicationNameRBD, cluster); err != nil {
|
||||
if err := cephclient.CreatePoolWithProfile(context, clusterInfo, clusterSpec, p.Name, p.Spec, poolApplicationNameRBD); err != nil {
|
||||
return errors.Wrapf(err, "failed to create pool %q", p.Name)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user