Commit Graph

145 Commits

Author SHA1 Message Date
Anatoliy Glagolev
19d05ab7a7 RTPG support
Implementing support of the Report Target Port Groups command.

Tested on Ubuntu against Pure Storage Flash Array
using designated unit tests and new iscsi-rtpg utility

./iscsi-rtpg  -i iqn.2005-03.org.open-iscsi:6feb2db21ea iscsi://192.168.1.12/iqn.2010-06.com.purestorage:flasharray.4e8d52d82e4b2c0f/1
RTPG retrieved 2 groups
Group 0x0000: preferred 0, format 0x00, ALUA state ACTIVE-OPTIMIZED,flags 0x8f, status code 0x02, port count 65
Ports: [ 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10 0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4a 0x4b 0x4c
0x4d 0x4e 0x4f 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5a 0x5b 0x5c 0x5d 0x5e 0x5f 0x60 0x61 0x62 0x63 0x64 0x65 0x66 0x67
0x68 0x69 0x6a 0x6b 0x6c 0x6d 0x6e 0x6f 0x70 0x71]
Group 0x0001: preferred 0, format 0x00, ALUA state ACTIVE-OPTIMIZED,flags 0x8f, status code 0x02, port count 65
Ports: [ 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x72 0x73 0x74 0x75 0x76 0x77 0x78 0x79 0x7a
0x7b 0x7c 0x7d 0x7e 0x7f 0x80 0x81 0x82 0x83 0x84 0x85 0x86 0x87 0x88 0x89 0x8a 0x8b 0x8c 0x8d 0x8e 0x8f 0x90 0x91 0x92 0x93 0x94 0x95
0x96 0x97 0x98 0x99 0x9a 0x9b 0x9c 0x9d 0x9e 0x9f 0xa0 0xa1 0xa2]
2025-07-03 17:20:52 -06:00
Bart Van Assche
b781b21d50 test-tool, xcopy: Fix target descriptor handling
Fail the XCOPY tests if no appropriate target descriptor is available
instead of causing memory corruption or truncating the descriptor.
2021-09-05 20:00:02 -07:00
Bart Van Assche
ea6b2282d4 Use __attribute__((format(printf, ...))) directly
Instead of defining the macro _R_(), define __attribute__() as a macro for
compilers that do not support __attribute__(), namely Microsoft Visual
Studio.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2021-05-23 11:52:40 -07:00
David Disseldorp
c8992f45b1 test: add support for 0x0A type XCOPY segment descriptors
Type 0x0A segment descriptors provide a 32-bit wide number-of-bytes
field, allowing for much larger copy offloads with a single segment
descriptor.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2020-03-18 18:59:34 +01:00
David Disseldorp
8dbf6e51e2 test: use scsi_set_uintX marshalling helpers for XCOPY
Signed-off-by: David Disseldorp <ddiss@suse.de>
2020-03-18 00:49:36 +01:00
Bart Van Assche
3804f3c2e0 Remove the discard_const() macro
Declare dynamically allocated strings as 'char *' instead of 'const char *'.
Remove the discard_const() macro. Do not test whether or not a pointer is
NULL before calling free() because it is allowed to pass NULL to free().

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2020-02-28 21:54:49 -08:00
Cole Robinson
ea89dcdbf1 test-tool: Use 'extern int' in headers
Without this, linking fails on Fedora rawhide. Example:

...
/usr/bin/ld: test_async_lu_reset_simple.o:/root/libiscsi/libiscsi.git/test-tool/iscsi-support.h:59: multiple definition of `param_list_len_err_ascqs'; iscsi-test-cu.o:/root/libiscsi/libiscsi.git/test-tool/iscsi-support.h:59: first defined here
/usr/bin/ld: test_async_lu_reset_simple.o:/root/libiscsi/libiscsi.git/test-tool/iscsi-support.h:58: multiple definition of `invalid_cdb_ascqs'; iscsi-test-cu.o:/root/libiscsi/libiscsi.git/test-tool/iscsi-support.h:58: first defined here
...

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-15 18:03:11 -05:00
David Disseldorp
2600e538d8 test-tool: add CHECK_FOR_ISCSI() test filter macro
Skip the test if the provided iscsi_ctx is null.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-22 16:40:13 +02:00
David Disseldorp
dd17293bcc test-tool: remove unused iscsi_queue_pdu() symbol overload
All users have now been changed to overload via the iscsi_ctx transport
callback, so the dlsym based overloading can now be dropped.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:29:52 +02:00
Khazhismel Kumykov
22648d9dbf add some missing includes
avoids forward referenced enums, and includes standard type defns

Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
2019-07-14 12:49:05 +10:00
David Disseldorp
31ab1e1ac9 test-tool: add prin_read_keys() allocation_len parameter
Accepting an Allocation Length parameter allows us to test for
truncation of response data, as per SPC5r17 4.2.5.6:
  The device server shall terminate transfers to the Data-In Buffer when
  the number of bytes or blocks specified by the ALLOCATION LENGTH field
  have been transferred or when all available data have been
  transferred, whichever is less.

With this change, all existing prin_read_keys() callers continue to use
same ALLOCATION LENGTH value as earlier (16K).

Signed-off-by: David Disseldorp <ddiss@suse.de>
2018-05-31 23:08:39 +02:00
Bart Van Assche
e5296920e9 test_multipathio_simple: Only compare if READ10 succeeded
Since the data in the read buffer is not valid if READ10() failed,
only compare the data in the read buffer if READ10() succeeded.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-06-14 08:25:38 -07:00
Bart Van Assche
71c797fd1c test-tool: Fix a segmentation fault in test_receive_copy_results_op_params()
Do not access the RECEIVE_COPY_RESULTS() output if this operation
failed.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-01-23 10:55:53 -08:00
Ronnie Sahlberg
39001203b7 TESTS: simple support for READDEFECTDATA10/12
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-09-22 22:43:16 -07:00
Ronnie Sahlberg
bb22ff71eb TESTS: Add tests that a target will reject WriteSame where DataOut has invalid size. 2016-09-21 19:53:22 -07:00
Ronnie Sahlberg
df1dc08eb7 TESTS: cleanup and remove noise warnings for iscsi cmdsn tests
The iscsi cmdsn tests are noisy and generate a lot of [FAILURE]
warnings for things that are expected.
Fix this by do the plumbing to allow using a EXPECT_STATUS_TIMEOUT
for commands we expect will never be replied to and will thus time out.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-07-11 20:50:47 -07:00
Sitsofe Wheeler
b908bdeb99 Tests: WRITESAME 0-blocks fixes and improvements
The current WRITE SAME (WS) 0 blocks test at LBA 0 isn't always correct
because if:
- The target's WSNZ bit set is 0
- The target's MAXIMUM WRITE SAME LENGTH (MWSL) is greater than 0
- We are issuing a WS with a NUMBER OF LOGICAL BLOCKS of 0

then whether the command should return success or failure depends on
whether the starting LBA is within MWSL blocks of the end of the LUN
(see http://www.t10.org/pipermail/t10/2016-May/017988.html for details).

Replace the vestigial code which tried to handle this (but no longer
worked since commit 8585e4509b ) and add
some additional MAXIMUM WRITE SAME LENGTH tests.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
2016-05-30 12:37:58 +01:00
David Disseldorp
bfd614053e test-tool: add test_get_clock_sec() helper
Useful for test IO timeouts.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2016-03-22 21:19:59 +01:00
Ronnie Sahlberg
8a44851128 Tests: Add a helper for the all_zero checker
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-23 19:26:15 -08:00
Ronnie Sahlberg
b4320bd76c Tests: convert tabs to 8 spaces
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 16:17:18 -08:00
Ronnie Sahlberg
efedc02224 Test: Add helper for MODESENSE6
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:52:26 -08:00
Ronnie Sahlberg
9f81ae91fe Tests: Add helper for READCAPACITY10
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:51:42 -08:00
Ronnie Sahlberg
80e06cae30 Tests: Add helped for UNMAP
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:51:34 -08:00
Ronnie Sahlberg
d3913ee864 Tests: add helpers for synchronizecache
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:51:20 -08:00
Ronnie Sahlberg
ea8e4c4115 Tests: add helper for TESTUNITREADY
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:51:11 -08:00
Ronnie Sahlberg
05fb882e19 Tests: add getlbastatus helper
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:50:58 -08:00
Ronnie Sahlberg
23a9278e23 Tests: Add helpers fro preventallow/startstopunit
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:49:22 -08:00
Ronnie Sahlberg
d910bab852 Tests: add helpers for PREFETCH*
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:48:53 -08:00
Ronnie Sahlberg
9d7103e5ac Tests: helpers for READ6
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:48:22 -08:00
Ronnie Sahlberg
935c2cba22 Tests: helper for READCAPACITY16
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:47:59 -08:00
Ronnie Sahlberg
c48283fe75 Tests: add helpers for read*
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:45:23 -08:00
Ronnie Sahlberg
0a814db48f Tests: Add helpers for ORWRITE
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:40:59 -08:00
Ronnie Sahlberg
b01780b9ee Tests: Add helpers for ExtendedCopy and ReceiveCopyResults
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:39:59 -08:00
Ronnie Sahlberg
9afd4a4412 Test: add helpers for reserve6/release6
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:36:18 -08:00
Ronnie Sahlberg
39d128db6d Tests: Add helpers for SANITIZE
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:34:54 -08:00
Ronnie Sahlberg
d18dbe49aa Tests: add helper for WRITEATOMIC16
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:32:41 -08:00
Ronnie Sahlberg
0b5b724f17 Tests: Add helpers for WRITESAME
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:28:59 -08:00
Ronnie Sahlberg
4d1e3aecd0 Tests: add helper macro for REPORT_SUPPORTED_OPCODES
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:25:21 -08:00
Ronnie Sahlberg
f699503f8c Tests: Create helper macro for COMPAREANDWRITE
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:21:46 -08:00
Ronnie Sahlberg
f88bcf61cc Tests: Create a global scratch buffer and avoid allocating memory in the tests
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:17:43 -08:00
Ronnie Sahlberg
b4e4649ae5 Tests: Add helper macros for Verify*
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:14:06 -08:00
Ronnie Sahlberg
eba1ac059a Tests: Add helper macros for Write*
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:07:55 -08:00
Ronnie Sahlberg
bd29dab95b Tests: Create helper macros for the WriteVerify* commands
By creating a helper macros for WriteVerify we can save a lot of boilerplate
code.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:04:36 -08:00
Bart Van Assche
be9b803334 test-tool: Avoid that using receive_copy_results() triggers a use-after-free
Move the scsi_free_scsi_task() call from receive_copy_results() to the
callers of this function to avoid that accessing the unmarshalled data
triggers a use-after-free.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-12-24 10:38:38 -08:00
Bart Van Assche
2d412530c1 test-tool: Move all_zeroes() helper function to iscsi-support.c
This patch does not change any functionality.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-10-07 07:44:18 -07:00
Bart Van Assche
393165d66a test-tool: Remove three casts
This patch does not change any functionality but removes the number
of casts in the test tool source code.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-10-07 07:43:00 -07:00
David Disseldorp
a1d11eb0f9 test: move UA drain helper function into iscsi-support
test_iscsi_tur_until_good() dispatches TUR requests until the target has
cleared all UAs for the given sd, or the maximum number of retries is
reached.
This helper function is useful for any test that needs to deal with UAs
(e.g. PRs), so should be moved out into common code.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-30 11:00:25 +02:00
David Disseldorp
760ae95d9c test: add prout_preempt() helper function
Issue a Persistent Reservation Out PREEMPT request, with keys and type
provided.
PREEMPT allows for the removal of registrations, and replacement of
reservations.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-30 11:00:25 +02:00
David Disseldorp
9c524b37fa test: add prin_report_caps() helper function
Issue a Persistent Reservation In REPORT CAPABILITIES request and parse
the response. Callers can obtain the unmarshalled response data via the
_rcaps parameter.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-30 11:00:19 +02:00
David Disseldorp
a90e5a3d4c test/iscsi-support: PR Out CLEAR helper function
Add a helper function to dispatch Persistent Reserve Out requests with
CLEAR service action.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-18 18:06:19 +02:00