Commit Graph

1883 Commits

Author SHA1 Message Date
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
David Disseldorp
2ae45ac15d test-tool/OverwriteReserved: override driver queue_pdu() callback
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:29:52 +02:00
David Disseldorp
e5cc079e7c test-tool/OverwriteReserved: skip unless iSCSI
This test performs PDU manipulation so should only be run against iSCSI
devices.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:29:52 +02:00
David Disseldorp
77279dd44f test-tool/CryptoEraseReserved: override driver queue_pdu() callback
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:29:52 +02:00
David Disseldorp
c830a3b55e test-tool/CryptoEraseReserved: skip unless iSCSI
This test performs PDU manipulation so should only be run against iSCSI
devices.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:29:52 +02:00
David Disseldorp
b705f9e524 test-tool/BlockEraseReserved: override driver queue_pdu() callback
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:29:52 +02:00
David Disseldorp
fdc45fadfa test-tool/BlockEraseReserved: skip unless iSCSI
This test performs PDU manipulation so should only be run against iSCSI
devices.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:29:52 +02:00
David Disseldorp
153ca193fa test-tool/iSCSIDataSnInvalid: override driver queue_pdu() callback
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.
This commit also removes a number of unnecessary "WRITE10 is not
implemented" checks, which should all be caught by the first check.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:29:52 +02:00
David Disseldorp
575ba2244c test-tool/iSCSICmdSnTooHigh: override driver queue_pdu() callback
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:16:30 +02:00
David Disseldorp
c067eef9c1 test-tool/iSCSICmdSnTooLow: override driver queue_pdu() callback
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:16:30 +02:00
David Disseldorp
310e9ace02 test-tool/Compare&Write: override driver queue_pdu() callback
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert the Compare&Write InvalidDataOutSize test to use
the regular transport driver callback for this purpose.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:16:30 +02:00
David Disseldorp
60a5856f00 test-tool/Compare&Write: skip InvalidDataOutSize unless iSCSI
This test performs PDU manipulation so should only be run against iSCSI
devices.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:16:30 +02:00
Ronnie Sahlberg
e7fb116f7c Merge pull request #298 from ddiss/sendtargets
discovery: permit SendTargets on normal sessions
2019-09-12 07:27:51 +10:00
David Disseldorp
4ecc34706b discovery: permit SendTargets on normal sessions
rfc3720 indicates that SendTargets on discovery *and* normal operational
sessions must be supported by targets:
   A system that contains targets MUST support discovery sessions on
   each of its iSCSI IP address-port pairs, and MUST support the
   SendTargets command on the discovery session.
   ...
   A target MUST support the SendTargets command on operational
   sessions...

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-11 16:17:22 +02:00
Ronnie Sahlberg
54078c6ba9 Merge pull request #296 from smartxworks/dev
update tests/.gitignore
2019-07-19 13:46:19 +10:00
Kyle Zhang
93c7b7a7e3 update tests/.gitignore
Signed-off-by: Kyle Zhang <kyle@smartx.com>
2019-07-19 10:10:23 +08: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
Khazhismel Kumykov
08cd206c4a test-tool: fix async read/write test for bs != 512
Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
2019-07-14 12:47:47 +10:00
Ronnie Sahlberg
eea5d3ba8e new version 1.19.0
Minor updates to the library

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2019-07-14 08:04:44 +10:00
Ronnie Sahlberg
d1e589655b win32: we don't have a vsbuild.bat file any more
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2019-07-14 07:53:18 +10:00
Khazhismel Kumykov
4409521cb6 test-tool: fix mpio_async_caw for bs != 512
wr_buf was hardcoded with blocksize 512, resulting in incorrect behavior
for larger block sizes, and buffer overflow. Use the block_size global.

Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
2019-07-14 07:46:08 +10:00
Ronnie Sahlberg
676dfc213e Merge pull request #295 from ddiss/mpio_misc
test_multipathio_simple: change data with path
2019-07-09 19:45:31 +10:00
David Disseldorp
cdf32e64d7 test_multipathio_simple: change data with path
This makes the data consistency check slightly more useful.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-07-09 11:24:33 +02:00
Ronnie Sahlberg
29df7d8171 Merge pull request #291 from sumitrai/RDMAExtensions_Support
Added support for iSER related iSCSI keys
2019-06-12 18:53:35 +10:00
Sumit Rai
b3a1d99e27 Added support for iSER related iSCSI keys
Added support for negotiating below keys:
RDMAExtensions, TargetRecvDataSegmentLength, and
InitiatorRecvDataSegmentLength.

These are required to support iSER. See RFC5046 Section 6.
2019-06-12 14:10:31 +05:30
Ronnie Sahlberg
b26e15932a Merge pull request #290 from ddiss/fix_mpio_clear_pr
test-tool: fix MPIO clear_pr() behaviour
2019-05-09 07:37:22 +10:00
David Disseldorp
1af3314e2b test-tool: fix MPIO clear_pr() behaviour
clear_pr() can be called before connect_scsi_device() has been invoked
on each MPIO sdev. This results in a NULL pointer dereference in the
send_scsi_command() MPIO NOP-responder code-path.

Fix this by invoking clear_pr() after the MPIO connect_scsi_device()
loop has run. clear_pr() also only needs to be invoked via a single
path, so do so via the first path only.

Link: https://github.com/sahlberg/libiscsi/issues/289
Fixes: 16435a9 ("iscsi-test-cu: Improve persistent reservation clearing")
Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-04-15 14:32:54 +02:00
Ronnie Sahlberg
cdd0448052 Merge pull request #286 from crawfxrd/dir-locals
Replace file variables with .dir-locals.el
2019-02-22 08:46:23 +10:00
Tim Crawford
9347cfebf2 Replace file variables with .dir-locals.el
Signed-off-by: Tim Crawford <tcrawford@datto.com>
2019-02-21 11:54:02 -05:00
Ronnie Sahlberg
6da503eba5 Merge pull request #283 from yann-morin-1998/yem/no-test
buildsys: add options to disable part of the build, fix cunit detection
2019-02-05 13:10:11 +10:00
Ronnie Sahlberg
d397e7d369 Merge pull request #284 from bvanassche/master
Three bug fixes for the libiscsi test tool
2019-02-05 13:08:58 +10:00
Bart Van Assche
16435a917d iscsi-test-cu: Improve persistent reservation clearing
Clear persistent reservations before sending the first SCSI command to the
target to avoid that that command fails due to persistent reservations left
behind by a previous run of the test tool.

Avoid that a subsequent test fails if a test did not remove the persistent
reservations it obtained.

Make sure that clear_pr() returns -1 if clearing persistent reservations
fails.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2019-01-13 11:53:09 -08:00
Bart Van Assche
1bd1232a2a Move the clear_pr() function definition
This patch does not change any functionality.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2019-01-13 11:52:47 -08:00
Bart Van Assche
663aad13ba Avoid that iscsi_reconnect() crashes
In the else branch, set the tmp_iscsi->old_iscsi pointer instead of the
iscsi->old_iscsi pointer.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2019-01-13 11:48:28 -08:00
Bart Van Assche
a15c2a5c61 test-tool/test_prin_read_keys_truncate: Do not crash if PERSISTENT RESERVE IN fails
Do not try to dereference the 'rk' pointer if it is NULL.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2019-01-13 11:48:08 -08:00
Yann E. MORIN
a8d54cc82d buildsys: add option to enable/disable building the examples
In a production system, the examples are not needed.

Add a configure option to disable building the examples.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2018-12-04 10:47:34 +01:00
Yann E. MORIN
eec4954986 buildsys: add option to enable/disable build of test-tool
When doing a production system, the production environment has been
pre-validated (with this test-toll or by other means), so the teest-tool
is not needed in production.

Add a configure option to disable building test-tool.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2018-12-04 09:27:32 +01:00
Yann E. MORIN
fb2e460df9 buildsys: add option to enable/disable building tests
When doing cross-compilation, the tests are meant to be run on the
target. However, they are currently not installed, so it does not make
sense to build tehm to start with.

Additionally, when doing a system for production, those tests are not
needed anyway.

Add a configure option to disable building the tests altogether.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2018-12-04 09:27:32 +01:00
Yann E. MORIN
b8a28fad54 buildsys: handle ac_cv_cunit as a true cache-val
The ac_cv_-prefix variables are supposed to be settable from the command
line, à-la: ./configure ac_cv_foo=no

The canonical way of doing so is to use AC_CACHE_VAL() or AC_CACHE_CHECK().
The latter is to be preferred in our case, as it handles printing the
message for us.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2018-12-04 09:27:30 +01:00
Ronnie Sahlberg
ac9a8e5aed Merge pull request #279 from ddiss/fix-nopin-data
fix NOP-In data segment handling and cleanup ISCSI_HEADER_SIZE usage
2018-10-30 09:08:47 +10:00
David Disseldorp
9d31150e9d socket: improve ISCSI_HEADER_SIZE readability
The ISCSI_HEADER_SIZE macro accesses iscsi->header_size, so pass it in
as a parameter to make it easier to follow callers.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2018-10-25 23:38:59 +02:00
David Disseldorp
009892b017 socket: calculate hdr_size once per PDU process loop
ISCSI_HEADER_SIZE is determined based on the iscsi->header_digest
setting, which may change via iscsi_process_pdu().

Signed-off-by: David Disseldorp <ddiss@suse.de>
2018-10-25 23:38:59 +02:00
David Disseldorp
96dc6e7ebd socket: check for malloc failure before dereference
Signed-off-by: David Disseldorp <ddiss@suse.de>
2018-10-25 23:38:59 +02:00
David Disseldorp
d7530757df examples: don't assume NOP-In data is zero terminated
Signed-off-by: David Disseldorp <ddiss@suse.de>
2018-10-25 23:38:59 +02:00
David Disseldorp
15021faf19 lib: properly pass through NOP-In data segment
data_pos corresponds to the data_segment_length (+ padding), so should
always be passed to the NOP-In callback if greater than zero.

Fixes: https://github.com/sahlberg/libiscsi/issues/278

Signed-off-by: David Disseldorp <ddiss@suse.de>
2018-10-25 23:38:41 +02:00
Ronnie Sahlberg
04d6c326b8 Add some missing includes
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-10-17 05:43:10 +10:00
Ronnie Sahlberg
83dbc4ff84 Merge pull request #275 from franciozzy/isid_2
Call srand() only once
2018-10-17 05:39:44 +10:00
Ronnie Sahlberg
6fa5eaff13 Merge pull request #274 from bonzini/for-gcc-8
Fix warnings from Coverity and GCC 8
2018-10-09 08:11:58 +10:00
Felipe Franciosi
41af44eba1 iscsi_create_context: call srand() only once
iscsi_create_context() calls srand() every time a new context is
generated. That practice is questionable, as the seed does not need to
change before each call to rand(). As a matter of fact, doing so defeats
the purpose of using rand() altogether. Furthermore, the current
implementation is not thread safe.

This improves ISID generation by using /dev/urandom (when available) as
a seed, and calling srand() only once. In case of errors, fallback to
using something similar to the previous implementation (albeit
thread-safe).

Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2018-10-05 18:10:07 +01:00
Paolo Bonzini
bffafc1c30 avoid truncation when logging message that includes target name 2018-10-04 14:06:39 +02:00