Hp Matrix Operating Environment Software Manuel d'utilisateur Page 199

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 209
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 198
The order in which the elements are declared is not important, except for the package name. If
declared, the package name must be the first element in the rule file.
Example: Rule to verify server memory criteria
package com.hp.hpio.controller.policy;
import java.util.List;
import java.lang.Integer;
import com.hp._2007.ess.sw.model.infrastructureutilityschema.LogicalServer;
import com.hp._2007.ess.sw.model.infrastructureutilityschema.ComputeServer;
import com.hp.hpio.controller.wrapper.LogicalServerWrapper;
import com.hp.hpio.common.messages.HPIOBundleKey;
import com.hp.hpio.common.messages.HPIOMessage;
dialect "java" // Since we are using Java syntax with drools
/*
* INIT should be the first rule in a drl file which inserts service
* entity, resource list and result map into working memory by reading
* from PolicyExecutionVO passed to rule engine.
*
*/
/* DO NOT MODIFY */
rule "INIT"
salience 1000
when
pVO : PolicyExecutionVO();
then
insert(pVO.getAllocationEntry().getServiceEntity());
insert(pVO.getResultMap());
insert(pVO.getResourceList());
end
/*
* Rule to check memory criteria for a given service entity
* (LogicalServer) compared to list of physical resources available
* (ComputeServer)
*
*/
rule "MemorySizeCriteria"
when
$pVO : PolicyExecutionVO( );
$resLst : List();
$logicalServer : LogicalServer();
$computeServer : ComputeServer() from $resLst;
eval(memorySizeCriteria($logicalServer, $computeServer, $pVO));
then
$pVO.match($computeServer, HPIOMessage.get(HPIOBundleKey.ALLOCATION_CRITERIA_MEMORY));
end
function boolean memorySizeCriteria(
LogicalServer logicalServer,
ComputeServer computeServer,
PolicyExecutionVO pVO) {
pVO.doesNotMatch(computeServer,HPIOMessage.get(HPIOBundleKey.ALLOCATION_CRITERIA_MEMORY));
/* -------------- CUSTOM LOGIC ----------------------*/
Integer logicalMemorySizeMB = LogicalServerWrapper.getMemorySizeMi(logicalServer);
if (computeServer.getMemoryConsumedMB() == null) {
computeServer.setMemoryConsumedMB(0);
}
Integer resourceMemorySizeMB = computeServer.getMemorySizeMB() - computeServer.getMemoryConsumedMB();
if(logicalMemorySizeMB.doubleValue() <= resourceMemorySizeMB.doubleValue()){
return true;
}else{
return false;
}
/* -------------- CUSTOM LOGIC ----------------------*/
Customizing existing rules
The advantage of providing a rules based allocation fitting process is the rule customization and
business logic changes it allows, through modifying the CUSTOM LOGIC portion of the code.
Overview 199
Vue de la page 198
1 2 ... 194 195 196 197 198 199 200 201 202 203 204 ... 208 209

Commentaires sur ces manuels

Pas de commentaire