~ubuntu-branches/ubuntu/intrepid/sg3-utils/intrepid

« back to all changes in this revision

Viewing changes to sg_persist.8

  • Committer: Bazaar Package Importer
  • Author(s): Luk Claes
  • Date: 2006-11-05 17:23:29 UTC
  • mfrom: (1.1.4 upstream) (3.1.2 edgy)
  • Revision ID: james.westby@ubuntu.com-20061105172329-l4loha00sk36qz6k
* Non-maintainer upload.
* Fix FTBFS due to old syscall usage (Closes: #395512).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
.TH SG_PERSIST "8" "August 2004" "sg3_utils-1.08" SG3_UTILS
 
1
.TH SG_PERSIST "8" "June 2006" "sg3_utils-1.21" SG3_UTILS
2
2
.SH NAME
3
 
sg_persist \- use the Persistent Reservation In and Out SCSI commands
 
3
sg_persist \- use the Persistent Reserve In and Out SCSI commands
4
4
to manipulate registrations and reservations
5
5
.SH SYNOPSIS
6
6
.B sg_persist
10
10
.PP
11
11
This utility allows Persistent reservations and registrations to be
12
12
queried and changed. Persistent reservations and registrations are
13
 
queried by sub-commands ("service actions" in SPC-3) of the Persistent
14
 
Reservation In (PRIN) SCSI command. Persistent reservations and
15
 
registrations are changed by sub-commands of the Persistent Reservation
 
13
queried by sub-commands (called "service actions" in SPC-4) of the Persistent
 
14
Reserve In (PRIN) SCSI command. Persistent reservations and
 
15
registrations are changed by sub-commands of the Persistent Reserve
16
16
Out (PROUT) SCSI command.
17
17
.PP
 
18
There is a two stage process to obtain a persistent reservation. First an
 
19
application (an I_T nexus in standard's jargon) must register a reservation
 
20
key. If that is accepted (and it should be unless some other I_T nexus has
 
21
registered that key) then the application can try and reserve
 
22
the device. The reserve operation must specify the reservation
 
23
key and a "type" (see the '--prout-type=' option).
 
24
.PP
18
25
It is relatively safe to query the state of Persistent reservations and
19
26
registrations. With no options this utility defaults to the READ KEYS
20
27
sub-command of the PRIN command. Other PRIN sub-commands are
22
29
.PP
23
30
Before trying to change Persistent reservations and registrations users
24
31
should be aware of what they are doing! The relevant sections of the
25
 
SCSI Primary Commands document (SPC-3 most recent draft revision 20
26
 
dated 31st July 2004) are sections 5.6 (general information), 6.11 (for
27
 
PRIN) and 6.12 (for PROUT). To safeguard against accidental use 
28
 
the '--out' option together with a PROUT sub-command (e.g. '--register')
29
 
must be given.
 
32
SCSI Primary Commands document (SPC-4 most recent draft revision 5a
 
33
dated 14th June 2006) are sections 5.6 (general information), 6.11 (for
 
34
PRIN) and 6.12 (for PROUT). To safeguard against accidental use,
 
35
the '--out' option must be given when a PROUT sub-command (e.g. '--register')
 
36
is used.
30
37
.PP
31
38
The older SCSI Reserve and Release commands (both 6 and 10 byte variants)
32
39
are not supported by this utility. In SPC-3, Reserve and Release are 
33
 
deprecated, replaced by Persistent Reservations. See a utility
 
40
deprecated, replaced by Persistent Reservations. Reserve and Release
 
41
have been removed from SPC-4 and Annex B is provided showing how to
 
42
convert to persistent reservation commands. See a utility
34
43
called 'scsires' for support of the SCSI Reserve and Release commands.
35
44
.PP
36
45
The <scsi_device> is required by all variants of this utility apart
38
47
argument (typically but not necessarily the last one) or via
39
48
the '--device=<scsi_device>' (or '-d <scsi_device') option.
40
49
.PP
41
 
SPC-3 does not use the term "sub-command". It uses the term "service action"
 
50
SPC-4 does not use the term "sub-command". It uses the term "service action"
42
51
for this and for part of a field's name in the parameter block associated
43
52
with the PROUT command (i.e. "service action reservation key"). To lessen
44
 
the potential ambiguity the term "sub-command" has been introduced. 
 
53
the potential confusion the term "sub-command" has been introduced. 
45
54
.SH OPTIONS
46
55
.TP
47
56
--clear | -C
48
57
Clear is a sub-command of the PROUT command. It releases the
49
58
persistent reservation (if any) and clears all registrations from the
50
 
device.
 
59
device. It is required to supply a reservation key that is registered
 
60
for this I_T_L nexus (identified by --param-rk).
51
61
.TP
52
62
--device=<scsi_device> | -d <scsi_device>
53
63
This utility needs to have a scsi_device to be specified. This can either
60
70
--hex | -H
61
71
the response to a valid PRIN sub-command will be output in hexadecimal.
62
72
Normally if the PRIN sub-command is recognised then the response
63
 
will be decoded as per SPC-3.
 
73
will be decoded as per SPC-4.
64
74
.TP
65
75
--in | -i
66
 
specify that a Persistent Reservation In SCSI command is required. This
 
76
specify that a Persistent Reserve In SCSI command is required. This
67
77
is the default.
68
78
.TP
69
79
--out | -o
70
 
specify that a Persistent Reservation Out SCSI command is required.
 
80
specify that a Persistent Reserve Out SCSI command is required.
71
81
.TP
72
82
--no-inquiry | -n
73
83
the default action is to do a standard INQUIRY SCSI command and output
88
98
--param-rk=<h> | -K <h>
89
99
specify the reservation key found in the parameter block of the PROUT
90
100
command. Argument is assumed to be hex (up to 8 bytes long). Default value
91
 
is 0.
 
101
is 0. This option is needed by most PROUT sub-commands.
92
102
.TP
93
103
--param-sark=<h> | -S <h>
94
104
specify the service action reservation key found in the parameter block
95
105
of the PROUT command. Argument is assumed to be hex (up to 8 bytes long).
96
 
Default value is 0.
 
106
Default value is 0. This option is needed by some PROUT sub-commands.
97
107
.TP
98
108
--preempt | -P
99
109
Preempt is a sub-command of the PROUT command. Preempts
100
110
the existing persistent reservation (identified by '--param-sark') with
101
 
the current I_T_L nexus (identified by '--param-rk').
 
111
the registration key that is registered for this I_T_L nexus (identified
 
112
by '--param-rk'). The associated '--prout-type<h>' option needs to match
 
113
the type of the reservation.
102
114
.TP
103
115
--preempt-abort | -A
104
116
Preempt and Abort is a sub-command of the PROUT command. Preempts
105
117
the existing persistent reservation (identified by '--param-sark') with
106
 
the current I_T_L nexus (identified by '--param-rk'). ACA and other
107
 
pending tasks are aborted.
 
118
the registration key that is registered for this I_T_L nexus (identified
 
119
by '--param-rk'). The associated '--prout-type<h>' option needs to match
 
120
the type of the reservation. ACA and other pending tasks are aborted.
108
121
.TP
109
122
--prout-type=<h> | -T <h>
110
 
specify the PROUT command's 'type' argument. Required by the 'reserve'
111
 
and 'release' sub-commands. Valid arguments: 1-> write exclusive, 3->
 
123
specify the PROUT command's 'type' argument. Required by 
 
124
the 'register-move', 'reserve', 'release' and 'preempt (and abort)'
 
125
sub-commands. Valid arguments: 1-> write exclusive, 3->
112
126
exclusive access, 5-> write exclusive - registrants only, 6-> 
113
127
exclusive access - registrants only, 7-> write exclusive - all registrants,
114
128
8-> exclusive access - all registrants. Default value is 0 (which is
115
 
an invalid type).
 
129
an invalid type). Each "persistent reservation type" is explained in more
 
130
detail in a subsection of that name in the read reservation section of
 
131
the PRIN command (section 6.11.3.4 of SPC-4 revision 5a). 
116
132
.TP
117
133
--read-full-status | -s
118
134
Read Full Status is a sub-command of the PRIN command. For each registration
119
135
with the given SCSI device, it lists the reservation key and associated
120
 
information. TransportIDs, if supplied in the reponse, are decoded.
 
136
information. TransportIDs, if supplied in the response, are decoded.
121
137
.TP
122
138
--read-keys | -k
123
139
Read Keys is a sub-command of the PRIN command. Lists all the reservation
135
151
.TP
136
152
--register | -G
137
153
Register is a sub-command of the PROUT command. It has 3 different
138
 
actions depending on associated parameters. 1) add a new registration 
139
 
