J From:	SMTP%"MARSHALL@nebula.ssd.lmsc.lockheed.com" 18-MAY-1993 19:56:28.24 To:	EVERHART CC:	* Subj:	ZTDRIVER user interface enhancements  + Date: Tue, 18 May 1993 16:58:13 -0700 (PDT) S From: Bob Marshall Org 6791 Bldg 561 x65737 <MARSHALL@nebula.ssd.lmsc.lockheed.com> 8 To: MOELLER@gwdgv1.dnet.gwdg.de, EVERHART@arisia.gce.com@ Message-Id: <930518165813.20803922@NEBULA.SSD.LMSC.LOCKHEED.COM>- Subject: ZTDRIVER user interface enhancements    Wolfgang/Glenn, J I have ZTDRIVER running pretty well now. I still need to do some thinking G about really bullet-proofing the whole thing, though. I've been working H from home 160 miles away from the actual nodes I'm using for testing, soJ it's difficult to do exhaustive testing. Anyway, here is an example of howI things look from the ZT-side when everything is successful (NEBULA is the - "ZT-side", and VCS is the "real-tape" side) :   4 ----------------------------------------------------) NEBULA> rmt :== @sys$sysp:[remotetape]rmt  NEBULA> rmt   % Name of node with tape drive [VCS] :    ) Name of remote tape device [VCS$MUA0:] :    > Mount your tape on VCS$MUA0: now. Press <RETURN> when the tape& is mounted and the drive is on-line...  0 Stand by, VCS is attempting to mount the tape...> %VCS-I-MESSAGE, %MOUNT-I-MOUNTED, GUY_03 mounted on _VCS$MUA0:  M Now a subprocess will be spawned to allow you to use the tape drive. You may  O issue any necessary commands, e.g., MOUNT, BACKUP, COPY, etc. When you are done L with the drive, simply LOGOUT to terminate the subprocess and return control to this procedure.  , %DCL-S-SPAWNED, process RMT_20803922 spawned> %DCL-S-ATTACHED, terminal now attached to process RMT_20803922! RMT_NEBULA> show device/full zta0   O Magtape $1$ZTA0: (NEBULA), device type TE16, is online, record-oriented device,      file-oriented device.   O     Error count                    0    Operations completed                646 O     Owner process                 ""    Owner UIC                         [0,0] O     Owner process ID        00000000    Dev Prot    S:RWED,O:RWED,G:RWED,W:RWED O     Reference count                0    Default buffer size                   4 O     Density                     1600    Format                        Normal-11 $     Allocation class               1  C   Volume status:  no-unload on dismount, position lost, odd parity.    RMT_NEBULA> mount/for zta0: 6 %MOUNT-I-MOUNTED, GUY_03 mounted on _$1$ZTA0: (NEBULA) RMT_NEBULA> backup/list zta0:  Listing of save set(s)   Save set:          05_12.BCK Written by:        SYSTEM       " UIC:               [000001,000004]* Date:              12-MAY-1993 06:58:19.68P Command:           BACKUP/NOREWIND/LOG/IGNORE=LABEL/BEFORE=-5-00:00:00/DELETE VC@ S$LOG:VCS$19%%_%%_%%.LOG;*,VCS$LOG:VCS$EVENT*.LOG MUA0:05_12.BCK' Operating system:  VAX/VMS version V5.5  BACKUP version:    V5.5  CPU ID register:   08000000  Node name:         _VCS::  Written on:        _VCS$MUA0:  Block size:        8192  Group size:        10  Buffer count:      38   P [VCS.LOG]VCS$1993_04_29.LOG;1                            2118  29-APR-1993 00:00	 Interrupt    RMT_NEBULA> logout<   Process RMT_20803922 logged out at 18-MAY-1993 15:51:29.54: %DCL-S-RETURNED, control returned to process ttttrrrrrrrrr   Cleaning up... Dismounting $1$ZTA0... Terminating the ZT2 program...' Telling remote node that we are done...  Closing network link...    NEBULA> show device zta0  P Device                  Device           Error    Volume         Free  Trans MntP  Name                   Status           Count     Label        Blocks Count Cnt. $1$ZTA0:      (NEBULA)  Offline              0   NEBULA> < ------------------------------------------------------------  H I haven't changed any of the original code. All I have really done is toI write two command procedures, one which resides on the "ZT-side", and the G other which resides on the "real-tape" side (as a network object). They F are not finished products, but I thought I'd run them by you anyway to3 make sure there are no major errors in philosophy :    RMT.COM (ZT-side) :   
 $! RMT.COM $!F $! This procedure is used to implement the remote mag tape utility forG $! using a mag tape on the node defined by default by the logical name  H $! RMT_REMOTE_NODE. The default remote tape drive to be used is defined ' $! by the logical name RMT_REMOTE_TAPE.  $!
 $! Usage : $!B $!   o Mount the tape on the remote node and put the drive on-line $!   o @dev:[dir]RMT $!% $! (Gory details at end of procedure)  $! $! Written by : Bob Marshall $!              17 May 1993 L $!************************************************************************** $!
 $ set noon $!3 $ default_remote_node = f$trnlnm("RMT_REMOTE_NODE")  $ write sys$output "" ! $ if default_remote_node .eqs. ""  $ thenI $   read/prompt="Name of node with tape drive : " sys$command remote_node B $   if remote_node .eqs. "" then exit  ! Ya gotta enter something! $ elseL $   read/prompt="Name of node with tape drive [''default_remote_node'] : " -           sys$command remote_nodeB $   if remote_node .eqs. "" then remote_node = default_remote_node $ endif  $!3 $ default_remote_tape = f$trnlnm("RMT_REMOTE_TAPE") D $ if default_remote_tape .eqs. "" then default_remote_tape = "MUA0:" $! $ write sys$output "" H $ read/prompt="Name of remote tape device [''default_remote_tape'] : " -&                sys$command remote_tape@ $ if remote_tape .eqs. "" then remote_tape = default_remote_tape $! $ write sys$output ""  $ write sys$output -K       "Mount your tape on ''remote_tape' now. Press <RETURN> when the tape" H $ read/prompt="is mounted and the drive is on-line..." sys$command dummy $!+ $! Open the network link to the remote node  $!L $! (Note : to use an object number other than 142, specify that number here) $!@ $ open/read/write/err=err_openlink netline 'remote_node'::"142=" $!/ $ this_node = f$trnlnm("sys$node") - "::" - "_"  $ write netline this_node  $ write netline remote_tape  $ on control_y then goto done  $! $ write sys$output "" P $ write sys$output "Stand by, ''remote_node' is attempting to mount the tape..." $! $ readloop:  $!N $! Read any output from the remote side, looking for the string "**CONTINUE**" $! $ k = 0 7 $ read/time_out=60/err=err_start_server netline message . $ if message .eqs. "**ERROR**" then goto close! $ if message .nes. "**CONTINUE**"  $ then $   if message .nes. "" then -=        write sys$output "%''remote_node'-I-MESSAGE, ",message 
 $   k = k + 1 , $!   if k .gt. 10 then goto err_start_server $   goto readloop  $ endif  $!L $! At this point things seem to be OK on the remote side; now just wait for  $! ZTA0: to come on-line.  $! $ wait_for_zta0: $!* $ tape_status = f$getdvi("$1$ZTA0:","STS")' $ if (tape_status .and. %X10) .ne. %X10  $ then $   wait 00:00:05.00 $   goto wait_for_zta0 $ endif  $! $! OK, ZTA0: is on-line  $!" $ prompt = f$environment("PROMPT") $ type sys$input  M Now a subprocess will be spawned to allow you to use the tape drive. You may  O issue any necessary commands, e.g., MOUNT, BACKUP, COPY, etc. When you are done L with the drive, simply LOGOUT to terminate the subprocess and return control to this procedure.  E $ pid = f$getjpi("","pid")           ! Generate a useful process name A $ spawn/prompt="RMT_''prompt'"/process="RMT_''pid'"       ! SPAWN  $! $ done:  $!4 $! Clean up (dismount tape, zap ZT2, close the link) $!
 $ set noon $ write sys$output "" # $ write sys$output "Cleaning up..."  $ if f$getdvi("$1$ZTA0:","MNT")  $ then- $   write sys$output "Dismounting $1$ZTA0..." L $   dismount/nounload $1$zta0:         ! Remove the /NOUNLOAD after testing  $ endif 3 $ write sys$output "Terminating the ZT2 program..." % $ run sys$sysp:[remotetape]zt2_forcex < $ write sys$output "Telling remote node that we are done..." $ write netline "**DONE**"/ $ read/err=continue/time_out=60 netline message 5 $ wait 00:00:05.00  ! Give remote process time to die  $!C $! Comment the following stuff out for now...I think we don't need  B $! to do it. It would be used if we didn't $FORCEX ZT2 and instead3 $! just stopped ZTNS2 (actually we are doing both).M $!* $! save_message = f$environment("MESSAGE")+ $! set message/nofac/notext/nosever/noident	 $! mount/for/noassist $1$ZTA0: $! set message 'save_message'1 $! $ close: $!, $ write sys$output "Closing network link..." $ close netlinea $ write sys$output ""  $ exit $! $ err_openlink:g $! $ write sys$output ""m $ write sys$output -? "%RMT-F-OPENLINK, Error opening network link to ''remote_node'"s $ write sys$output ""t $ exit $! $ err_start_server:D $! $ write sys$output ""o $ write sys$output -E "%RMT-F-NOSTART, Error starting remote tape server on ''remote_node'"' $ write sys$output ""h $ write netline "**DONE**" $ close netlineu $ exitG $!*********************************************************************  $! $! Gory details :l $!D $! This procedure performs the following tasks in cooperation with a& $! network object on the remote node : $!F $! o Prompts the user for the name of the remote node, and the name of $!   the remote tape device.E $! o Opens a network link to network object #142 on the node with thepB $!   tape drive. Object #142 is just a command procedure that does% $!   various things, described below.tI $! o Waits for the command procedure on the remote side to take the steps $ $!   necessary to put ZTA0: on-line.K $! o Spawns a subprocess to allow the user to use ZTA0: as he pleases. WhenuD $!   the user logs out of the subprocess control is returned to thisC $!   procedure to allow things to be cleaned up neatly (hopefully).UL $! o Cleanup involves dismounting ZTA0 if necessary, $FORCEX'ing the processG $!   which is running the ZT2 image, telling the other side that we area1 $!   all done, and then closing the network link.c $!I $! Network object #142 is a command procedure on the remote that performso $! the following tasks : $!B $! o Opens a channel on SYS$NET to communicate with this procedureM $! o Checks on the availability of the requested device, i.e., does it exist,I, $!   and is it unallocated? Bail out if not. $! o MOUNTs the tapeK $! o Runs the server image ZTNS2 as a subprocess. ZTNS2 starts up a network K $!   object back on this side that fires up the ZT2 image. When all of this 8 $!   happens, ZTA0: magically comes on-line (hopefully)!M $! o Now the procedure issues a READ on SYS$NET, waiting for a control stringpK $!   that indicates that the other side is done with the drive. It also can J $!   detect whether the other side has closed the network link abnormally.4 $! o Dismounts the tape, and closes the network link9 $! o Logs out, thus killing the subprocess running ZTNS2.0  E ---------------------------------------------------------------------U  @ And this is RMT_OBJECT.COM, which sits on the "real-tape" side "   $! RMT_OBJECT.COML $!J $! This procedure is run as a network object to allow a remote DECNET nodeP $! to use a tape drive located on this node. The following tasks are performed : $!F $! o Opens a channel on SYS$NET to communicate with an inbound network $!   object request.M $! o Checks on the availability of the requested device, i.e., does it exist,9, $!   and is it unallocated? Bail out if not. $! o MOUNTs the tape.gK $! o Runs the server image ZTNS2 as a subprocess. ZTNS2 starts up a networkeK $!   object on the other side that fires up the ZT2 image. When all of thisTJ $!   happens, ZTA0: magically comes on-line on the other side (hopefully)!N $! o Then the procedure issues a READ on SYS$NET, waiting for a control stringK $!   that indicates that the other side is done with the drive. It also can J $!   detect whether the other side has closed the network link abnormally,' $!   in which case it cleans up neatly.-4 $! o Dismounts the tape, and closes the network link9 $! o Logs out, thus killing the subprocess running ZTNS2.e $! o $! Written by : Bob Marshall $!              18 May 1993TJ $!************************************************************************ $!
 $ set noon $! $! Open a channel to SYS$NET $!- $ open/read/write/err=oh_well netline sys$netr $!! $ define/nolog sys$output netline ! $ define/nolog sys$error  netlineM $!H $! Read two messsages from the remote procedure. The first should be theD $! the name of the remote node, and the second should be the name of $! the tape drive to use.  $!, $ read/end=oops/err=oops netline remote_node+ $ read/end=oops/err=oops netline local_tape  $!D $ local_tape = local_tape - ":" + ":"    ! Add a colon, if necessary $!  $! Make sure the device exists!  $!( $ if .not. f$getdvi(local_tape,"EXISTS") $ then $   write sys$output "" L $   write sys$output "%RMT-F-NOSUCHDEV, device ''local_tape' does not exist" $   write sys$output ""  $   write netline "**ERROR**"e
 $   goto oopsm $ endifO $!/ $! Make sure it's not allocated to someone elset $! $ if f$getdvi(local_tape,"ALL")o $ then $   write sys$output ""  $   write sys$output -H "%RMT-F-ALLOCATED, device ''local_tape' is allocated to another process" $   write sys$output ""N $   write netline "**ERROR**"d
 $   goto oopso $ endif- $!, $! OK, looks like we're cleared for take-off $!8 $ define/nolog zt_tape 'local_tape'      ! Used by ZTNS2 $!I $! MOUNT the tape; use /NOASSIST so that if the user forgot to physically_G $! prepare the drive, even after being warned, then he loses and has to" $! start all over. $!< $! Note : Remove the /nounload switch when done with testing $!K $ mount/for/noassist/nounload/multi_volume zt_tape   ! Requires VOLPRO privu $!/ $! If the MOUNT failed for any reason, bail outy $! $ if .not. $status $ then& $   write/err=oops netline "**ERROR**"
 $   goto oops  $ endifp $!M $! Change the next line if a network object number other than 141 is desired.e $!G $ define/nolog zt_netobject "''remote_node'::""141="""  ! Used by ZTNS2t $!E $! Run the ZTNS2 program as a subprocess. ZTNS2 will create a link tonD $! object #141 on the ZT-side, which runs a command procedure to runJ $! the ZT2 program. Once this happens, ZTA0: comes on-line on the ZT-side.G $! By running ZTNS2 in a subprocess, we can have control return to thist0 $! command procedure to communicate via SYS$NET. $!, $ spawn/nowait/nolog/output=nla0:  run ztns2 $!: $ wait 00:00:05.00                            ! Wait a bitO $ write/err=link_gone netline "**CONTINUE**"  ! Tell the other side we're readys $!J $! Now just sit and wait for a message to come from the ZT-side indicatingL $! that they are done. If for some reason we never get a "**DONE**" message,J $! then the READ statement below will return an EOF error, and we can just $! clean things up.l $! $ loop:  $!- $ read/end=link_gone/err=done netline messager, $ if message .nes. "**DONE**" then goto loop $! $ done:  $!) $ write/err=link_gone netline "**CLOSE**"d $! $ link_gone: $!, $! REMINDER : Remove /NOUNLOAD after testing $!? $ if f$getdvi(local_tape,"MNT") then dismount/nounload zt_tape , $! $ oops:l $! $ close netlinef $ deassign sys$output  $ deassign sys$error $!
 $ oh_well: $! $ purge/keep=3 netserver.log $ logout/brief $ exit  G -----------------------------------------------------------------------a  0 And some preliminary installation instructions :  D In the discussion below, the node with the actual mag tape device isG referred to as the "real-tape" side; the remote node wishing to use the"& drive is referred to as the "ZT-side".  . Building the software (do this on the ZT-side). ----------------------------------------------  
   $ @BUILD   Things to do on the ZT-side" ---------------------------v  ,   o $ COPY ZTDRIVER.EXE SYS$COMMON:[SYS$LDR]  1   o In SYSTARTUP.COM, add these lines somewhere :1  #     $ SYSGEN CONNECT ZTA0/NOADAPTERf:     $ INSTALL ADD dev:[dir]ZT2.EXE/OPEN/HEADER/PRIV=CMKRNL@     $ INSTALL ADD dev:[dir]ZT2_FORCEX.EXE/OPEN/HEADER/PRIV=WORLDN     $ DEFINE/SYSTEM RMT_REMOTE_NODE nodename  ! Nodename with real-tape deviceI     $ DEFINE/SYSTEM RMT_REMOTE_TAPE device    ! Default remote drive namei  +   o In NCP, define the ZT2 network object :t       $ RUN SYS$SYSTEM:NCPA     NCP> SET/DEFINE OBJECT ZT2 NUMBER 141 FILE dev:[dir]ZT2.COM -i.          [USERNAME username PASSWORD password]  G     (Note : The number 141 is arbitrary; to use a different number justSJ             edit RMT_OBJECT.COM and replace "141" with the desired number)  :   o Define a global symbol in SYLOGIN.COM to run RMT.COM :       $ RMT :== @dev:[dir]RMT.COMi    " Things to do on the real-tape side" ----------------------------------  =   o Copy RMT_OBJECT.COM and ZTNS2.EXE to an appropriate placeN     o Add NCP object :       $ RUN SYS$SYSTEM:NCP7     NCP> SET/DEFINE OBJECT RMT_OBJECT FILE NUMBER 142 -D"          dev:[dir]RMT_OBJECT.COM -,          USERNAME username PASSWORD password       Notes :e  F     - The number 142 is arbitrary. To use a different number just edit6       the file RMT.COM and specify a different number.F     - The username specified for the object must have VOLPRO privilegeA       in order to make the MOUNT/FOREIGN/MULTI_VOLUME command in i(       RMT_OBJECT.COM work. For example :  '       $ SET DEFAULT SYS$COMMON:[SYSEXE]o        $ RUN SYS$SYSTEM:AUTHORIZEB       UAF> ADD username/UIC=[g,m]/PASSWORD=password/DEVICE=device-F                        /DIRECT=[directory]/PRIV=VOLPRO/DEFPRIV=VOLPRO-A                        /NOBATCH/NOLOCAL/NODIALUP/NOREMOTE/NETWORKw       UAF> EXITr  B       (The username/password combination must match that specified,        in the NCP SET/DEFINE object command)   Bob Marshall% marshall@nebula.ssd.lmsc.lockheed.comW