Setting up an HP SIM server 5.x on a Linux-based Serviceguard Cluster 444847-003, March 2009

26
result=$(vgchange
--
$op $tag $vg 2>&1)
case $result in
*Volume*group*successfully*changed*)
echo "$op was successful on vg $vg."
;;
*Volume*group*does*not*support*tags*)
echo "VG $vg does not support tags."
;;
*)
echo "vgchange
--
$op error:"
echo $result
;;
esac
else
echo "vg_tag: illegal operation: $op."
fi
}
# This function will check to see if a VG is activated on another node.
# It will do this by using LVM2 'tags'.
function activation_check
{
typeset
-
i ok_to_activate=0
typeset
-
i retva
l=0
vg=$1
hostid=""
cl_hostid=""
disk=""
# lvm_sanity_check will verify that we are using both lvm2 and lvm2
# metadata.
lvm_sanity_check $vg
retval=$?
if (( retval == 1 )); then
# using lvm1.
return 0
fi
#get the hostids in the vg and make sure there is only one tag.
#abort if multiple tags.
hostid=$(vgs
--
noheadings
-
o +tags $vg
\
| awk '{print $8}')
#Abort if multiple.
#Note: This is an abnormal condition and ca
nnot be determined
# why this condition exists. A person had to have added
# multiple tags for some reason and as a result Serviceguard
# cannot assume why and thus cannot bring the package up
# or remove the tags automa
tically. That has to be done by
# a real person.
if [[ "$hostid" = *,* ]]; then
printf "ERROR: Volume Group $vg has multiple tags
\
"($hostid)
\
"
defined.
\
n"
printf " There cannot be more than one tag.
\
n"
printf "
Remove the tags using the command(s):
\
n"
OLDIFS=$IFS
IFS=","
for i in ${hostid}; do
printf "
\
"vgchange
--
deltag $i $vg
\
".
\
n"
done