Commit Graph

528 Commits

Author SHA1 Message Date
Peter Lieven
871c56ce7a MEMORY add compatibility for qemu-kvm
qemu-kvm iscsi block driver calls iscsi_parse_full_url without
a valid iscsi_context. The driver also creates its own scsi_task
objects.
2012-11-03 02:05:16 +01:00
Peter Lieven
7f98233169 Merge remote-tracking branch 'upstream/master' 2012-11-03 01:07:40 +01:00
Peter Lieven
d327ab09c6 MEMORY add wrappers around all mallocs and frees and trace them
This patch adds a wrapper around all memory allocations and frees.
The idea is to get warned immediately if the application leaks memory.
Additionally the wrapper functions make it easy to add different
memory allocators or memory pools in the future.
2012-11-03 01:05:57 +01:00
Peter Lieven
389f6a8ba5 SCSI half mallocs in scsi_malloc 2012-10-31 16:46:33 +01:00
Ronnie Sahlberg
6507f4050f Merge pull request #31 from plieven/master
memory leak fixes + suggestion for iscsi context + qemu-kvm bug
2012-10-30 18:54:38 -07:00
Ronnie Sahlberg
1d56c2f970 Merge pull request #33 from jongrimm/master
Skip test for read supported ops, rather than failure
2012-10-30 18:50:48 -07:00
Ronnie Sahlberg
9e9c6946c0 TESTS: Add a test that a target handles an unsolicited DATA-OUT correctly.
Send a large number of DATA-OUT PDUs that do not have a matching SCSI-COMMAND
PDU and verify that the target responds correctly. Either by terminating the
session or by just ignoring the data.

Verify also that the target is not "surprised" and crashes.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-10-30 18:44:35 -07:00
Ronnie Sahlberg
48d5ab9f39 Fix typo
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-10-30 18:33:58 -07:00
Peter Lieven
1d348de71f INIT fix typo in iscsi_parse_url() 2012-10-30 21:00:46 +01:00
Peter Lieven
a9257d52a7 CONNECT only read/write from sockets when connection is established
qemu-kvm/qemu-img starts in+out polls from the socket before the connection is
established. This leads to a hang if the connection cant be established
(i.e. the target is down when qemu-kvm is started).

before:
LIBISCSI_DEBUG=2 qemu-img convert -f iscsi -O raw iscsi://127.0.0.1/iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac/0 /dev/null
libiscsi: connecting to portal 127.0.0.1 [iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac]
libiscsi: read from socket failed, errno:111 [iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac]
libiscsi: connection to 127.0.0.1 established [iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac]
->success!!

after:
LIBISCSI_DEBUG=1 qemu-img convert -f iscsi -O raw iscsi://127.0.0.1/iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac/0 /dev/null
libiscsi: iscsi_service: socket error Connection refused(111) while connecting. [iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac]
libiscsi: Failed to connect to iSCSI socket. iscsi_service: socket error Connection refused(111) while connecting. [iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac]
qemu-img: iSCSI: Failed to connect to LUN : Failed to connect to iSCSI socket. iscsi_service: socket error Connection refused(111) while connecting.
qemu-img: Could not open 'iscsi://127.0.0.1/iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac/0': Invalid argument
qemu-img: Could not open 'iscsi://127.0.0.1/iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac/0'
2012-10-30 17:22:39 +01:00
Peter Lieven
a0fb2d179d ERROR fix error string creation
At some points in the code the error string includes itself. This
generates self-repeating error messages.
2012-10-30 16:38:09 +01:00
Peter Lieven
820410526e INIT fix missing export of iscsi_set_tcp_syncnt() 2012-10-30 12:05:25 +01:00
Peter Lieven
ef3b6fe911 INIT fix url parsing error message 2012-10-30 12:02:09 +01:00
Peter Lieven
ca6f28437a INIT remove redundant url parsing code 2012-10-30 11:56:12 +01:00
Peter Lieven
9f82d0bf83 INIT allow a trailing / in iscsi_parse_portal_url() 2012-10-30 11:47:12 +01:00
Peter Lieven
774ede1f46 ISCSI_URL change strings from dynamic to static 2012-10-30 11:41:51 +01:00
Peter Lieven
e10a5a97be Merge remote-tracking branch 'jongrimm/master' 2012-10-30 11:09:38 +01:00
Jon Grimm
f97cd4f816 Test: 0430_report_all_supported_ops: BUG: Need to set return_timeouts parm again after I know full_size. 2012-10-29 18:07:15 -05:00
Peter Lieven
d989474a36 ISCSI-TEST free strings malloc'ed by libpopt 2012-10-29 22:07:58 +01:00
Peter Lieven
2e30d7aafb CONNECT correctly free ct in case first testunitready fails 2012-10-29 21:37:39 +01:00
Jon Grimm
9f5a315e0c TEST: skip optional return op codes if not supported. 2012-10-29 10:55:02 -05:00
Peter Lieven
923b9a4fb2 ISCSI-CONTEXT change dynamic string allocations to statics 2012-10-27 17:23:40 +02:00
Peter Lieven
0906109d8a CONNECT fix mem leak of connection_task object 2012-10-27 16:31:56 +02:00
Peter Lieven
83ac22abbb Fix memleaks in iscsi-ls, iscsi-inq & iscsi-readcapacity16 2012-10-27 16:18:50 +02:00
Ronnie Sahlberg
74f09ade13 Merge pull request #30 from plieven/master
debug level explaination, small improvement to iscsi-readcapacity16 and bounds check for data_size in socket_receive
2012-10-26 18:32:12 -07:00
Peter Lieven
4785dd9933 CONNECT do not reseed RNG in iscsi_reconnect 2012-10-26 20:47:35 +02:00
Peter Lieven
0b4424cca0 CONNECT Fix memory leak in iscsi_reconnect 2012-10-26 20:47:15 +02:00
Peter Lieven
48e55669e3 SLIST add function to debug length 2012-10-26 18:10:26 +02:00
Peter Lieven
89e918e9d7 SOCKET validate data_size in in_pdu header 2012-10-26 17:12:07 +02:00
Peter Lieven
4e7bd8767b DPRINTF explain debug levels 2012-10-26 08:43:47 +02:00
Peter Lieven
2df2f4f12e ISCSI_READCAPACITY16 add switch to print only target size 2012-10-26 08:39:37 +02:00
Ronnie Sahlberg
1132e4f941 ISCSI_READCAPACITY16 : Update the output to show all fields in the returned data
not just the total size of the device.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-10-25 19:24:09 -07:00
Ronnie Sahlberg
2c7da101b3 Merge pull request #29 from jongrimm/master
Adding MaintenanceIn: Read Supported Opcodes

Good stuff!

This opcode is optional,  so instead of flagging a test failure,  if the opcode returns sense that the opcode is missing then it should just return 'SKIPPED'

Something like
	if (task->status == SCSI_STATUS_CHECK_CONDITION
	    && task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST 
	    && task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {		
		printf("[SKIPPED]\n");
		printf("READSUPPORTEDOPCODES Not Supported\n");
		ret = -2;
		scsi_free_scsi_task(task);
		goto finished;
	}
2012-10-25 18:21:12 -07:00
Jon Grimm
8fbc536779 TYPO: 'calculate' in comments 2012-10-25 12:59:55 -05:00
Jon Grimm
b81bdd3932 Merge with upstream 2012-10-25 12:56:26 -05:00
Jon Grimm
1eaca70a52 Add MaintenanceIn: Report Supported Opcodes (all) and testcase. 2012-10-25 12:48:37 -05:00
Ronnie Sahlberg
9eb5b96a82 Merge pull request #28 from plieven/master
TEST suite fix + skip command
2012-10-25 06:43:46 -07:00
Peter Lieven
03528f3965 TEST: add skip command to skip individual tests
This patch adds a command to skip individual tests. It additionally accepts
more than one test separated by comma.
2012-10-25 10:27:09 +02:00
Peter Lieven
49947fe5e2 TEST: fix unitialized ret variable in T0000 2012-10-25 09:41:28 +02:00
Ronnie Sahlberg
b700d44f03 TESTS: Add a simple test to check that a target survives huge imemdiate data
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-10-24 21:19:27 -07:00
Ronnie Sahlberg
97dcf94d72 iSCSI: when reconnecting we should not automatically requeue any DATA-OUT PDUs
Dont requeue data-out pdus, or other pdus with the DELETE_WHEN_SENT flag, such
as nops.
These, like the DATA-OUT pdu will instead be automatically re-sent when the original write command is sent again.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-10-24 19:32:00 -07:00
Ronnie Sahlberg
a24aca8c50 Merge pull request #27 from plieven/master
small fixes + iscsi-readcapacity16 binary
2012-10-24 19:02:31 -07:00
Peter Lieven
2427926327 ISCSI-READCAPACITY16 modified copyright notice 2012-10-23 17:17:53 +02:00
Peter Lieven
fec061ac68 Add iscsi-readcapacity16 binary
This patch adds a small binary to read the size of an iscsi target. The value
is returned on stdout.
2012-10-23 15:59:28 +02:00
Peter Lieven
56b1e27980 LD_ISCSI fix whitespace 2012-10-23 10:59:07 +02:00
Peter Lieven
6e82c48185 RECONNECT fix read from freed iscsi context 2012-10-23 10:55:04 +02:00
Peter Lieven
c2836e2a9a DPRINTF add iscsi target_name if available
This patch adds the iscsi target name to the debug output
2012-10-23 10:53:14 +02:00
Ronnie Sahlberg
f74266146c Merge pull request #25 from plieven/master
Fix Compiler warnings + add setters for TCP keepalive values
2012-10-22 06:27:16 -07:00
Peter Lieven
afc963c312 LD_ISCSI: cache last result of get_lba_status
get_lba_status returns provisioning for a range of blocks starting
from given lba. Especially for sequential reads its likely that
the next block read is already covered by the last result.

In case there is write support added to ld_iscsi there needs
to be an invalidation code for the cache.
2012-10-21 20:29:39 +02:00
Peter Lieven
bfac1f85a3 LD_SCSI: Introduce get_lba_status in read()
For large continous reads I may be benifical to check if the blocks
that are going to be read are allocated. If they are not allocated
they do not need to be read which massivly speeds up the read.

This behaviour is optional and can be turned on with environment
variable LD_ISCSI_GET_LBA_STATUS=1
2012-10-21 09:24:19 +02:00