Operating System - HP-UX
1748000 Members
4758 Online
108757 Solutions
New Discussion юеВ

VG[@] in legacy package - what is this called in a modular package?

 
SOLVED
Go to solution
Danny Petterson - DK
Trusted Contributor

VG[@] in legacy package - what is this called in a modular package?

He Gurus.

Have a question regarding modular clusterpackages.

In some old legacy packages, we have some SERVICE cmd's called with an variable array, including all the volumegroups for the package - this array is called VG[@], and is defined in the cntl-file.

However, if I want to do something similar in a modular package, what is the variable name? I have tried with the same thing, in lowercase (vg[@]) but it does now work? And I can't find any documentation about this, but it might just be me.

Thanks in advance for any help provided.

Kind regards
Danny Petterson
6 REPLIES 6
Stephen Doud
Honored Contributor

Re: VG[@] in legacy package - what is this called in a modular package?

The modular package configuration template file contains this:

# "vg" is used to specify which volume groups are used by this package.
#
# volume groups
#
# Specify which volume groups are used by this package that do not yet
# have file systems mounted on them. Copy one of the example vg configuration
# line and change the name of the volume group. Add additional VG
# specifications for additional volume groups.
#
# For example, if this package uses your volume groups vg01 and vg02, enter:
# vg vg01
# vg vg02
#
# The volume group activation method is defined above. Use the parameters
# in the filesystem module (fs_name, etc.) to specify the filesystems
# associated with these volume groups.
#
# Legal values for vg: /^[0-9A-Za-z\/][0-9A-Za-z_.\/\-]*[0-9A-Za-z]$/, /^[0-9A-Za-z]$/.

#vg
Danny Petterson - DK
Trusted Contributor

Re: VG[@] in legacy package - what is this called in a modular package?

Hi!

Thanks a lot for your reply.

Unfortunately it does not help - I already reviewed the information in the ascii-configuration files for the modular package, and as described in the section you have copied from such an ascii-file, all volume-groups are defined by "vg", where they, in a legacy package, would be definned with "VG[0]", "VG[1]" etc, which makes it possible to send the entire array (VG[@]) to script in the cntl-file.

So we are kind of back to square one - how do I call an external script/service_cmd with an array containing all volume groups defined in the package (without hardcoding them myself)?

Again, thanks a lot for your time.

Kind regards
Danny

melvyn burnard
Honored Contributor

Re: VG[@] in legacy package - what is this called in a modular package?

try using cmmigratepkg to create a modular configuration file from your existing legacy conf file.
This may give you the answer.
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Danny Petterson - DK
Trusted Contributor

Re: VG[@] in legacy package - what is this called in a modular package?

Excelent idea - thanks - I will get back with the result.
Matti_Kurkela
Honored Contributor
Solution

Re: VG[@] in legacy package - what is this called in a modular package?

You may have to wrap your old SERVICE command to a script that first reads some Serviceguard utility functions, then uses the "sg_source_pkg_env" function.

This gives you a big pile of environment variables, all named with the "SG_" prefix.

After the above-mentioned command, I think it should be possible to use "SG_VG[@]" as equivalent to the old "VG[@]".

The example external_script in the "Managing Serviceguard" manual contains a robust-looking strategy for reading the environment variables:

--------
#!/bin/sh
# Source utility functions.
if [[ -z $SG_UTILS ]]
then
. /etc/cmcluster.conf
SG_UTILS=$SGCONF/scripts/mscripts/utils.sh
fi

if [[ -f ${SG_UTILS} ]]; then
. ${SG_UTILS}
if (( $? != 0 ))
then
echo "ERROR: Unable to source package utility functions file: ${SG_UTILS}"
exit 1
fi
else
echo "ERROR: Unable to find package utility functions file: ${SG_UTILS}"
exit 1
fi

# Get the environment for this package through utility function
# sg_source_pkg_env().
sg_source_pkg_env $*



---------

To see all the variables available, simply run:

cmgetpkgenv

MK
MK
Danny Petterson - DK
Trusted Contributor

Re: VG[@] in legacy package - what is this called in a modular package?

Ah - thanks - that did the trick, the sourcing in of cmcluster.conf and utils.sh, then calling the function, exactly as in an external script.

Thanks a lot, that was great.

Lot of greetings from
Danny