@@ -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