Hoff's blog often gives me a push to post something on here. Recently, he was talking about SCACP usage, and I thought "Gee, I have a nice little DCL command procedure that does circuit prioritization using that. I should post it". So, here it is.
$! See end of file for comments.
$ say := write sys$output
$ status = 1
$!
$ set on
$ on warning then goto error
$
$ if .not. f$getsyi ("NISCS_LOAD_PEA0")
$ then
$ say "NISCS_LOAD_PEA0 is false. Nothing to do."
$ goto exit
$ endif
$!
$ required_privs = "SYSPRV,DIAGNOSE"
$ old_privs = f$setprv (required_privs)
$ if .not. f$privilege (required_privs)
$ then
$ say "Required privs: " + required_privs
$ status = 36
$ goto exit
$ endif
$!
$ procedure = f$environment ("procedure")
$ procedure = f$parse (procedure,,,,"NO_CONCEAL")
$!
$ smci = 3 ! Priority for Shared memory cluster interconnect
$ smlan = 2 ! Priority for Shared memory LAN interconnect
$ mc = 1 ! Priority for memory channel
$ ni = 0 ! Priority for network interconnects (gigabit)
$ ci = 0 ! Priority for original CI, such as CIPCAs
$!
$ mode = f$mode ()
$ if mode .eqs. "BATCH" .or. mode .eqs. "INTERACTIVE"
$ then
$ temp_file = f$unique () + ".com"
$ open/write temp_file 'temp_file
$ write temp_file "$ mcr sysman"
$ write temp_file "$ deck
$ write temp_file "set e/c"
$ write temp_file "do @''procedure'"
$ write temp_file "$ eod"
$ write temp_file "$ exit"
$ close temp_file
$ @'temp_file'
$ deletex/nolog 'temp_file';*
$ else
$ galaxy = f$getsyi ("galaxy_member")
$ if galaxy
$ then
$ galaxy_mbrs = f$edit (f$getsyi ("glx_mbr_name"), "compress")
$ endif
$ temp_file = f$unique () + ".dat"
$ define/user sys$output 'temp_file'
$ mcr scacp show circuit
$ start_found = 0
$ open temp_file 'temp_file
$loop:
$ read/end_of_file=end_loop temp_file record
$ length = f$length (record)
$ if f$locate ("----", record) .lt. length
$ then
$ start_found = 1
$ goto loop
$ endif
$ if .not. start_found
$ then
$ goto loop
$ endif
$ record = f$edit (record, "trim, upcase, compress")
$ node = f$element (0, " ", record)
$ port = f$element (1, " ", record)
$ type = f$element (7, " ", record)
$ if type .eqs. " "
$ then
$ type = f$element (6, " ", record)
$ endif
$
$ if type .eqs. "NI"
$ then
$ if galaxy
$ then
$ if f$locate (node, galaxy_mbrs) .lt. f$length (galaxy_mbrs)
$ then
$ priority = smlan
$ else
$ priority = ni
$ endif
$ else
$ priority = ni
$ endif
$ endif
$ if type .eqs. "SMCI"
$ then
$ priority = smci
$ endif
$ if type .eqs. "MC"
$ then
$ priority = mc
$ endif
$ if type .eqs. "CIPCA" .or. type .eqs. "HSJ"
$ then
$ priority = ci
$ endif
$ say "mcr scacp set circuit/port=''port'/prio=''priority' ''node'"
$ mcr scacp set circuit/port='port'/prio='priority' 'node'
$
$ goto loop
$end_loop:
$ close temp_file
$ deletex/nolog 'temp_file';*
$ endif
$ goto exit
$error:
$ status = $status
$ set noon
$ say "Unexpected error in SCACP.COM: " + f$fao ("!8XL", status)
$exit:
$ if f$type (old_priv) .nes. ""
$ then
$ old_priv = f$setprv (old_priv)
$ endif
$ exit status
$!
$!++
$!
$! DESCRIPTION
$!
$! As of VMS 7.3-1, the algoritm for selecting cluster communications
$! when PEDRIVER is loaded has changed so that gigabit ethernet is
$! selected, even if a more appropriate interconnect such as memory
$! channel is available. This command procedure prioritized the
$! cluster circuits so that we selete shared memory interconnects first
$! (if we are in a galaxy), then memory channel, then gig ethernet,
$! and CI last. The priorities are set at the top of the command
$! procedure in symbols that should be obvious. Change these to change
$! the order.
$!
$! You should add this to your scheduler to run every hour or so. The
$! command procedure works in two different modes. If it's run from
$! interactive or batch modes, it creates a command procedure to run
$! itself via SYSMAN on all nodes in the cluster. If it's running as
$! the sysman job, it does the priority setting for the circuits.
$!
$! You may need to adjust this code depending on how your scheduler works.
$!
$! AUTHOR
$!
$! James F. Duff
$!
$! DATE
$!
$! 02-Jun-2005
$!
$! MODIFICATIONS
$!
$! JFD 02-Jun-2005 Original version of module.
$!
$!--
Thanks, Jim. Just so you know, we ran into this at our DR test this year. It was good to have this around :)
Posted by: Kel Boyer at September 19, 2007 3:37 PM
Comments are closed