Commit Graph

461 Commits

Author SHA1 Message Date
Peter Lieven
cc2b0c9b1d Set SO_KEEPALIVE before TCP_USER_TIMEOUT
For TCP_USER_TIMEOUT to work it seems to be necessary that SO_KEEPALIVE is
enabled. RFC5482 section 4.2 also says that the TCP_USER_TIMEOUT has to be
less than the keepalive timeout. This means less than 30000 ms in the
current libiscsi default settings for TCP keepalives.
2012-10-18 14:31:09 +02:00
Peter Lieven
326b2ea49d Add backoff mechanism to iscsi_reconnect
This patch adds a linear backoff mechanishm + jitter in case
a reconnect fails. If there is a longer outage this is to
avoid a large amount of simultaneous connects to the storage.
2012-10-18 12:18:40 +02:00
Peter Lieven
f973608578 Add iscsi_tcp_set_user_timeout function
This patch adds a user configurable option to set the TCP_USER_TIMEOUT
socket option. With this timeout set a broken TCP session is shutdown
after a given timeout even there are unacked packets. SO_KEEPALIVE
seems not to work in this case.
2012-10-18 11:55:15 +02:00
Peter Lieven
cb6f2ce252 iSCSI Redirect support
This patch adds support for persistant portals like they are common
to storage arrays with different interfaces or physical members.
2012-10-18 10:48:52 +02:00
Peter Lieven
4cb845477d Add debugging framework
This patch adds a user configurable debug level. For testing
it includes connection info and reporting errors.
2012-10-18 10:36:26 +02:00
Peter Lieven
c4592550d6 Move iscsi_set_tcp_keepalive after socket creation
Socket options should be set directly after socket creation.
2012-10-18 09:40:05 +02:00
Peter Lieven
91267f5aaa Limit immediate and unsolicited data to FirstBurstLength
RFC3270 describes in section 12.14 that immediate and unsolicited data
sent from the initiator to the target must not exceed FristBurstLength
bytes in total.
2012-10-18 09:21:54 +02:00
Ronnie Sahlberg
b673d8ed57 CONNECT: export the iscsi_reconnect() function.
There are situations where you may want to trigger an iscsi reconnect
explicitely from an application so make this function exposed to applications.
2012-10-16 21:30:39 -07:00
Ronnie Sahlberg
676bf2372c TEST: Add test that target reset will release a RESERVE6 2012-10-04 21:37:41 -07:00
Ronnie Sahlberg
06e925f2fd TEST: Add a test to verify that reservation are dropped on session termination 2012-10-01 18:41:08 -07:00
Ronnie Sahlberg
4e35b808a2 Merge pull request #21 from jongrimm/master
Added test (to 420) to have Initiator 2 RELEASE6, when Initiator1 already has reserved.
2012-10-01 18:33:33 -07:00
Jon Grimm
a5cc1fdbe8 Fix merge conflicts 2012-10-01 09:57:06 -05:00
Ronnie Sahlberg
30a32b4335 TESTS: Add two tests that RESERVE6 is dropped on LUN-reset as well as session logout 2012-09-30 09:25:39 -07:00
Ronnie Sahlberg
add9607244 TEST: Add readme for the test tool 2012-09-30 08:43:56 -07:00
Ronnie Sahlberg
c57827fef4 TESTS: Add externs for the two initiator names 2012-09-30 08:31:15 -07:00
Ronnie Sahlberg
b160b95060 TESTS: Add 'initiator2' variable so we can run tests with two different initiatir names
Update the 0420 test to use different initiator names for the two sessions to the target.
2012-09-30 08:25:23 -07:00
Jon Grimm
2b6bc6c687 test: Add test to release from second initiator when already reserved by first initiator. 2012-09-30 07:29:31 -07:00
Jon Grimm
2a2f246615 test: reserve_basic: mem leak cleanup 2012-09-28 11:27:20 -05:00
Jon Grimm
32d9f760d2 test: Add test to release from second initiator when already reserved by first initiator. 2012-09-28 10:09:14 -05:00
Ronnie Sahlberg
da893b0cf9 TEST 0420 cosmetic printf change 2012-09-27 18:49:38 -07:00
Ronnie Sahlberg
0aa14bbe39 TEST: 0420 some cosmetic printf changes 2012-09-27 18:47:15 -07:00
Ronnie Sahlberg
c3adf1d814 Merge pull request #20 from jongrimm/master
RESERVE6/RELEASE6 Commands + testcase.
2012-09-27 18:39:22 -07:00
Ronnie Sahlberg
ce2db039a5 TEST: try to make 0410 nicer
0410 is the first test for the MMC commandset.
This commandset is in hindsight a bit more complex than other commandsets
in that we have to handle quite a lot of cases :
1, if it is not a MMC device, we should check we get INVALID_OPCODE and then
bail.
Then if it is a MMC device, there are at least three different cases we have to
handle:
2.a  If there is no medium in the device
2.b there is media, but the medium is blank
2.c there is readable medium

this makes MMC tests a lot more complex than other commandsets
so we have to try to get this one as nice and simple as possible so we can
reuse this test as the framework when adding other MMC tests.

(even the 2.b test is not 100% right,   since if the medium is BR, then a blank disk will fail with sense,  but blank pre-BD mediums will not fail the READTOC command)
2012-09-27 18:29:57 -07:00
Jon Grimm
602f89f060 TEST: reserve6_basic: Bail with success if command simply isn't supported. 2012-09-27 14:33:32 -05:00
Jon Grimm
26d090e191 Add testcase for RESERVE6/RELEASE6 2012-09-27 14:17:24 -05:00
Jon Grimm
c7d8d2593c Add RESERVE6/RELEASE6 Support. 2012-09-27 12:45:06 -05:00
Ronnie Sahlberg
85e427ea54 SCSI: READTOC change alloclen to a uint32 and encode it in the CDB 2012-09-25 06:54:01 -07:00
Ronnie Sahlberg
b6ac94ed18 Merge pull request #18 from jongrimm/master
Thanks. Great stuff!
2012-09-24 17:08:59 -07:00
Jon Grimm
1619d0e404 TEST: readtoc_basic: check that TOC of lba 0 matches TOC of lba 1 2012-09-24 13:49:18 -05:00
Jon Grimm
67f640f692 TEST: readtoc_basic: change copyright. Add readcapacity to see if media present, and test appropriate read toc behavior if not present. 2012-09-24 13:14:09 -05:00
Jon Grimm
c3c1628c1d read TOC: set XFER_NONE when xferlen==0 to match Ronnie's change 2012-09-24 10:43:07 -05:00
Jon Grimm
d6bea3db52 merge fixup 2012-09-24 10:22:58 -05:00
Jon Grimm
e55ec72f36 Add Read TOC (0x43) Command Support (and basic testcase). 2012-09-24 10:15:00 -05:00
Ronnie Sahlberg
3860520267 TESTS: fix typo 2012-09-21 20:26:40 -07:00
Ronnie Sahlberg
ba14452dc2 TEST: Add a test that reads all reported VPD pages and validates qualifier, type and page-code in the returned data 2012-09-21 20:15:04 -07:00
Ronnie Sahlberg
addc6e53d7 TEST: fix typo in test name 2012-09-21 19:32:00 -07:00
Ronnie Sahlberg
be4f2fdf66 TESTS: Add a test that all mandatory SPC pages are supported by the target 2012-09-21 18:52:51 -07:00
Ronnie Sahlberg
703d9120bc TEST: Add test for TESTUNITREADY
Add an explicit test for this opcode. We already have plenty of implicit tests via the normal iscsi login functions.
2012-09-20 19:38:30 -07:00
Ronnie Sahlberg
6e2f04455f TEST: Add a test that INQUIRY where EVPD==0 but PAGE_CODE!=0 is an error 2012-09-20 18:27:04 -07:00
Ronnie Sahlberg
62b8681409 SCSI: Fix all remaining places where alloc_len==0 means xfer direction should be == NONE 2012-09-19 19:43:01 -07:00
Ronnie Sahlberg
f5d8b61397 TESTS: Change INQ alloc_len test to also test the case where alloc_len is 0 2012-09-19 18:25:07 -07:00
Ronnie Sahlberg
8f98cf3e12 INQUIRY: When alloc_len is set to 0 we should set XFER direction to NONOE, not READ 2012-09-19 18:23:54 -07:00
Ronnie Sahlberg
641027283b TESTS: Add a new test to check standard INQ alloclen
Add a test for the standard INQUIRY data. The iscsi/scsi target should complete
the request successfully for all values of buffersize/allocation_length
of 1 to 255 bytes.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-09-18 19:45:42 -07:00
Ronnie Sahlberg
f3e9ec00c2 Merge branch 'master' of github.com:sahlberg/libiscsi 2012-09-14 18:23:19 -07:00
Ronnie Sahlberg
4b250c0abb Merge pull request #17 from jongrimm/master
ld_iscsi: add xstat64 & friends, + a couple bug fixes in ld_iscsi
2012-09-14 18:20:49 -07:00
Jon Grimm
365f6ddf10 ld_iscsi: add xstat64, lxstat64, fsxstat64, open64 2012-09-14 12:41:11 -05:00
Jon Grimm
a434a90d64 ld_iscsi: minor, use value already calculated in 'lba' local var in call to readcapacity 2012-09-14 12:27:37 -05:00
Jon Grimm
74496e36fd ld_iscsi: don't try to read beyond last lba 2012-09-14 12:22:07 -05:00
Jon Grimm
eb90ab98c1 ld_iscsi: return block size for stat and friends 2012-09-14 12:02:05 -05:00
Jon Grimm
60a96e0ebf off by one error for calculating num_blocks 2012-09-14 11:19:09 -05:00