* @return Return true if the provided ResourceCapability meets
* Quantitative requirements
*/
boolean meetsQuantitativeRequirements(final ProvisionRequest provisionRequest) {
ServiceElement sElem = provisionRequest.getServiceElement();
ServiceLevelAgreements sla = sElem.getServiceLevelAgreements();
boolean provisionable = true;
String[] systemThresholdIDs = sla.getSystemRequirements().getSystemThresholdIDs();
if(systemThresholdIDs.length == 0)
return (true);
MeasuredResource[] measured = resourceCapability.getMeasuredResources();
/*
* If the number of MeasuredCapabilities is less then what we are asking
* for there is no reason to continue
*/
if(measured == null || measured.length < systemThresholdIDs.length) {
StringBuilder message = new StringBuilder();
message.append(getName()).append(" ");
if(measured==null) {
message.append("has a [null] MeasuredCapability instance, ServiceBean [");
message.append(LoggingUtil.getLoggingName(sElem)).append("] ");
message.append("has a requirement to test ").append(systemThresholdIDs.length);
} else {
message.append("only has [").append(measured.length).append("] MeasuredCapability instances, ");
message.append("ServiceBean [").append(LoggingUtil.getLoggingName(sElem)).append("] ");
message.append("has a requirement to test [").append(systemThresholdIDs.length).append("]");
}
provisionRequest.addFailureReason(message.toString());
logger.debug(message.toString());
return (false);
}
/*
* Check each of the MeasuredResource objects
*/
for (String systemThresholdID : systemThresholdIDs) {
boolean supported = false;
ThresholdValues systemThreshold = sla.getSystemRequirements().getSystemThresholdValue(systemThresholdID);
if (systemThresholdID.equals(SystemRequirements.SYSTEM)) {
double systemUtilization = systemThreshold.getHighThreshold();
if (systemUtilization < resourceCapability.getUtilization()) {
String failureReason =
String.format("%s cannot meet system utilization requirement. Desired: %f, Actual: %f",