Technical white paper Migrating packages from legacy to modular style Table of contents Introduction Intended audience Related documents Terms and definitions 3 3 3 3 Modular packages 4 Expected usage of modular packages New Serviceguard Installations Existing Serviceguard installations Package Environment Variables 4 4 4 5 Package migration Overview Package profiles 5 5 5 Migration utility Input parameters Checklist for migrating a legacy package Serviceguard control script parameters Unsupported
Migrating a toolkit package without any dependencies 24 Migrating a toolkit package with CFS mount point and disk group dependencies 25 Migration of the toolkit package and consolidation of its CFS mount point and disk group dependencies 27 Migration or consolidation of legacy CFS mount point and disk group packages 1:1 Migration of a CFS package Consolidation of multiple CFS packages 28 28 30 Troubleshooting 31 Limitations 32 Appendix A 32 Summary 34 For more information 34
Introduction Modular packages provide a new interface for configuring Serviceguard packages. They modularize both package configuration files and the control script, allowing easier integration and validation of user-defined functions and parameters. This document describes how to migrate current (legacy) packages to the new modular package configuration. For more information, see the latest edition of the Managing Serviceguard manual at docs.hp.
Modular packages Serviceguard A.11.18 introduces a new style of package which differs from those used in earlier releases. The benefits of a modular package are: • Simplified package configuration – All configuration data for the package is now in the package configuration file. Previously, configuration data was included in both the configuration file and in the package control script.
Package Environment Variables You can add variables to the package using PEVs. PEVs allow attributes to be added to the modular package configuration file. cmviewcl’s -f line displays the packages’ PEVs and their value. PEVs are passed as environment variables to any external scripts that you add to the package. Define these attributes in the package configuration file using the prefix “PEV_” (uppercase with an underscore as shown).
The following packages must be manually migrated: Profile Description Package with non-Serviceguard-generated control script A package whose control script was not control script generated using the cmmakepkg -s command. (The migration tool supports all Serviceguard-generated versions created after 11.09). Multi-node and system Multi-node packages A package that runs on more than one node at the same time.
Migration utility The cmmigratepkg command automates the migration of a legacy package to a modular package. It creates a package configuration (ASCII) file for a modular package with the legacy package’s information. The syntax is as follows: cmmigratepkg -p [-x ] [-e] -o The package must be a configured legacy package. It can be on-line or off-line.
Checklist for migrating a legacy package Check legacy packages for the following to determine how to migrate the package: 1. 2. Package parameters that are not supported in 11.18 o See the Unsupported Package Parameters table. Any of the following in the package control script: o Non-Serviceguard parameters: i. If any non-Serviceguard parameters are defined, note the parameter names ii.
The following are the Serviceguard parameters in the legacy control script: Serviceguard control script parameters Parameter Name CONCURRENT_FSCK_OPERATIONS CONCURRENT_MOUNT_AND_UMOUNT_OPERATIONS CONCURRENT_VGCHANGE_OPERATIONS CVM_ACTIVATION_CMD CVM_DG DEACTIVATION_RETRY_COUNT DEFERRED_RESOURCE_NAME DTC_NAME LV FS FS_MOUNT_OPT FS_UMOUNT_OPT FS_FSCK_OPT FS_TYPE FS_MOUNT_RETRY_COUNT FS_UMOUNT_COUNT IP SUBNET SERVICE_NAME SERVICE_CMD SERVICE_RESTART VG VGCHANGE VXVM_DG VXVOL KILL_PROCESSES_ACCESSING_RAW_DEVICE
Serviceguard control script supported functions activate_disk_group activate_volume_group add_ip_address check_and_mount check_dg check_vxvm_vol_available deactivate_disk_group deactivate_volume_group disown_dtc freeup_busy_mountpoint_and_mount_fs get_ownership_dtc halt_services remove_ip_address retry_print start_resources start_services umount_fs verify_ha_nfs verify_physical_data_replication wait_for_cvm_dg_vols_enabled stop_resources ps_tree show_users disown_dtc dg_fuser test_return activation_check ch
If the control script’s customer-defined section calls any of the following functions, the external script needs to be edited to update the names as follows: Table 1. Replaced control script functions Function Replacement ps_tree sg_ps_tree show_users sg_show_users Table 2.
successor_halt_timeout=no_timeout script_log_file=/etc/cmcluster/pkg/pkg-simple/pkg-simple.log node:sandy|name=sandy node:sandy|status=down node:sandy|switching=enabled node:sandy|last_run_time=0 node:sandy|last_halt_time=0 node:sandy|available=yes node:sandy|type=Primary node:sandy|order=1 node:krabs|name=krabs node:krabs|status=down node:krabs|switching=enabled node:krabs|last_run_time=0 node:krabs|last_halt_time=0 node:krabs|available=yes node:krabs|type=Alternate node:krabs|order=2 subnet:192.42.2.
Go to the directory where the package ASCII and control scripts are stored. Run cmmigratepkg on the package: $cd /etc/cmcluster/pkg/pkg-simple $cmmigratepkg -p pkg-simple -o pkg-simple.conf Examine the output: $cat pkg-simple.
failover_policy CONFIGURED_NODE failback_policy MANUAL local_lan_failover_allowed YES node_name sandy node_name krabs operation_sequence $SGCONF/scripts/sg/external_pre.sh operation_sequence $SGCONF/scripts/sg/volume_group.sh operation_sequence $SGCONF/scripts/sg/filesystem.sh operation_sequence $SGCONF/scripts/sg/package_ip.sh operation_sequence $SGCONF/scripts/sg/external.sh operation_sequence $SGCONF/scripts/sg/service.sh service_name pkg-simple_srv_1 service_cmd "/usr/bin/X11/xclock -display 15.1.
usivewrite" deactivation_retry_count 2 kill_processes_accessing_raw_devices vxvol NO "vxvol -g \$DiskGroup startall" fs_umount_retry_count 1 fs_mount_retry_count 0 concurrent_vgchange_operations 1 concurrent_fsck_operations 1 concurrent_mount_and_umount_operations script_log_file 1 /var/opt/sgtest/tmp/cmcluster/pkg- simple/pkg-simple.log Halt the package. $cmhaltpkg pkg-simple Check the configuration of the new package. $cmcheckconf -P pkg-simple.
Migrating a package with non-Serviceguard parameters in the control script If the package includes non-Serviceguard control-script parameters that are not defined in the Customer-defined functions section, or you want to convert these non-Serviceguard parameters to PEVs, use the following steps: 1. Run the cmmigratepkg command with the options for external script and generate PEV. $cmmigratepkg -p pkgA -x /etc/cmcluster/pkg/pkgA/myexternal.sh -e -o pkgA.conf 2. 3. 4. 5. 6. 7. 8.
halt_script /etc/cmcluster/pkg-nu-2/control.sh node_name krabs node_name sandy service_name pkg-nu-2_srv_1 service_fail_fast_enabled NO service_halt_timeout 5 service_name pkg-nu-2_srv_2 service_fail_fast_enabled NO service_halt_timeout 5 subnet 192.42.2.
2. Modify a copy of the package control script.
LV /dev/vglock2/lvol4 FS /var/opt/tmp/mnt/dev/vglock2/lvol4 FS_TYPE "" FS_MOUNT_OPT "" FS_UMOUNT_OPT "" FS_FSCK_OPT "" LV /dev/vglock2/lvol5 FS /var/opt/tmp/mnt/dev/vglock2/lvol5 FS_TYPE "" FS_MOUNT_OPT "" FS_UMOUNT_OPT "" FS_FSCK_OPT "" LV /dev/vglock2/lvol6 FS /var/opt/tmp/mnt/dev/vglock2/lvol6 FS_TYPE "" FS_MOUNT_OPT "" FS_UMOUNT_OPT "" FS_FSCK_OPT "" LV /dev/vglock2/lvol7 FS /var/opt/sgtest/tmp/mnt/dev/vglock2/lvol7 FS_TYPE "" FS_MOUNT_OPT "" FS_UMOUNT_OPT "" FS_FSCK_OPT "" LV /dev/vglock2/lvol8 FS /var
IP 192.42.2.19 IP_SUBNET 3ffe:1000:0:2a02:: IP 3ffe:1000:0:2a02::11/64 SERVICE_NAME pkg-nu-2_srv_1 SERVICE_CMD "/etc/cmcluster/pkg-nu-2/service.pl >> /etc/cmcluster/pkg-nu2/pkg-nu-2_srv_1.log 2>&1" SERVICE_RESTART 2 SERVICE_NAME pkg-nu-2_srv_2 SERVICE_CMD "/etc/cmcluster/pkg-nu-2/simple >> /etc/cmcluster/pkg-nu2/pkg-nu-2_srv_2.log 2>&1" SERVICE_RESTART unlimited 3. 4.
SERVICE_RESTART 2 SERVICE_FAIL_FAST_ENABLED NO SERVICE_HALT_TIMEOUT operation_sequence operation_sequence operation_sequence operation_sequence operation_sequence operation_sequence $SGCONF/scripts/sg/external_pre.sh $SGCONF/scripts/sg/volume_group.sh $SGCONF/scripts/sg/filesystem.sh $SGCONF/scripts/sg/package_ip.sh $SGCONF/scripts/sg/external.sh $SGCONF/scripts/sg/service.
FS_FSCK_OPT "" LV /dev/vglock2/lvol5 FS /var/opt/tmp/mnt/dev/vglock2/lvol5 FS_TYPE "" FS_MOUNT_OPT "" FS_UMOUNT_OPT "" FS_FSCK_OPT "" LV /dev/vglock2/lvol6 FS /var/opt/tmp/mnt/dev/vglock2/lvol6 FS_TYPE "" FS_MOUNT_OPT "" FS_UMOUNT_OPT "" FS_FSCK_OPT "" LV /dev/vglock2/lvol7 FS /var/opt/tmp/mnt/dev/vglock2/lvol7 FS_TYPE "" FS_MOUNT_OPT "" FS_UMOUNT_OPT "" FS_FSCK_OPT "" LV /dev/vglock2/lvol8 FS /var/opt/tmp/mnt/dev/vglock2/lvol8 FS_TYPE "" FS_MOUNT_OPT "" FS_UMOUNT_OPT "" FS_FSCK_OPT "" LV /dev/vglock2/lvol9
5. 6. 7. Run cmcheckconf on the new package ASCII file and resolve if there are any errors. Halt the Package. Apply the new package ASCII file. Migration utility for Serviceguard toolkits and CFS packages cmeasymigrate creates modular package configuration file for legacy style toolkit packages and/or consolidate multiple CFS packages into a single modular package configuration file. This utility is supported only in HP-UX.
Input options -t Displays a preview of what the command does. legacy_package_name Name of an existing toolkit legacy package to migrate. If the specified toolkit package has any dependent packages, then modular configuration files are generated only for dependent CFS mount point and/or disk group, and toolkit packages. -c cfs_package_names Specify the legacy and/or modular CFS package names to be consolidated. Supports only disk group and mount point packages.
Migrating a toolkit package with CFS mount point and disk group dependencies Figure 1 below depicts a toolkit legacy package which is dependent on a legacy CFS mount point package SG-CFS-MP-1 which in turn depends on SG-CFS-DG-1. Figure 1: Legacy package configuration before migration • Run cmeasymigrate and generate the modular configuration files for the toolkit package and dependent packages SG-CFS-MP-1 and SG-CFS-DG-1.
Figure 2 below shows the modular package configuration in a toolkit environment where all legacy packages (Toolkit_pkg, SG-CFS-MP-1 and SG-CFS-DG-1) have been migrated to modular style packaging. Figure 2: Modular package configuration after migration Note: 1. If the consolidation option -c is not used, a modular MNP will be created for each CFS Mount point and Disk group package. 2.
Migration of the toolkit package and consolidation of its CFS mount point and disk group dependencies Figure 3: Legacy package configuration before migration • Run cmeasymigrate -c SG-CFS-MP-1:SG-CFS-DG-1 and generate modular configuration file for toolkit package and an consolidated modular package ASCII file for SG-CFS-MP-1 and SG-CFS-DG-1. • Run cmhaltpkg and halt the packages in dependency order (Toolkit_pkg, SG-CFS-MP-1 and SG-CFS-DG-1).
Figure 4: Modular package configuration after migration Note: In case you want to change the package name of consolidated modular CFS package, you have to make changes to the package_name parameter in the CFS consolidated package file, and also change the “dependency_condition” parameter in the package(s) that are dependent on this CFS modular package.
• Run cmdeleteconf and delete the packages in dependency order(SG-CFS-MP-1 and SG-CFS-DG-1). • Run cmapplyconf on generated modular configuration file in dependency order(SG-CFS-DG-1 and SG-CFS-MP-1) • Run cmrunpkg and bring up the packages. Figure 6: Modular package configuration after migration Note: Since it is 1:1 migration, the modular CFS package name would be same as legacy CFS package name.
Consolidation of multiple CFS packages Figure 7: Legacy package configuration before migration • Run cmeasymigrate -c SG-CFS-MP-1:SG-CFS-DG-1:SG-CFS-MP-2:SG-CFS-DG-2 and generate the consolidated modular CFS configuration file. • Run cmhaltpkg and halt the packages that might be dependent on these legacy CFS packages. • Run cmdeleteconf and delete the packages. • Halt & delete the legacy CFS packages. • Run cmcheckconf on the modular CFS consolidated configuration file.
Figure 8: Modular package configuration after migration Troubleshooting • If you use cmeasymigrate only to migrate or consolidate CFS MP & DG packages it will display some warning messages telling that you have to change the dependency condition in the application packages which are dependent on consolidated CFS packages. Display of these warnings doesn’t mean that the command has failed.
Limitations • cmeasymigrate is not supported via Serviceguard Manager. • Migration/Consolidation of CFS Checkpoint and snapshot packages is not supported with this tool.
operation_sequence $SGCONF/scripts/sg/filesystem.sh \ operation_sequence $SGCONF/scripts/sg/package_ip.sh \ operation_sequence $SGCONF/scripts/sg/external.sh \ operation_sequence $SGCONF/scripts/sg/service.sh \ ' > $newpkg The following script automates some of the changes needed to modify the package control script.
# Put all parameters in separate linesS cat ./tmp/nu-pkg.cntl.1 | tr '; ' '\012' > ./tmp/nu-pkg.cntl.2 # remove extra quotation marks cat ./tmp/nu-pkg.cntl.