Skip to content

Commit

Permalink
removal some deprecated bool flags
Browse files Browse the repository at this point in the history
Signed-off-by: Shi, Crane <crane.shi@emc.com>
  • Loading branch information
CraneShiEMC committed Jun 26, 2023
1 parent d861003 commit 6c9ec1f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pkg/crcontrollers/storagegroup/storagegroupcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,17 +402,15 @@ func (c *Controller) handleStorageGroupDeletion(ctx context.Context, log *logrus
}

var labelRemovalErrMsgs []string
removalNoError := true
for _, drive := range drivesList.Items {
drive := drive
if drive.Labels[apiV1.StorageGroupLabelKey] == sg.Name {
if err := c.removeDriveAndACStorageGroupLabel(ctx, log, &drive, sg); err != nil {
labelRemovalErrMsgs = append(labelRemovalErrMsgs, err.Error())
removalNoError = false
}
}
}
if !removalNoError {
if len(labelRemovalErrMsgs) > 0 {
return ctrl.Result{Requeue: true}, fmt.Errorf(strings.Join(labelRemovalErrMsgs, "\n"))
}
return c.removeFinalizer(ctx, log, sg)
Expand All @@ -437,7 +435,6 @@ func (c *Controller) handleStorageGroupCreationOrUpdate(ctx context.Context, log
log.Errorf("failed to read drives list: %v", err)
return ctrl.Result{Requeue: true}, err
}
labelingNoError := true
noDriveSelected := true
drivesCount := map[string]int32{}
driveSelector := sg.Spec.DriveSelector
Expand Down Expand Up @@ -468,7 +465,6 @@ func (c *Controller) handleStorageGroupCreationOrUpdate(ctx context.Context, log
}

if err := c.addDriveAndACStorageGroupLabel(ctx, log, &drive, sg); err != nil {
labelingNoError = false
labelingErrMsgs = append(labelingErrMsgs, err.Error())
}
noDriveSelected = false
Expand All @@ -479,7 +475,6 @@ func (c *Controller) handleStorageGroupCreationOrUpdate(ctx context.Context, log
drive := d
if drivesCount[drive.Spec.NodeId] < driveSelector.NumberDrivesPerNode {
if err := c.addDriveAndACStorageGroupLabel(ctx, log, drive, sg); err != nil {
labelingNoError = false
labelingErrMsgs = append(labelingErrMsgs, err.Error())
}
noDriveSelected = false
Expand All @@ -490,7 +485,7 @@ func (c *Controller) handleStorageGroupCreationOrUpdate(ctx context.Context, log
if noDriveSelected {
log.Warnf("No drive can be selected by current storage group %s", sg.Name)
}
if labelingNoError {
if len(labelingErrMsgs) == 0 {
sg.Annotations[sgTempStatusAnnotationKey] = apiV1.Created
if err := c.client.UpdateCR(ctx, sg); err != nil {
log.Errorf("Unable to update StorageGroup status with error: %v.", err)
Expand Down

0 comments on commit 6c9ec1f

Please sign in to comment.