Commit Graph

663 Commits

Author SHA1 Message Date
Ronnie Sahlberg b5c1c8705a Merge branch 'prefix_fix' of https://github.com/stefanha/libiscsi into stefanha-prefix_fix 2011-02-25 14:11:28 +11:00
Ronnie Sahlberg d1fdaef5c6 Username/password separator: Allow ':' to separate the chap username/password in addition to '%' 2011-02-20 10:44:53 +11:00
Stefan Hajnoczi 7ed8707633 Let DESTDIR and LIBDIR override prefix and libdir
The following used to fail:

  ./configure --prefix=/tmp/libiscsi
  make install

This was because DESTDIR was unconditionally used in Makefile.in.
Instead, use the prefix from ./configure unless overriden by DESTDIR
and/or LIBDIR.

Note that this commit drops ldconfig from the Makefile but I'm not sure
this is wanted outside of packaging anyway.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
2011-02-19 15:57:47 +00:00
Ronnie Sahlberg b1955c69ff TODO: We now support task management functions 2011-02-19 18:24:21 +11:00
Ronnie Sahlberg c07dee474c TaskManagement: Add LunReset, TargetWarmReset, TargetColdReset 2011-02-19 18:23:03 +11:00
Ronnie Sahlberg 6a2a8b5187 TaskManagement: Add a function for abort task set 2011-02-19 18:18:56 +11:00
Ronnie Sahlberg b81d21ce8c TaskManagement: Add a function to abort a scsi_task 2011-02-19 18:04:55 +11:00
Ronnie Sahlberg fb34c5615a Update the example with a task management call to abort a task 2011-02-19 18:04:22 +11:00
Ronnie Sahlberg 4315ee9225 Create _send() functions for all scsi commands that return a 'handle'
we can use to abort the task later.
2011-02-19 17:30:03 +11:00
Ronnie Sahlberg 09446737aa TaskMgmt: add a enum for the task management functions 2011-02-15 22:03:41 +11:00
Ronnie Sahlberg 9c7ca31482 TaskMgmt: Add handling of tm responses we receive from the target 2011-02-15 21:58:29 +11:00
Ronnie Sahlberg 3dfdebcba7 TaskMgmt : Add an initial function to create a iscsi tm PDU 2011-02-15 21:53:47 +11:00
Ronnie Sahlberg 332ea04e8d TaskMgmt: Add a functionto set the Reference cmdsn for tm pdus 2011-02-15 21:44:16 +11:00
Ronnie Sahlberg 95db35e592 TaskMgmt: add a function to set the ritt for tm pdus 2011-02-15 21:42:23 +11:00
Ronnie Sahlberg 2c093d86a6 whitespace changes to the list of pdu types 2011-02-15 21:26:26 +11:00
Ronnie Sahlberg 704288169f Add task management pdu request and response constants to the list of pdu types 2011-02-15 21:24:24 +11:00
Ronnie Sahlberg f73e42ec26 TaskManagement: Store the ITT and CMDSN in the scsi_task structure
These are required for some of the task management functions
2011-02-15 20:57:03 +11:00
Ronnie Sahlberg b51807e65a README update 2011-02-13 08:09:08 +11:00
Ronnie Sahlberg e3af8903ac README remove strace from example 2011-02-13 08:06:30 +11:00
Ronnie Sahlberg 52b7ae3152 LD_PRELOAD: add dup2 support so we can use it with dd 2011-02-13 07:36:26 +11:00
Ronnie Sahlberg 0c6025b01b Using two different structures, with the same first element, and casting
between them makes compilers complain about aliasing.

Merge the two and use one single structure bot both iscsi and scsi sync
commands so that gcc stops crying about strict-aliasing
2011-02-09 15:51:45 +11:00
Ronnie Sahlberg 7a454aa010 autogen.sh: we should create libiscsi.pc not ctdb.pc 2011-02-07 21:47:26 +11:00
Ronnie Sahlberg 947a1a7796 MAKEFILE: Add a distclean target 2011-02-07 21:46:57 +11:00
Ronnie Sahlberg 35821830d6 LD_ISCSI.SO LD_PRELOAD hack
ld_iscsi.so is a small LD_PRELOAD hack that can be used to make normal
unix utilities such as 'stat' and 'cat' become iSCSI 'aware' and fake
handling an iSCSI URL as a normal read-only file.

See README for examples.
2011-02-05 21:21:52 +11:00
Ronnie Sahlberg eba0a2de81 SYNC READ10 : add a sync version for read10 2011-02-05 20:41:02 +11:00
Ronnie Sahlberg c29b9a2aae Add a new "iscsi_queue_length()" which will tell us how many commands
are in flight at the moment.
Aside from commands, we also consider the "has not yet connected completely" as being an i/o.

When this command returns 0 it means we are connected ant the iscsi connection is idle, with no commands in flight.

KVM needs a function to detect idleness like this for its block layer io_flush
function.
2011-02-03 19:08:16 +11:00
Ronnie Sahlberg d22a2aee3c When initializing a new session, default to set the
"random" ISID randomly.

