OCS Linux iSCSI open-iscsi initiator

Updated: 2-Jul-13

Description

    The OCS Linux open-iscsi Initiator (ocs_openiscsi) module allows the open-iscsi initiator
    to use the OCS Linux iSCSI Ramdisk driver (ocs_iscsi_ramd) as an interface.  The module
    registers with ocs_iscsi_ramd as an initiator, then registers with open-iscsi as a
    transport.  Emulex HBAs supported by ocs_iscsi_ramd will then be presented to the SCSI Midlayer
    as available SCSI host devices.

Unpack and build

    Perform the following steps:

        # create a build directory
        mkdir build_dir
        cd build_dir
        # extract tar file
        tar xfv <tarfile>

    Compilation

        # move to directory containing makefile
        cd driver/linux/ocs_openiscsi
        # build it
        make

Patch or update open-iscsi

    The open-iscsi tools must be aware of the ocs driver.  There are two options to 
    accomplish this: install the latest open-iscsi package or patch and rebuild the
    tools from source.
  
    Option 1:  Install latest open-iscsi
        The latest development version of open-iscsi has the necessary changes included.
        The following steps describe how to get the latest source, build, and install it:
 
        # Install git if necessary
            yum install git
    
        # Retrieve the source using git
            git clone git://github.com/mikechristie/open-iscsi.git

        # Build the source
            cd open-iscsi
            make

        # NOTE:  The build may fail when building iscsistart with the error:
        #    /usr/bin/ld: cannot find -lc
        # This is not a problem as iscsistart does not need to be rebuilt
        # usr/iscisd and usr/iscsiadm will have been rebuilt

        # Install the new executables
            cd usr
            install -b iscsiadm /sbin
            install -b iscsid /sbin
    
    Option 2:  Patch and rebuild
        The version of open-iscsi provided with RHEL 6.4 is open-iscsi-2.0.873.  The source
        RPM can be downloaded and installed, then patched using the ocs_openiscsi.patch file.
        This patched source can then be built and installed.  The following are the steps
        to do this:

        # Locate and download the source RPM for iscsi-initiator-utils.
        # For RHEL 6.4 this is iscsi-initiator-utils-6.2.0.873-2.el6.src.rpm

        # Install the source RPM:
            rpm -i iscsi-initiator-utils-6.2.0.873-2.el6.src.rpm
        # Extract the source directory from the source RPM:
            cd /root/rpmbuild/SPECS
            rpmbuild -bp iscsi-initiator-utils.spec
        # Go to the source directory:
            cd /root/rpmbuild/BUILD/open-iscsi-2.0-872-rc4-bnx2i
        # Apply patch
            /usr/bin/patch -p1 < ocs_openiscsi.patch
        # Build with the patched source:
            make
        # Install the patched executables:
            make install

    After updating the open-iscsi tools you'll need to restart the iscsid process:
        service iscsid restart

Install driver

    Load driver

        # The ocs_iscsi_ramd driver must be loaded prior to loading this module
        # Be sure to use the initiator=1 module parameter.

        # as root use insmod to install the driver
	modprobe libiscsi
	modprobe iscsi_tcp
        insmod ocs_openiscsi.ko

Using the iSCSI initiator

    With both ocs_iscsi_ramd and ocs_openiscsi modules loaded, verify that the ocs
    interface is found by open-iscsi:
        iscsiadm --mode iface --op show
           ocs.00:00:c9:d5:6a:a5.ipv4.0 ocs,00:00:c9:d5:6a:a5,<empty>,<empty>,<empty>
           ocs.00:00:c9:d5:6a:a3.ipv4.0 ocs,00:00:c9:d5:6a:a3,<empty>,<empty>,<empty>

    

