Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acpq quota overrides bug #654

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Acpq quota overrides bug #654

wants to merge 3 commits into from

Conversation

Varsius
Copy link
Contributor

@Varsius Varsius commented Feb 4, 2025

Checklist:

  • If this PR is about a plugin, I tested the plugin against an OpenStack cluster.
  • I updated the documentation to describe the semantical or interface changes I introduced.

@coveralls
Copy link

coveralls commented Feb 4, 2025

Coverage Status

coverage: 79.586% (+0.08%) from 79.51%
when pulling ffd0710 on acpq-quota-overrides-bug
into 610896c on master.

@Varsius Varsius force-pushed the acpq-quota-overrides-bug branch from 1c277c9 to ffd0710 Compare February 6, 2025 08:58
@Varsius Varsius marked this pull request as ready for review February 6, 2025 09:00
@Varsius Varsius requested a review from majewsky February 6, 2025 09:01
Copy link
Contributor

@majewsky majewsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice. I only have a few small nitpicks:

}

func TestMinQuotaConstraintWithLargeNumbers(t *testing.T) {
// This tests how min quota overwrites deals with very large numbers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo:

Suggested change
// This tests how min quota overwrites deals with very large numbers
// This tests how min quota overrides deals with very large numbers

// Quota should not be assgined to ANY AZ on AZ aware resources. This causes unusable quota distribution on manual quota overrides.
resourceAZs := allAZs
if isAZAware {
resourceAZs = append([]limes.AvailabilityZone{}, allAZs...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This used to be the idiomatic way to clone a slice, but a standard library function has been added recently:

Suggested change
resourceAZs = append([]limes.AvailabilityZone{}, allAZs...)
resourceAZs = slices.Clone(allAZs)

}
}
}
missingQuota := subtractOrZero(*c.MinQuota, totalAllocated)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This made me notice that we have another instance of subtract-or-zero here. While we're at it, please replace subtractOrZero() with liquidapi.SaturatingSub() to reduce code duplication.

Comment on lines +474 to +476
if az == limes.AvailabilityZoneAny && isAZAware {
continue
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this check necessary? When initializing resourceAZs at the top of the function, we already filter out any if isAZAware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants