iscsi-pr: add persistent reservation tool

iscsi-pr uses libiscsi to connect target and issues PR command.
In most cases, iscsi-pr use the same parameters as sg_persist(from sg3-utils).

For example, use iscsi-pr to dump keys by command:
  ~# ./utils/iscsi-pr --read-keys iscsi://192.168.122.44/iqn.2003-01.org.linux-iscsi.bytedance.x8664:sn.a6b7bff3d509/0 -i iqn.2005-03.org.open-iscsi:12345678
  PR generation=0x20, 19 registered reservation keys follow:
    0xabcd1234
    0xabcd
    0xabcd
    0xabc

A few command is not implemented in this patch, add them if necessary
in future.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
This commit is contained in:
zhenwei pi
2022-02-11 18:19:25 +08:00
committed by Bart Van Assche
parent 30dd7c6429
commit fb9c3f93ed
2 changed files with 486 additions and 1 deletions

View File

@@ -3,7 +3,7 @@ AM_CFLAGS = $(WARN_CFLAGS)
AM_LDFLAGS = -no-undefined
LIBS = ../lib/libiscsi.la
bin_PROGRAMS = iscsi-inq iscsi-ls iscsi-swp
bin_PROGRAMS = iscsi-inq iscsi-ls iscsi-swp iscsi-pr
if !TARGET_OS_IS_WIN32
bin_PROGRAMS += iscsi-perf iscsi-readcapacity16
endif