with '--param-rk=0' and '--param-sark=<new_rk>'. 2) Change an existing
140
 
registration with '--param-rk=<old_rk>' and '--param-sark=<new_rk>'.
141
 
3) Delete an existing registration with '--param-rk=<old_rk>' 
142
 
and '--param-sark=0'.
 
154
actions depending on associated parameters. a) add a new registration 
 
155
with '--param-rk=0' and '--param-sark=<new_rk>'; b) Change an existing
 
156
registration with '--param-rk=<old_rk>'
 
157
and '--param-sark=<new_rk>'; or  c) Delete an existing registration
 
158
with '--param-rk=<old_rk>' and '--param-sark=0'.
143
159
.TP
144
160
--register-ignore | -I
145
161
Register and Ignore Existing Key is a sub-command of the PROUT command.
146
162
Similar to '--register' except that when changing a reservation key the
147
 
old key is not specified.
 
163
old key is not specified. The '--prout-sark=<new_rk>' option should also
 
164
be given.
148
165
.TP
149
166
--register-move | -M
150
167
register (another initiator) and move (the reservation held by the current
151
168
initiator to that other initiator) is a sub-command of the PROUT command.
152
 
It requires the transportID of the other initiator.
 
169
It requires the transportID of the other initiator. [The standard uses the
 
170
term I_T nexus but the point to stress is that there are two initiators
 
171
(the one sending this command and another one) but only one target.]
 
