Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandr Stefurishin <[email protected]>
  • Loading branch information
Alexandr Stefurishin committed Nov 6, 2024
1 parent 7b7803d commit be2194a
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 55 deletions.
1 change: 0 additions & 1 deletion images/agent/src/internal/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ func (c *Cache) PrintTheCache(log logger.Logger) {
for key, lv := range c.lvs {
lvData := lv.Data
log.Trace(fmt.Sprintf(" Key: %s, Exist: %t, Data Name: %s, VG name: %s, size: %s, tags: %s, attr: %s, pool: %s", key, lv.Exist, lvData.LVName, lvData.VGName, lvData.LVSize.String(), lvData.LvTags, lvData.LVAttr, lvData.PoolName))

}

log.Trace("[ERRS]")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ func TestLVMLogicaVolumeWatcher(t *testing.T) {
})

t.Run("thin_all_bad_returns_false", func(t *testing.T) {

r := setupReconciler()

llv := &v1alpha1.LVMLogicalVolume{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (r *Reconciler) MaxConcurrentReconciles() int {
}

// ShouldReconcileUpdate implements controller.Reconciler.
func (r *Reconciler) ShouldReconcileUpdate(objectOld *v1alpha1.LVMVolumeGroup, objectNew *v1alpha1.LVMVolumeGroup) bool {
func (r *Reconciler) ShouldReconcileUpdate(_ *v1alpha1.LVMVolumeGroup, _ *v1alpha1.LVMVolumeGroup) bool {
return true
}

Expand All @@ -78,7 +78,6 @@ func (r *Reconciler) Reconcile(
ctx context.Context,
req controller.ReconcileRequest[*v1alpha1.LVMVolumeGroup],
) (controller.Result, error) {

lvg := req.Object

if !r.shouldLLVExtenderReconcileEvent(lvg) {
Expand All @@ -96,7 +95,6 @@ func (r *Reconciler) Reconcile(

r.log.Info(fmt.Sprintf("[RunLVMLogicalVolumeExtenderWatcherController] successfully reconciled LVMLogicalVolumes for the LVMVolumeGroup %s", lvg.Name))
return controller.Result{}, nil

}

func (r *Reconciler) shouldLLVExtenderReconcileEvent(newLVG *v1alpha1.LVMVolumeGroup) bool {
Expand Down
4 changes: 2 additions & 2 deletions images/agent/src/internal/controller/llvs/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ func (r *Reconciler) MaxConcurrentReconciles() int {
}

// ShouldReconcileUpdate implements controller.Reconciler.
func (r *Reconciler) ShouldReconcileUpdate(objectOld *v1alpha1.LVMVolumeGroup, objectNew *v1alpha1.LVMVolumeGroup) bool {
func (r *Reconciler) ShouldReconcileUpdate(_ *v1alpha1.LVMVolumeGroup, _ *v1alpha1.LVMVolumeGroup) bool {
return true
}

// Reconcile implements controller.Reconciler.
func (r *Reconciler) Reconcile(ctx context.Context, request controller.ReconcileRequest[*v1alpha1.LVMVolumeGroup]) (controller.Result, error) {
func (r *Reconciler) Reconcile(_ context.Context, _ controller.ReconcileRequest[*v1alpha1.LVMVolumeGroup]) (controller.Result, error) {
return controller.Result{}, nil
}
10 changes: 5 additions & 5 deletions images/agent/src/internal/controller/lvg/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ func (r *Reconciler) reconcileThinPoolsIfNeeded(

if actualTp, exist := actualThinPools[specTp.Name]; !exist {
r.log.Debug(fmt.Sprintf("[ReconcileThinPoolsIfNeeded] thin-pool %s of the LVMVolumeGroup %s is not created yet. Create it", specTp.Name, lvg.Name))
if checkIfConditionIsTrue(lvg, internal.TypeVGConfigurationApplied) {
if isApplied(lvg) {
err := r.lvgCl.UpdateLVGConditionIfNeeded(ctx, lvg, v1.ConditionFalse, internal.TypeVGConfigurationApplied, internal.ReasonUpdating, "trying to apply the configuration")
if err != nil {
r.log.Error(err, fmt.Sprintf("[ReconcileThinPoolsIfNeeded] unable to add the condition %s status False reason %s to the LVMVolumeGroup %s", internal.TypeVGConfigurationApplied, internal.ReasonUpdating, lvg.Name))
Expand Down Expand Up @@ -980,7 +980,7 @@ func (r *Reconciler) reconcileThinPoolsIfNeeded(
}

r.log.Debug(fmt.Sprintf("[ReconcileThinPoolsIfNeeded] the LVMVolumeGroup %s requested thin pool %s size is more than actual one. Resize it", lvg.Name, tpRequestedSize.String()))
if checkIfConditionIsTrue(lvg, internal.TypeVGConfigurationApplied) {
if isApplied(lvg) {
err = r.lvgCl.UpdateLVGConditionIfNeeded(ctx, lvg, v1.ConditionFalse, internal.TypeVGConfigurationApplied, internal.ReasonUpdating, "trying to apply the configuration")
if err != nil {
r.log.Error(err, fmt.Sprintf("[ReconcileThinPoolsIfNeeded] unable to add the condition %s status False reason %s to the LVMVolumeGroup %s", internal.TypeVGConfigurationApplied, internal.ReasonUpdating, lvg.Name))
Expand Down Expand Up @@ -1013,7 +1013,7 @@ func (r *Reconciler) resizePVIfNeeded(ctx context.Context, lvg *v1alpha1.LVMVolu
for _, n := range lvg.Status.Nodes {
for _, d := range n.Devices {
if d.DevSize.Value()-d.PVSize.Value() > internal.ResizeDelta.Value() {
if checkIfConditionIsTrue(lvg, internal.TypeVGConfigurationApplied) {
if isApplied(lvg) {
err := r.lvgCl.UpdateLVGConditionIfNeeded(ctx, lvg, v1.ConditionFalse, internal.TypeVGConfigurationApplied, internal.ReasonUpdating, "trying to apply the configuration")
if err != nil {
r.log.Error(err, fmt.Sprintf("[UpdateVGTagIfNeeded] unable to add the condition %s status False reason %s to the LVMVolumeGroup %s", internal.TypeVGConfigurationApplied, internal.ReasonUpdating, lvg.Name))
Expand Down Expand Up @@ -1079,7 +1079,7 @@ func (r *Reconciler) extendVGIfNeeded(
return nil
}

if checkIfConditionIsTrue(lvg, internal.TypeVGConfigurationApplied) {
if isApplied(lvg) {
err := r.lvgCl.UpdateLVGConditionIfNeeded(ctx, lvg, v1.ConditionFalse, internal.TypeVGConfigurationApplied, internal.ReasonUpdating, "trying to apply the configuration")
if err != nil {
r.log.Error(err, fmt.Sprintf("[UpdateVGTagIfNeeded] unable to add the condition %s status False reason %s to the LVMVolumeGroup %s", internal.TypeVGConfigurationApplied, internal.ReasonUpdating, lvg.Name))
Expand Down Expand Up @@ -1272,7 +1272,7 @@ func (r *Reconciler) updateVGTagIfNeeded(
) (bool, error) {
found, tagName := utils.CheckTag(vg.VGTags)
if found && lvg.Name != tagName {
if checkIfConditionIsTrue(lvg, internal.TypeVGConfigurationApplied) {
if isApplied(lvg) {
err := r.lvgCl.UpdateLVGConditionIfNeeded(ctx, lvg, v1.ConditionFalse, internal.TypeVGConfigurationApplied, internal.ReasonUpdating, "trying to apply the configuration")
if err != nil {
r.log.Error(err, fmt.Sprintf("[UpdateVGTagIfNeeded] unable to add the condition %s status False reason %s to the LVMVolumeGroup %s", internal.TypeVGConfigurationApplied, internal.ReasonUpdating, lvg.Name))
Expand Down
Loading

0 comments on commit be2194a

Please sign in to comment.