Customizing existing rules, Writing a new rule file, Customizing existing rules writing a new rule file – HP Matrix Operating Environment Software User Manual
Page 50
![background image](/manuals/393318/50/background.png)
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 that you can customize the existing
rules to change the business logic by modifying the CUSTOM LOGIC portion of the code. You can modify
or delete existing rules, or add new custom rules. Rules are written in Java and the Drools syntax.
Available hooks for customizing:
•
SubnetPolicyCheck.applyFitting
•
AttributeBasedSubnetPolicyCheck.applyFitting
•
SpecifiedSubnetPolicyCheck.applyFitting
•
AutomaticIpAddressPolicyCheck.applyFitting
•
StaticIpAddressPolicyCheck.applyFitting
•
DhcpIpAddressPolicyCheck.applyFitting
•
PhysicalServerPolicyCheck.applyFitting
•
PhysicalBootDiskPolicyCheck.applyFitting
•
NPIVDataDiskPolicyCheck.applyFitting
•
VirtualServerPolicyCheck.applyFitting
•
EsxDiskPolicyCheck.applyFitting
•
HypervDiskPolicyCheck.applyFitting
•
DasDiskPolicyCheck.applyFitting
•
SoftwarePolicyCheck.applyFitting
Writing a new rule file
Open a new drl file in a text editor, add the different sections of a rule file (as shown in
), and add the new rule logic.
•
Package—The name of the package and is always com.hp.hpio.controller.policy.
•
Import—Declares the use of any other Java classes required to write the rule business logic.
•
Rules:
You can define multiple rules in a single rule (.drl) file.
•
•
Each rule contains the business logic that you would like to execute in your rule.
•
The INIT rule is a sample structure that you can duplicate and use as a starting point to define
your own rule.
You can also use tools such as Eclipse
) to write rule
files by including the Drools Eclipse plug-in to the create rule project and including the required Insight
Orchestration libraries to the project. Using Eclipse helps with syntax highlighting and auto code completion.
For more information, see the following documentation:
•
JBoss Rules User Guide at
•
JBoss Rules at
50
Insight Orchestration provisioning and allocation