Skip to content

Quota calculation is incorrect #3448

@huadream

Description

@huadream
ISSUE TYPE
  • Bug Report
COMPONENT NAME
Quota
CLOUDSTACK VERSION
master branch
CONFIGURATION
OS / ENVIRONMENT
SUMMARY

String aggregationRange = configs.get("usage.stats.job.aggregation.range");

The default value of usage.stats.job.aggregation.range is 1440.
_aggregationDuration = Integer.parseInt(aggregationRange);
BigDecimal aggregationRatio = new BigDecimal(_aggregationDuration).divide(s_minutesInMonth, 8, RoundingMode.HALF_EVEN);

The value of aggregationRatio calculated is 1440/(30 * 24 * 60).

All updateQuota* functions have the bug below.

onehourcost = tariff.getCurrencyValue().multiply(aggregationRatio);

This line would be one-day-cost not one-hour-cost.
So the aggregationRatio should be fixed with 1/(30 * 24).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions