Setting up HP SIM 5.x on an HP-UX Serviceguard Cluster (448492-002, February 2008)

24
function lvm_sanity_check
{
typeset vg=$1
# If lvm is lvm1 then just return.
if (( LVM_VER == 1 )); then
return 1
fi
# Using lvm2.
return 0
}
# Function to add/remove tags for vgs.
fu
nction vg_tag
{
typeset op=$1
typeset vg=$2
typeset tag=$3
typeset result
if [[ x$op = xaddtag ]] || [[ x$op = xdeltag ]]; then
echo "Attempting to $op to vg $vg..."
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 anoth
er node.
# It will do this by using LVM2 'tags'.
function activation_check
{
typeset
-
i ok_to_activate=0
typeset
-
i retval=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
--
n
oheadings
-
o +tags $vg
\
| awk '{print $8}')
#Abort if multiple.