diff --git a/osd-target/README b/osd-target/README index cd34c24..8a8323d 100644 --- a/osd-target/README +++ b/osd-target/README @@ -3,6 +3,7 @@ Documentation for OSD Target library. Copyright (C) 2007 Dennis Dalessandro (dennis@osc.edu) Copyright (C) 2007 Ananth Devulapalli (ananth@osc.edu) Copyright (C) 2007 Pete Wyckoff (pw@osc.edu) +Copyright (C) 2009 Boaz Harrosh (bharrosh@panasas.com) This directory contains code to build an OSD command processor that uses SQLite as its attribute storage, and a normal file system (such as ext3) @@ -30,86 +31,26 @@ Major components: converted into a C file during the build process. osd-sense.c - Generating sense (error) return values. - patch/ - Changes to tgt to allow it to use this osd target library. - - Building -------- -This requires the osd-util library, and expects it to be in ../osd-util/ -by default. Edit $(UTILDIR) in the Makefile if not. - -Type "make" to build the osd target library, libosdtgt.a. - -If you have a file called ../Makedefs, it will be used during -the build to set variables in make. A couple of useful lines to -put in that file are: - OPT := -g -or - OPT := -O3 -DNDEBUG - - -Building a SCSI target ----------------------- - -To build a full iSCSI target that uses OSD, you'll need to get -the tgt code from its git repository, patch it, then build it -to link against this OSD target library. - -The tgt git repository is: - - git://git.kernel.org/pub/scm/linux/kernel/git/tomo/tgt.git - -It is browseable at: - - http://git.kernel.org/?p=linux/kernel/git/tomo/tgt.git - -This library has been tested with commit -448fe4bd7a8fce622f9efab05a3251a297a1a815 from 13 Dec 2007. - -0. Assuming you will put all of osd-target, osd-util, and tgt in one - directory, else adjust paths. - -1. Set up for debugging (optional) +This directory is not meant to be built by itself. It is part +of the bigger built system at the root of this folder. - echo "OPT := -g" > Makedefs - -2. Build osd-util - - cd osd-util - make - cd .. - -3. Build osd-target - - cd osd-target - make - cd .. - -4. Download tgt. - - git clone git://git.kernel.org/pub/scm/linux/kernel/git/tomo/tgt.git - -5. Merge handy patches for OSD support from OSC. These will use the - library in osd-target - - cd tgt - git remote add osc git://git.osc.edu/tgt.git - git remote update - git merge osc/osd - cd usr - make +[osd-target]$ cd ../ +[osc-osd]$ make +see the project's root folder README file for more instructions. Running tgt with OSD target --------------------------- -The patches you applied above build the target with OSD support. They +The patches you checked out here build the target with OSD support. They also make a few changes to tgt to make it easier to deal with for testing scenarios. -It will create or reuse a directory /tmp/tgt-$(id -un) where -$(id -un) is your username. It sends logging to stderr, not +By default it will create or reuse a directory /tmp/tgt-$(id -un) +where $(id -un) is your username. It sends logging to stderr, not to syslog. A convenient way to run it is: ./tgtd -d 9 -f @@ -121,23 +62,43 @@ You can redirect debug output to a file too. Now, point an iSCSI initiator at this machine, port 3260, and issue OSD commands. -If you want to add an osd-target by hand or add a second osd -logical unit issue the following commands: +If you did not apply to tgt (on by default) the last patch: + "osdemu: (OPTIONAL) auto config first target" +You will need to issue these commands: -[]$ ./tgtadm --lld iscsi --mode target --op new --tid 1 --targetname $(hostname) +[osc-osd]$ ./tgt/usr/tgtadm --lld iscsi --mode target --op new --tid 1 \ + --targetname $(hostname) -[]$ ./tgtadm --lld iscsi --mode target --op bind --tid 1 --initiator-address ALL +[osc-osd]$ ./tgt/usr/tgtadm --lld iscsi --mode target --op bind --tid 1 \ + --initiator-address ALL -[]$ ./tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 \ - --backing-store /tmp/tgt-$(id -nu) --device-type osd +[osc-osd]$ ./tgt/usr/tgtadm --lld iscsi --mode logicalunit --op new \ + --tid 1 --lun 1 \ + --bstype=osdemu --device-type osd \ + --backing-store /tmp/tgt-$(id -nu)/ -[]$ ./tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 1 \ +[osc-osd]$ ./tgtadm --lld iscsi --mode logicalunit --op update \ + --tid 1 --lun 1 \ --name=scsi_sn --value=$(hostname) -And optionaly these for preformance: +And optionally these for performance: -[]$ ./tgtadm --lld iscsi --mode target --op update --tid 1 \ +[osc-osd]$ ./tgt/usr/tgtadm --lld iscsi --mode target --op update --tid 1 \ --name MaxRecvDataSegmentLength --value 262144 -[]$ ./tgtadm --lld iscsi --mode target --op update --tid 1 \ +[osc-osd]$ ./tgt/usr/tgtadm --lld iscsi --mode target --op update --tid 1 \ --name FirstBurstLength --value 262144 + +If you want to add a second osd logical unit issue the following commands: + +[osc-osd]$ ./tgt/usr/tgtadm --lld iscsi --mode logicalunit --op new \ + --tid 1 --lun 2 \ + --bstype=osdemu --device-type osd \ + --backing-store /tmp/tgt-$(id -nu)2/ + +[osc-osd]$ ./tgt/usr/tgtadm --lld iscsi --mode logicalunit --op update \ + --tid 1 --lun 2 \ + --name=scsi_sn --value=$(hostname) + +Finally print what was configured: +[osc-osd]$ ./tgt/usr/tgtadm --lld iscsi --mode target --op show