Dont assume that users will never create multiple contexts
concurrently, in which case the previous getpid()^time(NULL)
would create duplicates.
2011-01-27 11:02:16 +11:00
Ronnie Sahlberg ca1e152f2c New example file :
iscsi-dd can be used to copy the content of one iscsi lun onto a different
iscsi lun of the exact same sixe.

This example  illustrates how to "steal" a task structure from a callback
so we can use store it and have it remains valid after the read10 callback
has completed.
It also illustrates the async api of libiscsi for read10/write10.

Initially a number of read10 calls are made asynchronously until the
queue is full.
As each read10 completes and returns data, we issue a write10 to write
that data to the other lun.

As soon as a write10 completes, we "release" the initial read10 task corresponding to what we wrote and issue a new read10 to continue copying the next set of un-read data.

Using the async api, it should be easy to get very high performance and
throughput even from one single thread.
2011-01-23 18:35:58 +11:00
Ronnie Sahlberg ec08fe7a45 Read10/Write10 parameters
LBA is uint32_t for read/write10

Also store the lba/numblocks arguments in the task structure for read10/write10
This makes it much easier to implement a fully async "read lots/write lots"
applications.
2011-01-23 18:34:16 +11:00
Ronnie Sahlberg 7b5ff1095c Improve help/usage strings for iscsi-ls and iscsi-inq
For help output, also print the syntax for the iscsi url required.
2011-01-09 10:36:53 +11:00
Ronnie Sahlberg b2c4bdcd43 iscsi-ls: Destroy the iscsi_url when exiting. 2011-01-09 09:51:26 +11:00
Ronnie Sahlberg f3f2031a8c Fix a compiler warning 2011-01-09 09:48:59 +11:00
Ronnie Sahlberg b9ad4beb41 Replace rindex() with strrchr() 2011-01-09 09:47:39 +11:00
Ronnie Sahlberg 5e11bb17b1 Replace index() with strchr() 2011-01-09 09:46:42 +11:00
Ronnie Sahlberg f1996d26a6 Check the return from asprintf() and report an error when it fails. 2011-01-09 09:43:33 +11:00
Ronnie Sahlberg e312aa2ae0 ISID: Add helper functions to set any type of ISID value for the iscsi context.
Let default be to create a 'random' ISID during context creation.
2011-01-09 09:26:03 +11:00
Ronnie Sahlberg b5d5370b8c TYPO, fix typo in iscsi.h 2011-01-09 09:04:13 +11:00
Ronnie Sahlberg 554670820b README: Add a blurb about HeaderDigest in libiscsi and what is the default 2011-01-09 08:58:32 +11:00
Ronnie Sahlberg 3b6176ad79 README: add a note about ipv6 support and ipv6 syntax 2011-01-09 08:54:58 +11:00
Ronnie Sahlberg 954e55148a TODO: expand on what we need to do to handle target-originated iscsi-nop. 2011-01-08 16:19:13 +11:00
Ronnie Sahlberg acd459ad48 TOTO: ipv6 is done 2011-01-08 16:10:59 +11:00
Ronnie Sahlberg aa916b7802 IPv6 Support. Add ipv6 support to the socket management.
IPv6 addresses are specified in [...] format.

iscsi://10.1.1.27/...
iscsi://10.1.1.27:3260/...
iscsi://[fec0::1]/...
iscsi://[fec0::1]:3260/...
2011-01-08 16:09:14 +11:00
Ronnie Sahlberg 7d702357d1 TODO: we need ipv6 at some stage 2011-01-06 20:03:23 +11:00
Ronnie Sahlberg c877737b36 Add redirect support to TODO 2011-01-06 12:15:16 +11:00
Ronnie Sahlberg 827cf9af05 iscsi-ls --show-luns: We need to remember the username/password used
during the initial discovery login so we can use it again when we do
the normal logins to do inquiry/readcapacity for --show-luns
2011-01-03 18:16:40 +11:00
Ronnie Sahlberg 6f36a6ca2b Change HeaderDigest to default to None,CRC32C instead of None
This allows our default setting to work with any target configuration.
2011-01-03 15:54:38 +11:00
Ronnie Sahlberg 9ddce8dc24 Replace bzero() with memset() 2011-01-03 15:35:36 +11:00
Ronnie Sahlberg 77f1440b65 iscsi-ls: Use the helper function to parse the Portal URL
and add support for CHAP authentication during the discovery login.
2011-01-03 15:28:44 +11:00
Ronnie Sahlberg 7253a667ae Add a helper function to parse a Portal URL.
A Portal URL is of the form
   iscsi://[<username>[%<password>]@]<host>[:<port>]
and is used by command such as iscsi-ls during the discovery login phase.

During discovery we do not yet know the target iqn name, nor the lun of
any devices.
2011-01-03 15:22:01 +11:00
Ronnie Sahlberg 51662af5ba Document the iSCSI URL syntax and how to specify username/password 2011-01-03 15:10:15 +11:00