mirror of https://github.com/apache/cloudstack.git
quota: don't lock account, only unlock with adding credits
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
e4125a2999
commit
70aada690b
|
|
@ -282,22 +282,12 @@ public class QuotaResponseBuilderImpl implements QuotaResponseBuilder {
|
|||
TransactionLegacy.open(TransactionLegacy.CLOUD_DB).close();
|
||||
final AccountVO account = _accountDao.findById(accountId);
|
||||
final boolean lockAccountEnforcement = QuotaConfig.QuotaEnableEnforcement.value().equalsIgnoreCase("true");
|
||||
if (lockAccountEnforcement) {
|
||||
if (_quotaBalanceDao.lastQuotaBalance(accountId, domainId, new Date()).compareTo(new BigDecimal(0)) >= 0) {
|
||||
if (account.getState() == Account.State.locked) {
|
||||
try {
|
||||
_regionMgr.enableAccount(account.getAccountName(), domainId, accountId);
|
||||
} catch (Exception e) {
|
||||
s_logger.error(String.format("Unable to unlock account %s after getting enough quota credits", account.getAccountName()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (account.getState() == Account.State.enabled) {
|
||||
try {
|
||||
_regionMgr.disableAccount(account.getAccountName(), domainId, accountId, true);
|
||||
} catch (Exception e) {
|
||||
s_logger.error(String.format("Unable to lock account %s due to low balance", account.getAccountName()));
|
||||
}
|
||||
if (lockAccountEnforcement && (_quotaBalanceDao.lastQuotaBalance(accountId, domainId, new Date()).compareTo(new BigDecimal(0)) >= 0)) {
|
||||
if (account.getState() == Account.State.locked) {
|
||||
try {
|
||||
_regionMgr.enableAccount(account.getAccountName(), domainId, accountId);
|
||||
} catch (Exception e) {
|
||||
s_logger.error(String.format("Unable to unlock account %s after getting enough quota credits", account.getAccountName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue