source /usr/lib/wow/wowlib
echo "TODO: Check constraints"


#
# sunipmi locations - never run stonith for a node on itself
#
for node in $ALLNODES
do
	wow $WOWCONSTCREATE UUID=loc_sunipmi_${node}_never_run_on_${node} RESOURCE=rsc_stonith_sunipmi_${node} $wowxml/03-constraint_canvas.xml
	wow $WOWCONSTMODIFY CONSTID=loc_sunipmi_${node}_never_run_on_${node} UUID=prefered_loc_sunipmi_${node}_never_run_on_${node} SCORE=-INFINITY $wowxml/03-constraint_rule.xml
	wow $WOWCONSTMODIFY RULEID=prefered_loc_sunipmi_${node}_never_run_on_${node} UUID=prefered_loc_sunipmi_${node}_never_run_on_${node}_name ATTRIBUTE="#uname" OPERATOR="eq" VALUE="${node}" $wowxml/03-constraint_rule_expression.xml
done

#
# sunipmi locations - prefer to run on THE OTHER node
#
for node in $ALLNODES
do
	wow $WOWCONSTCREATE UUID=loc_sunipmi_${node}_other_node RESOURCE=rsc_stonith_sunipmi_${node} $wowxml/03-constraint_canvas.xml
	wow $WOWCONSTMODIFY CONSTID=loc_sunipmi_${node}_other_node UUID=prefered_loc_sunipmi_${node}_other_node SCORE=1000 $wowxml/03-constraint_rule.xml
	wow $WOWCONSTMODIFY RULEID=prefered_loc_sunipmi_${node}_other_node UUID=prefered_loc_sunipmi_${node}_other_node_name ATTRIBUTE="#uname" OPERATOR="ne" VALUE="${node}" $wowxml/03-constraint_rule_expression.xml
done

