Commit Graph

1565 Commits

Author SHA1 Message Date
Ronnie Sahlberg
cda985167d Merge branch 'master' of github.com:sahlberg/libiscsi 2015-12-13 14:34:19 -08:00
Ronnie Sahlberg
3c44092635 Add a feature to request transparent reconnects without any UA
Normal applications want the current behaviour where we have the library
consume any/all of the UnitAttentions that the target may have queued on the
initial connection, but when we reconnect the session after a failure the
library will pass all the UAs back to the application to process.

Some applications, such as the test suite or really trivial applications
might not want to have to deal with handling of UAs and just "make it work".
Those applications can now request that upon any reconnection of the session
that libiscsi will automatically consume any and all UAs and hide them from
the application.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-12-13 14:29:32 -08:00
Ronnie Sahlberg
a48710c9db Merge pull request #186 from ddiss/prout_preempt
test/pr: fix key deregistration in PRout PREEMPT test
2015-12-10 06:31:58 -08:00
David Disseldorp
086f1d1903 test/pr: fix key deregistration in PRout PREEMPT test
Remove duplicate k2 deregistration.

Reported-by: Chris Zankel <czankel@purestorage.com>
Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-12-10 12:02:03 +01:00
Ronnie Sahlberg
74fc637eeb Use MSG_NOSIGNAL with send()
If the server closes the TCP connection before we call send() in
iscsi_write_to_socket() we will get SIGPIPE unless we pass this
argument to send.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-12-06 12:12:49 -08:00
Bart Van Assche
0e0073e818 test-tool: Clear persistent reservation keys before tests are run
If a previous run of the test tool had been interrupted one or
more persistent reservation keys can still be registered. This
can cause tests in the new run to fail. Avoid this by clearing
these keys before running any tests. Do this only if --dataloss
has been specified.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-10-07 07:45:32 -07:00
Bart Van Assche
0bddefca95 test_report_supported_opcodes_one_command: Make reporting more detailed
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-10-07 07:44:59 -07: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
5231923bc8 test_read6_beyond_eol: Fix an assertion failure
Avoid that running the regression tests against a LUN with size zero triggers
the following assertion failure:

lt-iscsi-test-cu: iscsi-support.c:1666: read6: Assertion `task != ((void *)0)' failed.
Aborted

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-10-07 07:43:41 -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
Bart Van Assche
608dbcba12 scsi-lowlevel.c: Use sizeof() instead of a hardcoded constant
This patch does not change any functionality.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-10-07 07:42:30 -07:00
Ronnie Sahlberg
c26710345f Merge pull request #184 from ddiss/pr_report_caps_and_preempt_tests
Persistent Reservation REPORT CAPS and PREEMPT tests
2015-10-07 07:41:16 -07:00
David Disseldorp
b9b414981c test/pr: PRout PREEMPT remove registration test
Check that the Persistent Reserve Out PREEMT request removes the
registration referenced by the service action key.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-30 11:00:25 +02: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
9aa5b55b41 test/pr: simple PRin REPORT CAPABILITIES test
Check that the Persistent Reserve In REPORT CAPABILITIES response
carries valid LENGTH, ALLOW COMMANDS, and PERSISTENT RESERVATION TYPE
MASK fields.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-30 11:00:19 +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
ef8e59a24d lib/scsi: fix PRin REPORT CAPS allow_cmds unmarshalling
The Persistent Reserve In REPORT CAPABILITIES response carries the
ALLOW COMMANDS field in bits 4-6 at byte offset 3.
Bit 7 (TMV) should be masked out during ALLOW COMMANDS unmarshalling.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-30 11:00:13 +02:00
Ronnie Sahlberg
46e606f048 Merge pull request #182 from ddiss/mp_instead_of_reconnect
use multipath for secondary sessions (if available) instead of reconnecting
2015-09-28 19:24:43 -07:00
David Disseldorp
4f55a3f5c3 test/preventallow: use multipath session if available
This test currently reconnects to the base sd for multi-initiator
testing. Use the secondary multipath device instead, if available.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-21 15:53:31 +02:00
David Disseldorp
69d9a77f14 test/sanitize: use multipath session if available
These tests currently reconnect to the base sd for multi-initiator
testing. Use the secondary multipath device instead, if available.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-21 15:52:40 +02:00
David Disseldorp
638d58dd57 test/prout: use multipath session if available
These tests currently reconnect to the base sd for multi-initiator
testing. Use the secondary multipath device instead, if available.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-21 15:47:21 +02:00
David Disseldorp
89c1749ae7 test/reserve6: use multipath session if available
Many tests currently reconnect to the base sd for multi-initiator
testing. Use the secondary multipath device instead, if available.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-21 15:40:18 +02:00
David Disseldorp
0cfc593bbd test/multipath: add helper to obtain secondary sessions
A number of existing tests create a secondary iSCSI session by logging
into the target specified in the base sd during the test.

With multipath sessions now connected during iscsi-test-cu startup
(when launched with multiple URIs), secondary sessions can be
provided via multipath when available, rather than reconnecting.

This change adds a helper that conditionally returns the secondary
multipath device if available, or falls back to creating a new session
via the base sd target details.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-21 15:11:37 +02:00
Ronnie Sahlberg
1540ab460d TESTS: remove extra assert
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-19 16:48:26 -07:00
Ronnie Sahlberg
fae0d70260 TESTS: Dont try to eject the media if preventallow is not supported
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-19 16:29:29 -07:00
Ronnie Sahlberg
e725788eeb TESTS: WriteAtomic fixes to handle devices that do not return BlockLimits VPD
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-19 16:12:01 -07:00
Ronnie Sahlberg
fe1017fe2a TESTS: Don't test WriteSame10/16 if we do not have BlockLimits VPD
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-19 16:06:05 -07:00
Ronnie Sahlberg
67932e870e TEST: Fix number of blocks in Get_LBA_STATUS simple
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-19 15:58:03 -07:00
Ronnie Sahlberg
7924ae5385 TEST: Skip CompareAndWrite DPO/FUA test early if the opcode is not supported.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-19 15:52:44 -07:00
Ronnie Sahlberg
f7ea45e053 TESTS: ReportSuppOpcodes, handle broken targets that return success but no data.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-19 15:47:13 -07:00
Ronnie Sahlberg
d7606c44e2 TESTS: Update checks for DPUFUA bits in CDB_USAE_DATA fields
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-19 15:24:04 -07:00
Ronnie Sahlberg
ac3b1d6e3c TEST: Fix the READ6 tests so they work for linux usb devices
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-19 14:55:58 -07:00
Ronnie Sahlberg
e57b266e91 TESTS: Fix how we compute the max transfer length the bus can handle was broken
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-19 14:41:52 -07:00
Ronnie Sahlberg
3b98737e3c Merge pull request #181 from ddiss/mp_reset_v2
Mp reset v2
2015-09-19 14:12:14 -07:00
David Disseldorp
5c0b1b9913 test/pr: simple PR Out CLEAR test
Check that a Persistent Reserve Out CLEAR request:
- clears an existing reservation
- clears existing registration keys
- bumps the PRgeneration number

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-18 18:06:25 +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
David Disseldorp
a569d55a0e test/multipath: add COMPARE AND WRITE test
Confirm that data is consistent across paths when using the atomic
COMPARE AND WRITE operation.
This should be extended in future to issue the requests simultaneously
across both paths, in an attempt to trigger a read/write race.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-17 19:13:39 +02:00
David Disseldorp
b9dd210194 test/multipath: add logical unit reset test
This test issues a logical unit reset iSCSI TMF request, and then
confirms that all paths report a subsequent unit attention condition.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-17 19:13:39 +02:00
David Disseldorp
6b3ee9931a test/multipath: add helper to check that all paths are iSCSI
MPATH_SKIP_UNLESS_ISCSI(_sds, _num_sds) iterates over all _sds, and
skips the test unless all paths are iSCSI based.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-17 19:13:39 +02:00
Ronnie Sahlberg
2e59742b1f TESTS: Dont assume atomic align/granularity is always reported as non-0
From Alexander Motin <mav@freebsd.org>
Treat BlockLimits VPD atomic granulatity/alignment reported as 0
(no restrictions) as == 1 (also means no restriction).

Both 0 and 1 mean that there is no restriction on alignment or
granularity but with the difference being that the second value can
be used to increment to the next valid LBA.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-12 13:38:02 -07:00
Ronnie Sahlberg
e59d2ce1d3 TESTS: ifdef out iov_tot_len if we do not have SG_IO
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-12 12:43:07 -07:00
Ronnie Sahlberg
fa9df7fdd3 TESTS: Fix the writeatomic tests for targets where atomic granularity != 1
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-10 17:20:06 -07:00
Ronnie Sahlberg
fd55600d39 TESTS: Print correct sense data when a command fail that were expected to succeed 2015-09-10 16:45:24 -07:00
Ronnie Sahlberg
126bbd8b29 TESTS: Add WriteAtomic tests for alignment and granularity
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-09 09:53:09 -07:00
Ronnie Sahlberg
4c87f455ae TESTS: Verify that MAX_ATOMIC_XFER_LEN is <= MAX_XFER_LEN
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-09 06:55:13 -07:00
Ronnie Sahlberg
b4cdf07271 Add tests that BlockLimits VPD matches the AtomicWrite16 support
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-09 06:49:51 -07:00
Ronnie Sahlberg
80b81772e2 Add unmarshalling of VPD BLock Limits settings for atomic writes
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-09 06:49:41 -07:00
Ronnie Sahlberg
6c16f9e322 Add tests for WRITE_ATOMIC_16
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-08 10:17:15 -07:00
Ronnie Sahlberg
02fd6217cb Add support for WRITE_ATOMIC_16
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-08 10:16:57 -07:00