172
The '--param-type=<h>' and '--param-rk=<h>' options need to match that of
 
173
the existing reservation while '--param-sark=<h>' option specifies the
 
174
reservation key of the new (i.e. destination) registration.
153
175
.TP
154
176
--relative-target-port=<h> | -Q <h>
155
177
relative target port number that reservation is to be moved to by 
158
180
.TP
159
181
--release | -L
160
182
Release is a sub-command of the PROUT command. It releases the
161
 
current persistent reservation. The '--prout-type' must also be specified.
 
183
current persistent reservation. The '--prout-type=<h>' 
 
184
and '--prout-rk=<h>' options, matching the reservation, must also be
 
185
specified.
162
186
.TP
163
187
--report-capabilities | -c
164
188
Report Capabilities is a sub-command of the PRIN command. It lists
167
191
.TP
168
192
--reserve | -R
169
193
Reserve is a sub-command of the PROUT command. It creates a new
170
 
persistent reservation (if permitted). The '--prout-type' must also be
171
 
specified.
 
194
persistent reservation (if permitted). The '--prout-type=<h>'
 
195
and '--prout-rk=<h>' options must also be specified.
172
196
.TP
173
197
--transport-id=<h>,<h>... | -X <h>,<h>...
174
198
a transportID is required for the PROUT 'register and move' sub-command
186
210
and is optional for the PROUT 'register' and 'register and ignore
187
211
existing key' sub-commands. The latter two sub-commands can take multiple
188
212
transportIDs in a list. The argument is '-' which indicates
189
 
stdin should be read for the transportID(s). Empty lines and those starting
190
 
with '#' are ignored. Leading spaces and tabs are ignored. All numbers
 
213
stdin should be read for the transportID(s). Empty lines are ignored.
 
214
Everything from and including a "#" on a line is ignored.
 
215
Leading spaces and tabs are ignored. All numbers
191
216
are assumed to be hexadecimal and can be separated by space, comma or
192
217
tab. There can be one transportID per line. TranportIDs will be padded
193
218
out with zeroes to 24 bytes which is the minimum length of a
196
221
.TP
197
222
--unreg | -U
198
223
optional when the PROUT register and move sub-command is invoked. If given
199
 
it will unregister the current initiator after the other initiator
 
224
it will unregister the current initiator (I_T nexus) after the other initiator
200
225
has been registered and the reservation moved to it. When not given the
201
226
initiator (I_T nexus) that sent the PROUT command remains registered.
202
227
.TP
220
245
will work in the 2.6 series kernels.
221
246
.PP
222
247
The only scope for PROUT commands supported in the current draft of 
223
 
SPC-3 is "LU_SCOPE". Hence there seems to be no point in offering an
 
248
SPC-4 is "LU_SCOPE". Hence there seems to be no point in offering an
224
249
option to set scope to another value.
 
250
.PP
 
251
Most errors with the PROUT sub-commands (e.g. missing or 
 
252
mismatched '--prout-type=<h>' option) will result in a RESERVATION
 
253
CONFLICT status. This can be a bit confusing when you know there is
 
254
only one (active) initiator: the "conflict" is with the SPC standard, not
 
255
another initiator.
225
256
.SH EXAMPLES
226
257
.PP
227
258
Due to defaults the simplest example executes the 'read keys' sub-command
238
269
.PP
239
270
   sg_persist -r /dev/sda
240
271
.PP
241
 
To register the new reservation key 0x123abc the following could be used:
242
 
.PP
243
 
   sg_persist --out --register --param-rk=0
244
 
.br
245
 
              --param-sark=123abc /dev/sda
246
 
.PP
247
 
Given the above registration succeeds, a reservation (of type 'write
248
 
exclusive') may be obtained with:
 
272
To
 
273
.B register
 
274
the new reservation key 0x123abc the following could be used:
 
275
.PP
 
276
   sg_persist --out --register --param-sark=123abc /dev/sda
 
277
.PP
 
278
Given the above registration succeeds, to
 
279
.B reserve
 
280
the given device (with type 'write exclusive') the following
 
281
could be used:
249
282
.PP
250
283
   sg_persist --out --reserve --param-rk=123abc
251
284
.br
252
285
              --prout-type=1 /dev/sda
253
286
.PP
 
287
To
 
288
.B release
 
289
the reservation the following can be given (note that
 
290
the --param-rk and --prout-type arguments must match those of the
 
291
reservation):
 
292
.PP
 
293
   sg_persist --out --release --param-rk=123abc
 
294
.br
 
295
              --prout-type=1 /dev/sda
 
296
.PP
 
297
Finally to
 
298
.B unregister
 
299
a reservation key (and not effect other
 
300
registrations which is what '--clear' would do) the command
 
301
is a little surprising:
 
302
.PP
 
303
   sg_persist --out --register --param-rk=123abc /dev/sda
 
304
.PP
 
305
Now have a close look at the difference between the register and
 
306
unregister examples above.
 
307
.PP
254
308
An example file that is suitably formatted to pass transportIDs via
255
309
the '-transport-id=-' option can be found in the examples sub-directory
256
310
of the sg3_utils package. That file is called 'transport_ids.txt'.
 
311
.SH EXIT STATUS
 
312
The exit status of sg_persist is 0 when it is successful. Otherwise see
 
313
the sg3_utils(8) man page.
257
314
.SH AUTHOR
258
315
Written by Doug Gilbert
259
316
.SH "REPORTING BUGS"
260
317
Report bugs to <dgilbert at interlog dot com>.
261
318
.SH COPYRIGHT
262
 
Copyright \(co 2004 Douglas Gilbert
 
319
Copyright \(co 2004-2006 Douglas Gilbert
263
320
.br
264
321
This software is distributed under the GPL version 2. There is NO
265
322
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
266
323
.SH "SEE ALSO"
267
 
.B scsires(internet)
 
324
.B scsires(internet), examples/sg_persist_tst.sh(sg3_utils tarball)