$! 3PAR_CREATE_VIRTUAL_SNAPSHOTS.COM $! $! Purpose: create virtual snapshots and present the luns to OpenVMS node(s) $! $! Required symbols: $! ssh_username : specify the name of a 3par user which has the role of Super. $! This role is required so that the user has adequate privilege $! to issue the necessary 3par cli commands. $! $! ssh_target : IP or fully qualified name of 3par array. $! $! vvset : VV Volume Set containing names of VV Volumes which will be the $! source of the snapshots. It should contain the name of one or more $! VV Volumes which you desire to create a snapshot of. If the VV $! Volume Set does not exist, it can be created by issuing the 3par cli $! command CREATEVVSET. $! Syntax: createvvset $! Example: $! cli% createvvset vms_mynode_vvset vms_mynode_vv1 vms_mynode_vv2 $! You can also add VV Volumes to a VV Volume Set using this syntax: $! createvvset -add $! Example: $! cli% createvvset -add vms_mynode_vvset vms_mynode_vv3 $! $! snapshot_vvset: VV Volume Set that will contain the name of all snapshot VV $! Volumes. When the procedure creates the snapshots, it will $! add their names to this VV Volume Set. $! $! starting_snapshot_lun : beginning lun of the first snapshot VV Volume. All $! subsequent luns will be incremented by 1. Example. $! If you specify 2000, the first snapshot lun will $! be 2000. On OpenVMS the device will be seen as $! $1$DGA2000. The second snapshot lun will be 2001. $! Its OpenVMS device will be seen as $1$DGA2001. $! The beginning lun is used by the createvlun cli $! command. $! $! host : 3par host name that corresponds to the OpenVMS system. This should be $! defined if the OpenVMS system is a standalone system or you only want $! to present the snapshots to a single OpenVMS cluster member. $! Otherwise this should be defined as: $! $ host = "" $! $! hostset : Name of the hostset. This will typically be defined if you have $! 3par disks presented to multiple nodes in a cluster. It should $! contain the host names of those cluster members where you want $! the luns of the snapshots exported to. Otherwise this should be $! defined as: $! $ hostset = "" $! $! Note: if both host and hostset are defined, the hostset will be used $! $! Keep in mind these limitations when defining the required symbols: $! $! 3par User name < or = 31 characters $! VV Volume Set name < or = 31 characters $! Host name < or = 31 characters $! Host set < or = 27 characters $! UDIDS and LUNS for OpenVMS can range from 0 to 32727. For OpenVMS to see $! a lun, the snapshot vv volume udid must be the same value as the $! lun number specified in the CREATEVLUN cli command. $! Snapshot name < or = 31 characters. Note the command procedure will define $! the snapshot name by appending "_snap" to the Virtual Volume name. $! Virtual Volume name < or = 31 characters but since this procedure appends $! "_snap" to the snapshot name, please make sure the VV names don't exceed $! 26 characters. If you need to rename a VV volume use the cli command $! setvv -name .It is also recommended that you $! use a standardize naming convention so that you can use a wildcard $! command to find all volumes associated with a particular OpenVMS $! standalone system or OpenVMS cluster. Example: $! $! vms_mynode_vv01 $! vms_mynode_vv02 $! $! vmscluster_xxxxxx_vv01 $! vmscluster_xxxxxx_vv02 $! vmscluster_xxxxxx_vv03 $! vmscluster_xxxxxx_vv04 $! $! cli% showvv -cpgalloc vmscluster_parks* $! Id Name Prov Type UsrCPG SnpCPG $! 13351 vmscluster_i64svr_vv01 tpvv base FC_r5 FC_r5 $! 13350 vmscluster_i64svr_vv02 tpvv base FC_r5 FC_r5 $! 13353 vmscluster_i64svr_vv03 tpvv base FC_r5 FC_r5 $! 13352 vmscluster_i64svr_vv04 tpvv base FC_r5 FC_r5 $! 13354 vmscluster_i64svr_vv10 tpvv base FC_r5 FC_r5 $! 13355 vmscluster_i64svr_vv20 tpvv base FC_r5 FC_r5 $! --------------------------------------------------- $! 6 total $! $! $! Other requirements for running this procedure $! $! The OpenVMS account which the procedure is run from must have the $! privileges of OPER,SYSLCK,CMKRNL. These are required to execute $! SYSMAN IO commands. $! $! The OpenVMS account which the procedure is run from should have public key $! authentication configured so that this account can issue 3par cli commands $! using ssh without having to specify a password. Refer to the article $! "OpenVMS - 3PAR, Login to 3PAR CLI with SSH Without Password Query" for $! instructions on how to setup ssh public key authentication $! $! This procedure must be run in batch mode. Example: $! $ submit/noprint/keep/log=SYS$MANAGER:3PAR_CREATE_VIRTUAL_SNAPSHOTS.LOG - $! SYS$MANAGER:3PAR_CREATE_VIRTUAL_SNAPSHOTS.COM/user=system $! $! Note that the ssh command requires the -o "batchmode yes" option when $! run from a batch procedure. Also note that the OpenVMS ssh command is only $! able to issue one 3par cli command at a time. $! $! Other instructions: $! $! Search procedure for string CHANGE ME. This is the point in the logic $! where the required symbols should be defined. $! $! Also note if debugging of the procedure is required, DO NOT enable a $! SET VERIFY command just prior to DEFINE/USER SYS$OUTPUT commands. This $! will adversely affect the logic of the procedure since in many instances a $! zero block file is an indication that a 3par cli command was successful. $! Enabling SET VERIFY will add content to the resulting file causing it to $! no longer be a zero block file. $! $! If you are creating lots of snapshots you may need to add some delay $! time after issuing a CREATESV command to avoid problems. The procedure $! come with a 5 second delay which at sites with busy 3par arrays may need $! to adjust. $! $! High level Overview of steps performed: $! $! Step 1: Required symbols are validated $! Step 2: Confirm 3par storage array has enough space to create the $! snapshots $! Step 3: 3par cli CREATEVVSET command issued to create a VV Set that will $! eventually contain the all snapshot VV Volumes $! Step 4a: Read only snapshots VV volumes are created with a 3par cli $! CREATESV command if OpenVMS device is a nonshadowed disk or the $! master member of a shadowset. $! Step 4b: The 3par cli CREATEVVSET -ADD command is used to add Snapshot VV $! volumes to Snapshot VV Set $! Step 5: The udid of the snaphost VV Volumes are set with a 3par cli $! SETVV -UDID command so they will agree with the desired lun $! numbers presented to the OpenVMS host(s). $! Step 6: The luns are exported to the OpenVMS host(s) with a 3par cli $! CREATEVLUN command $! Step 7: The luns are made available to the OpenVMS host(s) by issuing $! some OpenVMS SYSMAN commands $! Step 8: Enable error checking on the OpenVMS snapshot disks $! $!=============================================================================== $!=============================================================================== $! $! Copyright (C) 2017 by Hewlett Packard Enterprrise Development Company, L.P. $! All right Reserved $! $!=============================================================================== $!=============================================================================== $! $! DISCLAIMER: This procedure is provided on an "AS IS" basis. $! It carries no warranty or guarantee whatsoever. $! The user of this procedure is solely responsible for $! determining whether or not it is appropriate to use this $! procedure or its output. Under certain circumstances, $! Hewlett-Packard may assist customers in making this determination $! in a particular situation. $! $! Any other use of the procedure is NOT SUPPORTED by $! Hewlett-Packard. $! $! Hewlett-Packard does not represent that the information contained $! herein is complete or correct, or that it is sufficient $! to explain the possible uses of this procedure. $! $! This software is furnished under a license and may be used and $! copied only in accordance with the terms of such license and with $! the inclusion of the above copyright notice. This software or $! any other copies thereof may not be provided or otherwise made $! available to any other person. no title to and ownership of the $! software is hereby transferred. $! $! The information in this software is subject to change without $! notice and should not be construed as a commitment by hewlett $! packard enterprise development lp. $! $! Support for this software is not covered under any hpe software $! product support contract, but may be provided under the terms of $! a consulting agreement $! $!============================================================================= $!============================================================================= $! $ DEFINE_REQUIRED_SYMBOLS: $!------------------------- $! set verify $! $! *** CHANGE ME *** $! Replace these symbol definitions with the correct values $! $ ssh_username = "XXXXXXXX" $ ssh_target = "XXXXXXXXXXXXXXXX" $ vvset = "XXXXXX" $ snapshot_vvset = "xxxx_snap_vvset" $ starting_snapshot_lun = 9300 $ host = "facs1" $ hostset = "facs_hostset" $! $! ssh_username = "3partest" $! ssh_target = "192.168.1.10" $! vvset = "vmscluster_parks_vvset" $! snapshot_vvset = "vmscluster_parks_snap_vvset" $! starting_snapshot_lun = 2001 $! host = "" $! hostset = "vmscluster_parks_hostset" $! $! *** End of CHANGE ME section *** $! $ set noverify $ define/user sys$error nl: $ define/user sys$output nl $ set term/width=132 $ say = "write sys$output" $ say "" $ say "....Beginning Step 1..." $ say "Validating required symbols..." $! $ CONFIRM_PROCEDURE_RUN_IN_BATCH_MODE: $!----------------------------------- $ if f$mode() .nes. "BATCH" $ then $ say "%3PAR_CR-F-BADMODE, Procedure must be run as a batch job" $ say " - Procedure aborted and snapshots not created" $ exit $ endif $! $ CONFIRM_OPENVMS_USER_HAS_REQUIRED_PRIVS: $!--------------------------------------- $! $! In order to invoke this command procedure the OpenVMS user must have the $! privileges of OPER,SYSLCK,CMKRNL. These are required to execute SYSMAN IO $! commands. $! $ privs = F$PRIVILEGE("OPER,SYSLCK,CMKRNL") $ if privs .eqs. "FALSE" $ then $ say " " $ say "%3PAR_CR-F-NOPRIV, OpenVMS user lacks privileges to run job" $ say " - Procedure aborted and snapshots not created" $ goto abort_procedure $ endif $! $ CHECK_3PAR_USERNAME_PROVIDED: $!---------------------------- $ ssh_username = f$edit(ssh_username,"COLLAPSE") $ If ssh_username .eqs. "" $ then $ say " " $ say "%3PAR_CR-F-MISSING, Improperly defined SSH_USERNAME symbol" $ say " - SSH_USERNAME symbol cannot be left blank" $ say " - SNAPSHOTS not created" $ goto abort_procedure $ endif $! $ TEST_SSH_TARGET: $!--------------- $! Test if SSH command is successful in reaching the 3par storage without $! providing a password. $! $ ssh_target = f$edit(ssh_target,"COLLAPSE") $ If ssh_target .eqs. "" $ then $ say " " $ say "%3PAR_CR-F-MISSING, Improperly defined SSH_TARGET symbol" $ say " - SSH_TARGET symbol cannot be left blank" $ say " - SNAPSHOTS not created" $ goto abort_procedure $ endif $ set noon $ set noverify $ define/user sys$output nl: $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' showversion $ results = $status $! set verify $ if results .eqs. "%X00000001" $ then $! Reach here if 3par cli command was successful $ goto validate_3par_user_has_super_priv $ endif $ if results .eqs. "%X0764CFB2" $ then $ say " " $ say - "%3PAR_CR-F-BADADDR, Unable to communicate with 3par array" $ say " - Confirm symbol SSH_TARGET is correctly defined" $ say " - Procedure aborted and SNAPSHOTS not created" $ exit 'results' $ endif $ if results .eqs. "%X0764D083" $ then $ say " " $ say - "%3PAR_CR-F-BADUSERPWD, User not defined or password problem" $ say " - Confirm symbol SSH_USERNAME is correctly defined" $ say " - Also confirm ssh public key authentication is configured" $ say " - Procedure aborted and SNAPSHOTS not created" $ exit 'results' $ endif $! $! If reach here then the ssh 3par cli command has failed $! $ say " " $ say - "%3PAR_CR-F-NOACCESS, Unable to communicate with 3par array" $ say - " - Further analysis required to determine what is wrong" $ say " Procedure aborted and SNAPSHOTS not created" $ exit 'results' $! $ VALIDATE_3PAR_USER_HAS_SUPER_PRIV: $!--------------------------------- $ set on $ on error then goto abort_procedure $ set noverify $ define/user sys$output sys$login:3parcr_userprv.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' showuser "''ssh_username'" $ deassign/process sys$output $! set verify $ say "" $ say "cli% showuser ''ssh_username'" $ type sys$login:3parcr_userprv.tmp $ define/user sys$error nl: $ define/user sys$output nl: $ search sys$login:3parcr_userprv.tmp "super" $ if $status .nes. "%X00000001" $ then $ say " " $ say - "%3PAR_CR-F-NOPRIV, 3par account ''ssh_username' does not have SUPER role" $ say " - Missing required privilege to execute procedure" $ say " - SNAPSHOTS not created" $ delete sys$login:3parcr_userprv.tmp;* $ goto abort_procedure $ endif $! $ CHECK_SNAPSHOT_VVSET_PROVIDED: $!----------------------------- $! $! Make sure SNAPSHOT_VVSET symbol is defined $! $ snapshot_vvset = f$edit(snapshot_vvset,"COLLAPSE") $ If snapshot_vvset .eqs. "" $ then $ say " " $ say "%3PAR_CR-F-MISSING, Invalid snapshot VV Set name" $ say " - Symbol SNAPSHOT_VVSET cannot be left blank" $ say " - SNAPSHOTS not created" $ goto abort_procedure $ endif $! $ CHECK_SNAPSHOT_VVSET_LENGTH: $!--------------------------- $! Validiation SNAPSHOT_VVSET symbol doesn't exceed 31 characters $! $ string_length = f$length(snapshot_vvset) $ If string_length .gt. 31 $ then $ say " " $ say "%3PAR_CR-F-TOOLONG, Invalid snapshot VV Set name" $ say " - SNAPSHOT_VVSET symbol exceeds 31 characters" $ say " - Redefine symbol SNAPSHOT_VVSET" $ say " - SNAPSHOTS not created" $ goto abort_procedure $ endif $! $ VALIDATE_VV_SET_NAME: $!-------------------- $! $! Begin validation of the VVSET symbol $! $ vvset = f$edit(vvset,"COLLAPSE") $ If vvset .eqs. "" $ then $ say " " $ say "%3PAR_CR-F-MISSING, Invalid VV Set name" $ say " - VVSET symbol cannot be left blank" $ say " - SNAPSHOTS not created" $ goto abort_procedure $ endif $! $! Issue SHOWVVSET cli command to retrieve the VV Volume Set info $! $ set noverify $ define/user sys$output sys$login:3parcr_vvset.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' showvvset "''vvset'" $! set verify $ say "" $ say "cli% showvvset ''vvset'" $ type sys$login:3parcr_vvset.tmp $ define/user sys$error nl: $ define/user sys$output nl: $ search sys$login:3parcr_vvset.tmp "No VV Set listed" $ if $status .eqs. "%X00000001" $ then $ say " " $ say "%3PAR_CR-F-NOTFOUND, Invalid VV Set name" $ say " - VV Set ''vvset' does not exist or symbol VVSET is incorrectly defined" $ say " - SNAPSHOTS not created" $ delete sys$login:3parcr_vvset.tmp;* $ goto abort_procedure $ endif $ define/user sys$error nl: $ define/user sys$output nl: $ search sys$login:3parcr_vvset.tmp 'vvset $ if $status .eqs. "%X00000001" ! If true, file contains name of VV Volume Set $ then $ goto validate_vvset_contains_vv_vols $ else $ say " " $ say "%3PAR_CR-F-BAD, Problem with VV Set name" $ say " - Further analysis required to determine what is wrong" $ say " - SNAPSHOTS not created" $ delete sys$login:3parcr_vvset.tmp;* $ goto abort_procedure $ endif $! $ VALIDATE_VVSET_CONTAINS_VV_VOLS: $!------------------------------- $! $! Determine how many VV Vols in VV Volume Set by examining the output of a $! SHOWVVSET -SUMMARY cli command. $! $ set noverify $ define/user sys$output sys$login:3parcr_vvset_summary.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' showvvset -summary $! set verify $ say "" $ say "cli% showvvset -summary" $ type sys$login:3parcr_vvset_summary.tmp $ open in sys$login:3parcr_vvset_summary.tmp $! $ loop1: $!----- $ read/end=loop1_end in summary_record $! show symbol summary_record $ summary_record = f$edit(summary_record,"COMPRESS") $ summary_name = f$element(1," ",summary_record) $ vv_cnt = f$element(2," ",summary_record) $! show symbol summary_record $! show symbol summary_name $! show symbol vv_cnt $ if summary_name .eqs. vvset then goto loop1_end $ goto loop1 $! $ loop1_end: $!--------- $ close in $ delete sys$login:3parcr_vvset_summary.tmp;* $! $! Validate if VV Volume Set referred to by the symbol vvset has at least one $! VV Volume $! $ if vv_cnt .eq. 0 $ then $ say " " $ say "%3PAR_CR-F-NOVV, VV Volume Set ''vvset' contains no VV Volumes" $ say " - Please fix with CREATEVVSET -ADD command" $ say " - SNAPSHOTS not created" $ delete sys$login:3parcr_vvset.tmp;* $ goto abort_procedure $ endif $! $ VALIDATE_STARTING_SNAPSHOT_LUN_SETTING: $!-------------------------------------- $! Validate if STARTING_SNAPSHOT_LUN symbol is too large since luns presented to $! OpenVMS systems cannot exceed 32727 $! $ max_lun = starting_snapshot_lun + vv_cnt $! show sym max_lun $ if max_lun .gt. 32727 $ then $ say " " $ say "%3PAR_CR-F-BADLUNS, STARTING_SNAPSHOT_LUN too high" $ say " - Luns for OpenVMS cannot exceed 32727" $ say - " With starting lun ''starting_snapshot_lun' the highest lun would be" $ say " ''max_lun' since vv volset has ''vv_cnt' vv volumes " $ say " - SNAPSHOTS not created" $ delete sys$login:3parcr_vvset.tmp;* $ goto abort_procedure $ endif $! $ BEGIN_ANALYSIS_OF_HOST_NAME_OR_HOSTSET: $!-------------------------------------- $! $! Validate that either HOST or HOSTSET symbol is defined $! $ hostset = f$edit(hostset,"COLLAPSE") $ host = f$edit(host,"COLLAPSE") $ if hostset .nes "" then goto validate_host_set $ if host .eqs. "" $ then $ say "" $ say "%3PAR_CR-F-MISSING, HOSTSET or HOST symbols not defined" $ say " - SNAPSHOTS not created" $ goto abort_procedure $ else $ goto validate_host_name $ endif $! $ VALIDATE_HOST_SET: $!------------------ $! $! Reach here if the host set name is nonblank. $! $! Analyze output of SHOWHOSTSET cli command. Check if host set name is defined $! $ set noverify $ define/user sys$output sys$login:3parcr_hostset.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' showhostset "''hostset'" $! set verify $ say "" $ say "%cli showhostset ''hostset'" $ type sys$login:3parcr_hostset.tmp $ define/user sys$error nl: $ define/user sys$output nl: $ search sys$login:3parcr_hostset.tmp "No host set listed" $ if $status .eqs. "%X00000001" $ then $ say "" $ say "%3PAR_CR-F-NOTFOUND, Invalid host set name" $ say " - Host Set ''hostset' does not exist or symbol HOSTSET is incorrectly defined" $ say " - Fix symbol HOSTSET definition" $ say " - SNAPSHOTS not created" $ delete sys$login:3parcr_hostset.tmp;* $ goto abort_procedure $ endif $ define/user sys$error nl: $ define/user sys$output nl: $ search sys$login:3parcr_hostset.tmp 'hostset $ if $status .eqs. "%X00000001" $ then $! Reach here if the host set is valid $ goto check_space $ else $ say "" $ say "%3PAR_CR-F-BADHOST,Invalid host set name" $ say " - More analysis needed to determine why" $ say " - SNAPSHOTS not created" $ delete sys$login:3parcr_hostset.tmp;* $ goto abort_procedure $ endif $! $ VALIDATE_HOST_NAME: $!------------------ $! $! Reach here if the host name is nonblank. Validate host name $! $! $! Analyze output of 3par cli SHOWHOST command $! $ set noverify $ define/user sys$output sys$login:3parcr_host.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' showhost "''host'" $! set verify $ say "%cli showhost ''host'" $ type sys$login:3parcr_host.tmp $ define/user sys$error nl: $ define/user sys$output nl: $ search sys$login:3parcr_host.tmp "no host listed" $ if $status .eqs. "%X00000001" $ then $ say "" $ say "%3PAR_CR-F-NOTFOUND, Invalid host name" $ say " - Host ''host' does not exist or symbol HOST is incorrectly defined" $ say " - Fix symbol HOSTSET definition" $ say " - SNAPSHOTS not created" $ delete sys$login:3parcr_host.tmp;* $ goto abort_procedure $ endif $ define/user sys$error nl: $ define/user sys$output nl: $ search sys$login:3parcr_host.tmp 'host $ if $status .eqs. "%X00000001" $ then $! Reach here if the host name is valid $ delete sys$login:3parcr_host.tmp;* $ goto check_space $ else $ say "" $ say "Invalid host name" $ say "%3PAR_CR-F-BADHOST,Invalid host set name" $ say " - More analysis needed to determine why" $ say " - SNAPSHOTS not created" $ delete sys$login:3parcr_host.tmp;* $ goto abort_procedure $ endif $! $ CHECK_SPACE: $!----------- $! Check if there is adequate space to create the snapshots. The logic below $! compares the total Usr_Used_MB of VMS VV Volume Set to UsableFree of entire $! 3par array. Total Usr_Used_MB is the total amount of disk space currently in $! use by the OpenVMS luns which are to be the source of the snapshots. $! UsableFree is the amount of free space available for the entire 3par array. $! $ say "" $ say "....Completed Step 1..." $ say "" $ say "....Beginning Step 2..." $ say "Confirming 3par storage array has enough space to create the " $ say "snapshots..." $! $! Issue SHOWSPACE cli command to get UsableFree space of entire 3par array $! $ set noverify $ define/user sys$output sys$login:3parcr_showspace.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' showspace $! set verify $ say "" $ say "cli% showspace" $ type sys$login:3parcr_showspace.tmp $ open in sys$login:3parcr_showspace.tmp $! $ loop2: $!----- $ read/end=loop2_end in showspace $! show symbol showspace $ goto loop2 $! $ loop2_end: $!--------- $ close in $ showspace = f$edit(showspace,"COMPRESS") $! show symbol showspace $ usable_free = f$element(1," ",showspace) $! show symbol usable_free $ delete sys$login:3parcr_showspace.tmp;* $ set noverify $! $! Issue SHOWVV -SHOWCOLS cli command to get amount of space currently used by $! all vv volumes in the vv volume set. The total space of all OpenVMS volumes $! is found in the last record of sys$login:3parcr_showspace.tmp $! $ define/user sys$output sys$login:3parcr_used_space.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' - showvv -showcols "Usr_Used_MB" "set:''vvset'" $! set verify $ say "" $ say "cli% showvv -showcols ""Usr_Used_MB"" set:''vvset'" $ type sys$login:3parcr_used_space.tmp $ open in sys$login:3parcr_used_space.tmp $! $ loop3: $!----- $ read/end=loop3_end in showvv $! show symbol showvv $ goto loop3 $! $ loop3_end: $!--------- $ used_space = f$edit(showvv,"COLLAPSE") $! show symbol used_space $ close in $ delete sys$login:3parcr_used_space.tmp;* $! $! Compare total Usr_Used_MB of VMS vv volumes in the volume set to UsableFree $! of entire 3par array $! $ if usable_free .gt. used_space $ then $ say "" $ say "%3PAR_CR-I-SPACE, Adequate space to create snapshots" $ say - " Usable free in array is ''usable_free' and vv used space is ''used_space'" $ else $ say "" $ say "%3PAR_CR-F-NOSPACE, Not enough space to create snapshots" $ say - " Usable free in array is ''usable_free' and vv used space is ''used_space'" $ say " - SNAPSHOTS not created" $ goto abort_procedure $ endif $! $ CREATE_SNAPSHOP_VVSET: $!--------------------- $! Logic to create the Snapshot VV Volume Set $! $ say "" $ say "....Completed Step 2..." $ say "" $ say "....Beginning Step 3..." $ say "Creating Snapshot VV Volume Set..." $! $! Issue CREATEVVSET cli command to create the snapshot VV Volume Set. No VV $! Volumes are specified. These will be added later in the procedure $! $ set noverify $ define/user sys$output sys$login:3parcr_createvvset.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' - createvvset "''snapshot_vvset'" $! set verify $! $! If sys$login:3parcr_createvvset.tmp is a zero block file then CREATEVVSET $! command was successful $! $ allocation_quantity = - F$FILE_ATTRIBUTES("sys$login:3parcr_createvvset.tmp","alq") $ if allocation_quantity .eq 0 $ then $ say "" $ say - "%3PAR_CR-I-CREATEDSNAPVSET, Created snapshot VV Set ''snapshot_vvset'" $ delete sys$login:3parcr_createvvset.tmp;* $ goto DETERMINE_IF_VV_SHOULD_BE_ADDED_TO_SNAPSHOT_VOLVSET $ endif $ say " $ say "cli% createvvset ''snapshot_vvset'" $ type sys$login:3parcr_createvvset.tmp;* $! $! If Snapshot Volume Set already exists ignore this error $! $ define/user sys$error nl: $ define/user sys$output nl: $ search sys$login:3parcr_createvvset.tmp "A set using that name already exists" $ if $status .eqs. "%X00000001" $ then $ delete sys$login:3parcr_createvvset.tmp;* $ goto DETERMINE_IF_VV_SHOULD_BE_ADDED_TO_SNAPSHOT_VOLVSET $ endif $! $! Reach here if an error has occurred $! $ say - "%3PAR_CR-F-SNAPVVSETERR, Problem creating snapshot VV Set''snapshot_vvset'" $ say " - Further analysis required to determine what is wrong" $ say " - SNAPSHOTS not created" $ delete sys$login:3parcr_createvvset.tmp;* $ goto abort_procedure $! $ DETERMINE_IF_VV_SHOULD_BE_ADDED_TO_SNAPSHOT_VOLVSET: $!--------------------------------------------------- $! $ say "" $ say "....Completed Step 3..." $ say "" $ say "....Beginning Step 4..." $ say "" $ say "Finding those VV Volumes which reference OpenVMS devices that " $ say "are nonshadowed disks or is the master member of a shadowset..." $! $! Examine output from SHOWVVSET cli command for the VV Volume Set. $! This will contain the names of the source VV Volumes for the snapshots $! $ open in sys$login:3parcr_vvset.tmp $ read in vv_name ! Ignore 1st record in file $! $! Now examine 2nd record in file which has a unique format from remaining $! records in sys$login:3parcr_vvset.tmp $! $ read/end=loop4_end in vv_name $! show symbol vv_name $ vv_name = f$edit(vv_name,"COMPRESS") $! show symbol vv_name $ vv_name = f$element(2," ",vv_name) $! show symbol vv_name $! $! Determine if this volume is a member of a shadowset. If yes, only add to the $! Snapshot VV Set if it is the master member. Otherwise ignore this VV vol. $! If not a shadowset member, add to the Snapshot VV Set. $! $ define/user sys$output sys$login:3parrm_udid.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' - showvv -showcols "Udid" "''vv_name'" $! set verify $ say "" $ say "cli% showvv -showcols Udid ''vv_name'" $ type sys$login:3parrm_udid.tmp $ open input sys$login:3parrm_udid.tmp $ read input vv_udid ! ignore first record $ read input vv_udid ! this is the udid $ close input $ add_status == "" $! show symbol vv_udid $ vv_udid = f$edit(vv_udid,"COLLAPSE") $ openvms_disk = "_$1$DGA''vv_udid':" $ if f$getdvi(openvms_disk,"SHDW_MEMBER") .eqs. "TRUE" $ then $ shadowset_dsa_name = f$getdvi(openvms_disk,"SHDW_MASTER_NAME") $ shadowset_master_member = f$getdvi(shadowset_dsa_name,"shdw_master_mbr") $ if openvms_disk .eqs. shadowset_master_member $ then $! Reach here if OpenVMS volume is the shadowset master member $ call CREATE_SNAPSHOT_VV - "''vv_name'" "''snapshot_vvset'" 'add_status' $ else $ say "" $ say "%3PAR_CR-I-SKIPSHADMBR, skipping shadowset member ''vv_name'" $ say - " - No need to add to Snapshot VV set since not shadowset master mbr" $ endif $ else $! Reach here VV is not a member of a shadowset $ call CREATE_SNAPSHOT_VV "''vv_name'" "''snapshot_vvset'" 'add_status' $ endif $! show symbol add_status $ if add_status .eqs. "ERROR" then goto abort_procedure $! $! $! Continue processing rest of sys$login:3parcr_vvset.tmp file $! $ loop4: $!----- $ read/end=loop4_end in vv_name $ vv_name = f$edit(vv_name,"COLLAPSE") $! show symbol vv_name $! $! Determine if this volume is a member of a shadowset. If yes, only add to the $! Snapshot VV Set if it is the master member. Otherwise ignore this VV vol. $! If not a shadowset member, add to the Snapshot VV Set. $! $ define/user sys$output sys$login:3parrm_udid.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' - showvv -showcols "Udid" "''vv_name'" $! set verify $ open input sys$login:3parrm_udid.tmp $ read input vv_udid ! ignore first record $ read input vv_udid ! this is the udid $ close input $ add_status == "" $! show symbol vv_udid $ vv_udid = f$edit(vv_udid,"COLLAPSE") $ openvms_disk = "_$1$DGA''vv_udid':" $ if f$getdvi(openvms_disk,"SHDW_MEMBER") .eqs. "TRUE" $ then $ shadowset_dsa_name = f$getdvi(openvms_disk,"SHDW_MASTER_NAME") $ shadowset_master_member = f$getdvi(shadowset_dsa_name,"shdw_master_mbr") $ if openvms_disk .eqs. shadowset_master_member $ then $! Reach here if OpenVMS volume is the shadowset master member $ call CREATE_SNAPSHOT_VV "''vv_name'" "''snapshot_vvset'" 'add_status' $ else $ say "" $ say "%3PAR_CR-I-SKIPSHADMBR, skipping shadowset member ''vv_name'" $ say - " - No need to add to Snapshot VV set since not shadowset master mbr" $ endif $ else $! Reach here VV is not a member of a shadowset $ call CREATE_SNAPSHOT_VV "''vv_name'" "''snapshot_vvset'" 'add_status' $ endif $! show symbol add_status $ if add_status .eqs. "ERROR" then goto abort_procedure $ goto loop4 $! $ loop4_end: $!--------- $ close in $! $ DISPLAY_SNAPSHOT_VV_VOLUMES: $!--------------------------- $! Display the details about the Snapsho VV Volumes using a 3 par SHOWVV -D $!command $! $ say "" $ say "cli% showvv -d set:''snapshot_vvset'" $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' - showvv -d "set:''snapshot_vvset'" $! $ SET_UDID: $!-------- $! Logic for setting udid of the snapshot VV Volumes $! $ say "" $ say "....Completed Step 4..." $ say "" $ say "....Beginning Step 5..." $ say "Setting udid of Snapshot VV Volumes so they agree with the desired lun" $ say "numbers presened to the OpenVMS hosts(s)..." $! $! Examine output from SHOWVVSET 3par cli command for the Snapshot VV Volume $! Set. This will contain the names of the source VV Volumes for the snapshots $! $ set noverify $ define/user sys$output sys$login:3parcr_snapshot_vvset.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' - showvvset "''snapshot_vvset'" $! set verify $ say "" $ say "cli% showvvset ''snapshot_vvset'" $ type sys$login:3parcr_snapshot_vvset.tmp $ open in sys$login:3parcr_snapshot_vvset.tmp $ read in vv_name ! Ignore 1st record in file $! $! Now examine 2nd record in file which has a unique format from remaining $! records in sys$login:3parcr_snapshot_vvset.tmp $! $ read/end=loop5_end in vv_name $! show symbol vv_name $ vv_name = f$element(2," ",vv_name) $! show symbol vv_name $! $! Issue the SETVV -UDID 3oar cli command to set the udid of this snapshot VV $! Volume $! $ set noverify $ define/user sys$output sys$login:3parcr_setudid.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' - setvv -udid 'starting_snapshot_lun' "''vv_name'" $! set verify $! $! If sys$login:3parcr_setudid.tmp is a zero block file then SETVV -UUID command $! was successful $! $ allocation_quantity = F$FILE_ATTRIBUTES("sys$login:3parcr_setudid.tmp","alq") $ if allocation_quantity .eq 0 $ then $ say "" $ say - "%3PAR_CR-I-SETUDID, Successfully modified udid of ''vv_name'" $ delete sys$login:3parcr_setudid.tmp;* $ else $ say " $ say "cli% setvv -udid 'starting_snapshot_lun' ''vv_name'" $ type sys$login:3parcr_setudid.tmp $ say "%3PAR_CR-F-UDIDERR, Problem setting udid of ''vv_name'" $ say " - Further analysis required to determine what is wrong" $ say " - SNAPSHOTS not exported" $ delete sys$login:3parcr_setudid.tmp;* $ goto abort_procedure $ endif $! $! Continue processing rest of sys$login:3parcr_snapshot_vvset.tmp file $! $ lun = 'starting_snapshot_lun $! show symbol lun $! $ loop5: $!----- $ read/end=loop5_end in vv_name $ vv_name = f$edit(vv_name,"COLLAPSE") $! show symbol vv_name $! $ lun = lun + 1 $! show symbol lun $! $! Issue the SETVV -UDID 3par cli command to set the udid of the snapshot VV $! Volume $! $ set noverify $ define/user sys$output sys$login:3parcr_setudid.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' - setvv -udid 'lun' "''vv_name'" $! set verify $! $! If sys$login:3parcr_setudid.tmp is a zero block file then SETVV -UUID command $! was successful $! $ allocation_quantity = f$FILE_ATTRIBUTES("sys$login:3parcr_setudid.tmp","alq") $ if allocation_quantity .eq 0 $ then $ say "" $ say - "%3PAR_CR-I-SETUDID, Successfully modified udid of ''vv_name'" $ delete sys$login:3parcr_setudid.tmp;* $ else $ say " $ say "%3PAR_CR-F-UDIDERR, Problem setting udid of ''vv_name'" $ say " - Further analysis required to determine what is wrong" $ say " - SNAPSHOTS not exported" $ say "cli% setvv -udid 'lun' ''vv_name'" $ type sys$login:3parcr_setudid.tmp $ delete sys$login:3parcr_setudid.tmp;* $ goto abort_procedure $ endif $ goto loop5 $! $ loop5_end: $!--------- $ close in $ delete sys$login:3parcr_snapshot_vvset.tmp;* $! $ EXPORT_LUNS: $!----------- $! $! Issue CREATEVLUN 3par cli command to export the luns. $! $ say "" $ say "....Completed Step 5..." $ say "" $ say "....Beginning Step 6..." $ say "Exporting the luns to the OpenVMS host(s)..." $! $! Syntax of CREATEVLUN cli command will change depending on whether host or $! hostset is used. $! $ if hostset .nes "" $ then $! $! Reach here if the host set is valid and the goals is to export luns of $! a cluster. CREATEVLUN cli command exports luns for all hosts listed in $! the host set $! $ set noverify $ define/user sys$output sys$login:3parcr_createvlun.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' - createvlun -f "set:''snapshot_vvset'" 'starting_snapshot_lun' "set:''hostset'" $! set verify $ say " $ say - "cli% createvlun -f set:''snapshot_vvset'''starting_snapshot_lun'set:''hostset'" $ else $! $! Reach here if the host name is valid and goal is to export luns to a $! single host $! $ set noverify $ define/user sys$output sys$login:3parcr_createvlun.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' - createvlun -f "set:''snapshot_vvset'" 'starting_snapshot_lun' "''host'" $! set verify $ say " $ say - "cli% createvlun -f set:''snapshot_vvset' ''starting_snapshot_lun' ''host'" $ endif $! $! If sys$login:3parcr_createvlun.tmp is a zero block file then CREATEVLUN $! cli command was successful $! $ allocation_quantity = - F$FILE_ATTRIBUTES("sys$login:3parcr_createvlun.tmp","alq") $ if allocation_quantity .eq 0 $ then $ say "" $ say - "%3PAR_CR-I-CREATEDLUN, Successfully created the snapshot luns" $ delete sys$login:3parcr_createvlun.tmp;* $ goto show_host_luns $ endif $! $! Logic if export command has failed $! $ type sys$login:3parcr_createvlun.tmp;* $ say - "%3PAR_CR-F-CREATELUNERR, Createvlun command has failed" $ say " - Further analysis required to determine what is wrong" $ say " - SNAPSHOTS not exported" $ delete sys$login:3parcr_createvlun.tmp;* $ goto abort_procedure $! $ SHOW_HOST_LUNS: $!-------------- $! Show the luns exported to the host using the SHOVVLUN -HOST 3par command $! $ if hostset .nes "" $ then $ goto show_hostset_luns $ else $! Show exported luns from this host $ say "" $ say "%cli showvlun -host ''host'" $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' - showvlun -host "''host'" $ goto make_luns_available_to_host $ endif $! $ SHOW_HOSTSET_LUNS: $!----------------- $! $! First show the luns for the hostset using a SHOWVVLUN -T -HOST 3par command $! $ say "" $ say "%cli showvlun -t -host set:''hostset'" $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' - showvlun -t -host set:"''hostset'" $! $! Analyze output from cli 3par SHOWHOSTSET command. $! Then issue SHOWHOWVLUN -HOST 3par command for each host listed in the $! hostset $! $ open in sys$login:3parcr_hostset.tmp $ read in hostset_record ! ignore first record $ read/end=loop6_end in hostset_record !2nd record has unique format $ hostset_record = f$edit(hostset_record,"COMPRESS") $ host_name = f$element(2," ",hostset_record) $ say "" $ say "%cli showvlun -host ''host_name'" $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' - showvlun -host "''host_name'" $! $ loop6: $!----- $ read/end=loop6_end in host_name $ host_name = f$edit(host_name,"COLLAPSE") $ say "" $ say "%cli showvlun -host ''host_name'" $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' - showvlun -host "''host_name'" $ goto loop6 $! $ loop6_end: $!--------- $ close in $! $ MAKE_LUNS_AVAILABLE_TO_HOST: $!--------------------------- $! Now issue some SYSMAN command to make the luns available to the OpenVMS $! host(s) $! $ say "" $ say "....Completed Step 6..." $ say "" $ say "....Beginning Step 7..." $ say "Making the luns available to the OpenVMS host(s) by issuing some OpenVMS" $ say "SYSMAN commands..." $ say "" $! $ if f$search("sys$login:3parcr*.tmp;*") .nes. "" $ then $ delete sys$login:3parcr*.tmp;* $ endif $ set verify $ mcr sysman set env/cluster io scsi io auto/log $ show device dg $! $! After issuing these commands the $1$DGA devices corresponding to the $! snapshot luns should appear online $! $ set noverify $! $ ENABLE_OPENVMS_LUNS_ERROR_CHECKING: $!----------------------------------- $! $! When reusing luns that have previously been unpresented to OpenVMS by $! 3PAR_REMOVE_VIRTUAL_SNAPSHOTS.COM, this procedure disables error checking $! on the OpenVMS snapshot disks. Error logging should be re-enabled now that $! the snapshot disks are getting used again. $! $ say "" $ say "....Completed Step 7..." $ say "" $ say "....Beginning Step 8..." $ say "Enabling error checking on the OpenVMS snapshot disks..." $! $! Capture the udids /luns of OpenVMS devices affected by issuing a SHOWVV $! 3par command that makes use of the Snapshot VV Set $! $ say "" $ say "Enabling error checking on Snapshot OpenVMS disks..." $ define/user sys$output sys$login:3parrm_udid.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' - showvv -showcols "Udid" set:"''snapshot_vvset'" $! set verify $ open in sys$login:3parrm_udid.tmp $ read in hostset_record ! ignore first record $! $ loop7: $!----- $ read/end=loop7_end in udid !2nd record has unique format $ udid =f$edit(udid,"COLLAPSE") $ first_character = f$extract(0,1,udid) $ if first_character .eqs. "-" then goto loop7_end $ openvms_disk = "$1$dga''udid':" $ openvms_disk_search_string = "*dga''udid':*" $! $! Confirm that the OpenVMS disk exists before issuing an OpenVMS SET $! DEVICE/ERROR_LOGGING command $! $ results = f$device("''openvms_disk_search_string'","DISK") $! show symbol results $ if results .nes. "" $ then $ set verify $ set device /error_logging 'openvms_disk $ set noverify $ endif $ write sys$output f$device("''openvms_disk_search_string'","DISK") $ goto loop7 $! $ loop7_end: $!---------- $ close in $ exit $! $ ABORT_PROCEDURE: $!--------------- $ set noon $ say "" $ say "%3PAR_CR-E-ABORT, Procedure abnormally terminated due to error" $ if f$search("sys$login:3parcr*.tmp;*") .nes. "" $ then $ delete sys$login:3parcr*.tmp;* $ endif $ exit $! $ CREATE_SNAPSHOT_VV: SUBROUTINE $!------------------------------ $! Issue CREATESV cli command to create read only snapshot VV Volume. $! $ say "" $ say "...Performing Step 4a..." $ say "Creating Read only Snapshots VV volumes with a 3par cli CREATESV" $ say "command if OpenVMS device is a nonshadowed disk or the master " $ say "member of a shadowset..." $ say "" $ add_status == "NO" $ vv_name = "''p1'" $ snapshot_vvset == p2 $! show symbol p1 $! show symbol p2 $! show symbol vv_name $! show symbol snapshot_vvset $ set noverify $ define/user sys$output sys$login:3parcr_createsv.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' - createsv -ro @vvname@"_snap" "''vv_name'" $! $! A 5 second delay has been added here to give the CREATESV cli 3par commmand $! time to complete $! $ wait 00:00:05.00 $! set verify $! $! If sys$login:3parcr_createsv.tmp is a zero block file then CREATESV cli $! command was successful $! $ allocation_quantity = F$FILE_ATTRIBUTES("sys$login:3parcr_createsv.tmp","alq") $ if allocation_quantity .eq. 0 $ then $ say " " $ say "cli% createsv -ro @vvname@"_snap" ''vv_name'" $ say - "%3PAR_CR-I-CREATESNAP, Successfully created read only snapshot ''vv_name'" $ add_status == "SUCCESS" $ delete sys$login:3parcr_createsv.tmp;* $! $! Now add the snapshot vv volume to the snapshot vv set $! $ call ADD_VV_TO_SNAPSHOT_VVSET "''vv_name'" "''snapshot_vvset'" 'add_status' $ exit $ endif $! $! Reach here if errors have occurred with CREATESV cli 3par command $! $ say "" $ say "cli% createsv -ro @vvname@_snap ''vv_name'" $ type sys$login:3parcr_createsv.tmp $! $! Check if VV Volume Names are too long to create snapshots ending with string $! "_snap" $! $ define/user sys$error nl: $ define/user sys$output nl: $ search sys$login:3parcr_createsv.tmp "too long" $ if $status .eqs. "%X00000001" $ then $ say " " $ say "%3PAR_CR-F-TOOLONG, Invalid VV Volume names too long" $ say " - Exceeds 32 characters when _snap appended to VV Volume name" $ say " - Rename VV Volume names with setvv -name command" $ say " - SNAPSHOTS not created" $ delete sys$login:3parcr_createsv.tmp;* $ add_status == "ERROR" $ else $ say " " $ say "%3PAR_CR-F-NOSNAP, Problem with createv command" $ say " - Further analysis required to determine what is wrong" $ say " - SNAPSHOTS not created" $ delete sys$login:3parcr_createsv.tmp;* $ add_status == "ERROR" $ endif $ exit $ ENDSUBROUTINE $! $ ADD_VV_TO_SNAPSHOT_VVSET: SUBROUTINE $!------------------------------------ $! Add the Snapshot VV volume to the Snapshot VV set. $! $! Note that we have already previously determined that the Snapshot VV volume $! references an OpenVMS device which is either a nonshadowed disk or a $! shadowset master member $! $ add_status == "NO" $ vv_name = "''p1'_snap" $ snapshot_vvset == p2 $ say "" $ say "...Performing Step 4b..." $ say "Adding Snapshot VV volume to Snapshot VV Set..." $! show symbol p1 $! show symbol p2 $! show symbol vv_name $! show symbol snapshot_vvset $! $! Now add snapshot to Snapshot VV Volume Set using a CREATEVVSET -ADD 3par $! command $! $ set noverify $ define/user sys$output sys$login:3parcr_addtovvset.tmp $ ssh -o "batchmode yes" 'ssh_username'@'ssh_target' - createvvset -add "''snapshot_vvset'" "''vv_name'" $ say "" $ say "cli % createvvset -add ''snapshot_vvset' ''vv_name'" $ type sys$login:3parcr_addtovvset.tmp $! set verify $! $! If sys$login:3parcr_addtovvset.tmp is a zero block file then $! CREATESVVET -ADD cli command was successful $! $ allocation_quantity = - F$FILE_ATTRIBUTES("sys$login:3parcr_addtovvset.tmp","alq") $ if allocation_quantity .eq 0 $ then $ add_status == "SUCCESS" $ say "" $ say - "%3PAR_CR-I-ADDTOVVSET, Successfully added ''vv_name' to ''snapshot_vvset'" $ exit $ endif $! $! Check to see if Snap VV Vol is already a member of Snapshot VV Set $! If it is, don't worry about this $! $ define/user sys$error nl: $ define/user sys$output nl: $ search sys$login:3parcr_addtovvset.tmp "already a part of" $ if $status .eqs. "%X00000001" $ then $ add_status == "SUCCESS" $ say " " $ say - "%3PAR_CR-I-NOACTION, ''vv_name' is already a member of ''snapshot_vvset'" $ exit $ endif $! $! Reach here if an error has occurred $! $ add_status == "ERROR" $ say " $ say "%3PAR_CR-F-NOADDTOVVSET, Problem adding ''vv_name'" $ say " - Further analysis required to determine what is wrong" $ say " - SNAPSHOTS not exported" $ delete sys$login:3parcr_addtovvset.tmp;* $ exit $ ENDSUBROUTINE