Implementación de reglas – HP Software HP Matrix Operating Environment Manual del usuario

Página 234

Advertising
background image

when

$pVO : PolicyExecutionVO( );
$resLst : List();

/* --------------- CUSTOM LOGIC ------------------ */
// Get service entity and resource objects.
$logicalSubnet : LogicalSubnet();
$subnet : Subnet() from $resLst;

// call new user defined function with required arguments
// function has to return true in case of success or false
// in case of failure.
eval(customRule1($logicalSubnet, $subnet, $pVO));
/* --------------- CUSTOM LOGIC ------------------ */

then

/* --------------- CUSTOM LOGIC ------------------ */
// Since this is a custom rule/criteria construct HPIO message
// using ALLOCATION_CRITERIA_CUSTOM bundle key and providing
// allocation failure message (string) to be displayed. In case
// this rule fails. NOTE same information should be used while
// calling doesNotMatch in the custom function below.

$pVO.match($subnet, HPIOMessage.get(HPIOBundleKey.ALLOCATION_CRITERIA_CUSTOM, “Failure message”));
/* --------------- CUSTOM LOGIC ------------------ */
end

/*
* The function is responsible to do criteria check and return
* true/false based on the requested resource and the available
* resources.
* Initialize result map with doesNotMatch to start with, if this
* function returns success (true) then rule result map will be
* changed to match.
*
*/
function boolean customRule1(
LogicalSubnet logicalSubnet,
Subnet subnet,
PolicyExecutionVO pVO) {

// Custom message.
pVO.doesNotMatch(subnet, HPIOMessage.get(HPIOBundleKey.ALLOCATION_CRITERIA_CUSTOM, “Failure message”));

boolean match=true;
/* -------------- CUSTOM LOGIC ----------------------*/

/* -------------- CUSTOM LOGIC ----------------------*/
return match;

}

Implementación de reglas

1.

Asegúrese de que el archivo de reglas es válido (utilizando la herramienta iopolicyassist).

2.

Copie el archivo de reglas validado en ..\Program Files\HP\Matrix
infrastructure. orchestration\conf\policy

.

3.

Siempre que sea aplicable, actualice la información de enlaces de <policy-rule-file>
en el archivo policy.xml modificando o añadiendo el archivo de reglas que acaba de
definir.

<policy enabled="false" name="SubnetPolicyCheck.applyFitting">
<policy-rule-file>
SubnetCheck.drl,
newrulefile.drl
</policy-rule-file>
<policy-class-name>policy-class-name</policy-class-name>
</policy>

4.

Realice una de las operaciones siguientes:

Para activar cualquier directiva, cambie a true el indicador de activación
correspondiente en el archivo de directiva.

Para desactivar cualquier directiva, cambie a false el indicador de activación
correspondiente en el archivo de directiva.

5.

Reinicie el servicio de Windows de Infrastructure Orchestration para que los cambios tengan
efecto.

234 Proceso de asignación personalizable

Advertising