cdi_pr(8)                                                                         cdi_pr(8)

NAME

       cdi_pr - issue SCSI persistent reservation commands to a tape

SYNOPSIS

       cdi_pr -f device [ -v ]

	plus one of:

	-r { k | r }

	-c
	
	  plus one of:

	     r -k key [ -A ]

	     i -k key [ -A ]

	     c -k key

	     p -k new -K old -t { e | E | A | w | W | a }

	     a -k key -K old -t { e | E | A | w | W | a }

	-E -k key

	-R -k key -t { e | E | A | w | W | a }

	-Q

DESCRIPTION

 	The cdi_pr program issues various SCSI Persistent Reservation commands
	to a tape device. It is mainly intended as a tools for exploring the
	behavior of Persistent Reserve and should not normally be used for day-
	to-day operations.

	You may also specify a persistent reservation key. This key is used to
	identify the host you are running on to the tape drive, and may be an 8
	character text string (e.g. NetWorkr) or a text representation of a
	64-bit hex number (e.g. 0x123456789abcdef0). The default reservation
	key is NetWorkr. This utility will always use the "exclusive access"
	type of persistent reservation.

	The cdi_pr program also returns the status of the named SCSI device
	(specified by the -f option).

OPERANDS

       -f     device
            Specifies the device to send the reserve request to.

	Subcommands:

	-r {r|k}
	   Read a drive's current reservations ( r ) or keys ( k ) using
	Persistent Reserve In SCSI command.

	-c r -k key [-A]
	   Send a Persistent Reserve Out register command, with option
	   APTPL bit.

	-c i -k key [-A]
	   Send a Persistent Reserve Out register command with ignore, with
	   option APTPL bit.


	-c c -k key
	   Send a Persistent Reserve Out clear key command.

	-c p -k key -K oldkey -t { e | E | a | w | W | A }
	   Send a Persistent Reserve Out preempt command to preempt the
	   reservation held by key oldkey and replace it with a reservation
	   for key key of type specified by -t.

	-a p -k key -K oldkey -t { e | E | a | w | W | A }
	   Send a Persistent Reserve Out preempt and abort command to pre-
	   empt the reservation held by key oldkey and replace it with a
	   reservation for key key of type specified by -t and abort any
	   currently running tape command.

	-c r -k key [-A]
	   Send a Persistent Reserve Out Register command for key, with
	   optional APTPL bit.

	-E -k key
	   Persistent Reserve Out Release command with specified key (con-
	   fusing, isn't it?)

	-R -k key -t { e | E | A | w | W | a }
	   Persistent Reserve Out Reserve command with specified key and
	   reservation type

	-Q Query the device's Persistent Reserve capabilities. (side
	   effect is to clear any existing reservations and keys).


	Parameters:

	-k persistent reserve key
	   Specifies the key to use for a persistent reservation.

	-K persistent reserve key to preempt
	   Specifies the key to preempt with this persistent reservation.

	A persistent reservation key is a 64-bit value.
	This can hold 8 text characters or a 64-bit number.
	Specify either for this parameter. If the
	key entered starts with 0x (zero x) then it is
	assumed to be a 64-bit number, otherwise it will
	be treated as an 8 character text string. The
	default value if you do not specify a key is NetWorkr.

	-t reservation type
	   Specifies the type of reservation to be made.

	Allowed values are:

	a write exclusive - all registrants

	A exclusive access - all registrants

	e exclusive access - registrants only

	E exclusive access

	w write exclusive - registrants only

	W write exclusive

	For information on those allowed values, consult a
	SCSI-3 specification such as ANSI NCITS 351-2001
	(SPC-2) or SPC-3 working draft T10/1416-D.

OPTIONS

        -v     Run the program in verbose mode.  This option will print out the
              version number of the CDI library used by the program.


EXAMPLES

       Sample output including drive status information:

	   Query different drives for their Persistent Reserve capabilities
	   
	   cdi_pr -f /dev/rmt/1cbn -Q

	       Device /dev/rmt/1cbn (HP Ultrium 2-SCSI ):
	       supports Persistent Reserve but NOT Activate
	       Persist Through Power Loss bit

	   cdi_pr -f /dev/rmt/0cbn -Q

	       Device /dev/rmt/0cbn (HP Ultrium 1-SCSI ):
		does not seem to support Persistent Reserve at all



	    Register from this host with the key "Solaris"

	    cdi_pr -c r -k Solaris -f /dev/rmt/1cbn

	       CDI_PR command Register succeeds
	       Key "Solaris " was successfully registered
	       cdi_info.drivestat is:
		  status = 0, DRIVE_STATUS_READY
		  msg = The tape drive is ready for use


	    Read the keys from this drive

	    cdi_pr -f /dev/rmt/1cbn -r k

	       CDI_PR command Read Keys succeeds
	       Read keys returns:
		  generation = 12
		  data length = 16
		  Keys:
		     "Solaris "
		     "Windows "
		cdi_info.drivestat is:
		  status = 0, DRIVE_STATUS_READY
		  msg = The tape drive is ready for use



	    Reserve  this  drive  using	 the  previously  registered  key   of
	    "Solaris" with reservation type of Exclusive

	    cdi_pr -f /dev/rmt/1cbn -R -k Solaris -t E

	       CDI_PR command Reserve succeeds
	       Reserve of type Exclusive Res only (3) with key "Solaris " was
	       successful cdi_info.drivestat is:
		  status = 0, DRIVE_STATUS_READY
		  msg = The tape drive is ready for use


	    Read the reservations from this drive

	    cdi_pr -f /dev/rmt/1cbn -r r

	       CDI_PR command Read Reservations succeeds
	       Read reservations returns:
		  generation = 12
		  data length = 16
		  Reservations:
		     Key: "Solaris ", type: Exclusive Res only (3),
			scope: LU, scope address: 0
	       cdi_info.drivestat is:
		  status = 0, DRIVE_STATUS_READY
		  msg = The tape drive is ready for use


	    Release  the reservation of this drive that was made using the key
	    "Solaris" of type Exclusive

	    cdi_pr -f /dev/rmt/1cbn -E -k Solaris -t E

	       CDI_PR command Release succeeds
	       Release with key "Solaris" was successful
	       cdi_info.drivestat is:
		  status = 0, DRIVE_STATUS_READY
		  msg = The tape drive is ready for use

	    If the drive is reserved by another host, you should see something
	    like this:

	    cdi_pr -f /dev/rmt/1cbn -r r

	       CDI_PR command Read Reservations succeeds
	       Read reservations returns:
		  generation = 12
		  data length = 16
		  Reservations:
		     Key: "Windows ", type: Exclusive Res only (3),
			scope: LU, scope address: 0
	       cdi_info.drivestat is:
		  status = 0, DRIVE_STATUS_READY
		  msg = The tape drive is ready for use

	       cdi_pr -f /dev/rmt/1cbn -R -k Solaris -t E

	       CDI_PR command Reserve failed.
	       cdi_info.status = CDI_RESERVATION_ERROR (c)
	       cdi_info.drivestat is:
		  status = 0, DRIVE_STATUS_READY
		  msg = The tape drive is ready for use


     % cdi_rewind -f /dev/rmt/2cbn

      CDI_REWIND successful.
       elapsed time for command was 2 seconds
       cdi_info.drivestat is:
         status = 0, DRIVE_STATUS_READY
         msg = The tape drive is ready for use


SEE ALSO

       libcdi(8), cdi_release(8), cdi_reserve(8)

NetWorker 7.6.2			 Jul 14, 11			    cdi_pr(8)