Skip to content

Commit 2f309b5

Browse files
Merge remote-tracking branch 'origin/4.18'
2 parents 62fa45a + 44024a8 commit 2f309b5

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

.github/workflows/ui.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ jobs:
4747
run: |
4848
cd ui
4949
sudo npm install -g @vue/cli npm-check-updates
50-
rm -f package-lock.json
5150
npm install
5251
npm run build
5352
npm run lint

engine/schema/src/main/java/org/apache/cloudstack/reservation/dao/ReservationDaoImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public long getAccountReservation(Long accountId, Resource.ResourceType resource
6363
@Override
6464
public long getDomainReservation(Long domainId, Resource.ResourceType resourceType) {
6565
long total = 0;
66-
SearchCriteria<ReservationVO> sc = listAccountAndTypeSearch.create();
66+
SearchCriteria<ReservationVO> sc = listDomainAndTypeSearch.create();
6767
sc.setParameters(DOMAIN_ID, domainId);
6868
sc.setParameters(RESOURCE_TYPE, resourceType);
6969
List<ReservationVO> reservations = listBy(sc);

server/src/main/java/com/cloud/resourcelimit/ResourceLimitManagerImpl.java

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,25 @@ private void checkDomainResourceLimit(final Account account, final Project proje
433433
long currentDomainResourceCount = _resourceCountDao.getResourceCount(domainId, ResourceOwnerType.Domain, type);
434434
long currentResourceReservation = reservationDao.getDomainReservation(domainId, type);
435435
long requestedDomainResourceCount = currentDomainResourceCount + currentResourceReservation + numResources;
436-
String messageSuffix = " domain resource limits of Type '" + type + "'" + " for Domain Id = " + domainId + " is exceeded: Domain Resource Limit = " + toHumanReadableSize(domainResourceLimit)
437-
+ ", Current Domain Resource Amount = " + toHumanReadableSize(currentDomainResourceCount) + ", Requested Resource Amount = " + toHumanReadableSize(numResources) + ".";
436+
437+
String convDomainResourceLimit = String.valueOf(domainResourceLimit);
438+
String convCurrentDomainResourceCount = String.valueOf(currentDomainResourceCount);
439+
String convCurrentResourceReservation = String.valueOf(currentResourceReservation);
440+
String convNumResources = String.valueOf(numResources);
441+
442+
if (type == ResourceType.secondary_storage || type == ResourceType.primary_storage){
443+
convDomainResourceLimit = toHumanReadableSize(domainResourceLimit);
444+
convCurrentDomainResourceCount = toHumanReadableSize(currentDomainResourceCount);
445+
convCurrentResourceReservation = toHumanReadableSize(currentResourceReservation);
446+
convNumResources = toHumanReadableSize(numResources);
447+
}
448+
449+
String messageSuffix = String.format(
450+
" domain resource limits of Type '%s' for Domain Id = %s is exceeded: Domain Resource Limit = %s, " +
451+
"Current Domain Resource Amount = %s, Current Resource Reservation = %s, Requested Resource Amount = %s.",
452+
type, domainId, convDomainResourceLimit,
453+
convCurrentDomainResourceCount, convCurrentResourceReservation, convNumResources
454+
);
438455

439456
if (s_logger.isDebugEnabled()) {
440457
s_logger.debug("Checking if" + messageSuffix);
@@ -460,17 +477,22 @@ private void checkAccountResourceLimit(final Account account, final Project proj
460477

461478
String convertedAccountResourceLimit = String.valueOf(accountResourceLimit);
462479
String convertedCurrentResourceCount = String.valueOf(currentResourceCount);
480+
String convertedCurrentResourceReservation = String.valueOf(currentResourceReservation);
463481
String convertedNumResources = String.valueOf(numResources);
464482

465483
if (type == ResourceType.secondary_storage || type == ResourceType.primary_storage){
466484
convertedAccountResourceLimit = toHumanReadableSize(accountResourceLimit);
467485
convertedCurrentResourceCount = toHumanReadableSize(currentResourceCount);
486+
convertedCurrentResourceReservation = toHumanReadableSize(currentResourceReservation);
468487
convertedNumResources = toHumanReadableSize(numResources);
469488
}
470489

471-
String messageSuffix = " amount of resources of Type = '" + type + "' for " + (project == null ? "Account Name = " + account.getAccountName() : "Project Name = " + project.getName())
472-
+ " in Domain Id = " + account.getDomainId() + " is exceeded: Account Resource Limit = " + convertedAccountResourceLimit + ", Current Account Resource Amount = " + convertedCurrentResourceCount
473-
+ ", Requested Resource Amount = " + convertedNumResources + ".";
490+
String messageSuffix = String.format(
491+
" amount of resources of Type = '%s' for %s in Domain Id = %s is exceeded: " +
492+
"Account Resource Limit = %s, Current Account Resource Amount = %s, Current Account Resource Reservation = %s, Requested Resource Amount = %s.",
493+
type, (project == null ? "Account Name = " + account.getAccountName() : "Project Name = " + project.getName()), account.getDomainId(),
494+
convertedAccountResourceLimit, convertedCurrentResourceCount, convertedCurrentResourceReservation, convertedNumResources
495+
);
474496

475497
if (s_logger.isDebugEnabled()) {
476498
s_logger.debug("Checking if" + messageSuffix);

0 commit comments

Comments
 (0)