source /usr/lib/wow/wowlib
#
# xen scores per vm and node
#
echo "$XEN_VMS" | while read vm vmmigrate vmpath scores
do
        if [ -n "${vm%%\#*}" ]; then # neither an empty line nor a comemnt line (# is first char)
		mySCORE=$(echo $scores|tr ':' ' ')
		for node in $ALLNODES
		do
			nSCORE=$(firstof_var mySCORE); shift_var mySCORE
			wow $WOWCONSTCREATE UUID=loc_${vm}_on_${node} RESOURCE=rsc_xen_$vm $wowxml/03-constraint_canvas.xml  </dev/null
			wow $WOWCONSTMODIFY CONSTID=loc_${vm}_on_${node} UUID=prefered_loc_${vm}_on_${node} SCORE=$nSCORE $wowxml/03-constraint_rule.xml  </dev/null
			wow $WOWCONSTMODIFY RULEID=prefered_loc_${vm}_on_${node} UUID=prefered_loc_${vm}_on_${node}_name ATTRIBUTE="#uname" OPERATOR="eq" VALUE="${node}" $wowxml/03-constraint_rule_expression.xml  </dev/null
		done
        fi
done

#
# start xen vms after the needed ocfs2
#

echo "$XEN_VMS" | while read vm vmmigrate vmpath scores
do
        if [ -n "${vm%%\#*}" ]; then # neither an empty line nor a comemnt line (# is first char)
		echo "$FS_FILESYSTEMS" | while read dev dir fsid fstype
		do
			if [ -n "${dev%%\#*}" ]; then # neither an empty line nor a comemnt line (# is first char)
				wow $WOWCONSTCREATE  \
				UUID=ord_${vm}_${fsid} \
				TYPE=after \
				FROM=rsc_xen_$vm \
                                TO=clone_fs_${fsid} \
				SYMM=true \
				$wowxml/03-order_canvas.xml </dev/null
			fi
		done

        fi
done
