Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abort cmd support #37

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5a123d0
Integrate storage lib (#1)
rohan-puri Feb 14, 2018
c4afa6d
Adding dll.h file from old hyc-tgt code repo
rohan-puri Feb 26, 2018
5c98058
Adding a basic fio run script, whose config is,
rohan-puri Feb 26, 2018
3c22374
Added cleanup code to basic_setup.sh.
rohan-puri Mar 6, 2018
22b3ae5
Commiting the cleanup code of basic_setup.sh script
rohan-puri Mar 8, 2018
e2c604b
Added docker based build infrastructure
harishpujari Mar 12, 2018
cdbf098
Dp 558 (#2)
rohan-puri Mar 20, 2018
80a19bd
Added ha-lib as submodule in thirdparty/ha-lib
rohan-puri Apr 2, 2018
feb3aab
Ha lib integration (#3)
rohan-puri Apr 6, 2018
8bb12a8
readme added on how to run tgt
Apr 6, 2018
e258ed4
Merge branch 'master' of github.com:CacheboxInc/tgt
Apr 6, 2018
3521c18
tgt bind is now part of target_create REST API
Apr 10, 2018
0486db0
Removing -Wstrict-prototypes compiler flag.
rohan-puri Apr 17, 2018
64b3c2f
Return NOT supported for WRITESAME scsi command until we support it c…
sumit-k Apr 26, 2018
68b6dea
Update tgtd to incorporate ha-lib API change.
May 2, 2018
11e4a29
Merge pull request #4 from sumit-k/master
sumit-k May 7, 2018
15ad3f4
Changed json config to lun_create REST API
May 9, 2018
00f148b
Sync halib submodule
sphansalkar May 16, 2018
8e72eca
Sync ha-lib submodule
sphansalkar May 17, 2018
034bd90
Pass tgtd id in tgtadm bind command instead of just using the tid as …
sumit-k May 23, 2018
694d28e
Dp 1151 (#5)
shriharirathod Jun 20, 2018
0cb8ecf
Dp 1158 (#6)
shriharirathod Jul 3, 2018
302c421
Adding retry for target delete (#7)
shriharirathod Aug 3, 2018
b336594
Dp 1428 (#8)
shriharirathod Aug 3, 2018
b13f9f3
redesign stord client code (#10)
joshi-prasad Aug 31, 2018
ca1b5fd
Avoid EPOLLOUT event trigger for connection socketfd (#11)
joshi-prasad Sep 5, 2018
7e8c5a1
Creating a queue of REST calls (#9)
shriharirathod Sep 6, 2018
aba5330
[DP-2090] Modify TGT default behavior to pass abort commands down to …
vikjadhav Mar 1, 2019
2e120e8
[DP-2090] Incorporated Review Comments.
vikjadhav Mar 3, 2019
b3a56f2
[DP-2090] Incorporated review comments
vikjadhav Mar 6, 2019
4681e22
[DP-2090] Incorporated review comments
vikjadhav Mar 6, 2019
199c902
Incorporated review comments
vikjadhav Mar 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "thirdparty/ha-lib"]
path = thirdparty/ha-lib
url = [email protected]:CacheboxInc/ha-lib.git
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export CEPH_RBD
export GLFS_BD
export SD_NOTIFY

#top-level dir path
TGT_DIR = $(PWD)
export TGT_DIR

.PHONY: all
all: programs doc conf scripts

Expand Down
138 changes: 138 additions & 0 deletions basic_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
#!/bin/bash -x

function Usage() {
echo "1st arg disk file name for target"
echo "2nd arg fio config file"
exit 1
}

if [ $# -lt 2 ]; then
Usage
fi

DISK1=$1
FIO_CONFIG=$2

function Cmd_present() {
command -v $1 2>&1 > /dev/null
if [ ! $? -eq 0 ]; then
echo "Command $1 not present"
exit $?
fi
}

# Check for all the to be used commands
Cmd_present tgtd
Cmd_present tgtadm
Cmd_present curl
Cmd_present iscsiadm
Cmd_present fio

function cleanup() {
rm -rf $DISK1
killall -9 tgtd
}

if [ -f "$DISK1" ]; then
echo "File $DISK1 already present."
exit 1
fi

echo "Creating 1G file to be exported as LUN"
#fallocate -l 1G $DISK1
dd if=/dev/zero of=$DISK1 bs=1G count=1

if [ ! $? -eq 0 ]; then
echo "File creation of $DISK1 failed"
cleanup
exit $?
fi

# Start the tgtd
tgtd

if [ ! $? -eq 0 ]; then
echo "Starting tgtd failed"
cleanup
exit $?
fi

# Create new VM through REST API
curl -s -XPOST 'http://localhost:1984/new_vm/1' \
-d '{"vmid":"1","TargetID":"1","TargetName":"disk1"}' \
-H 'Content-Type: application/json' 2>&1 > /dev/null

if [ ! $? -eq 0 ]; then
echo "Create new VM REST API failed"
cleanup
exit $?
else
echo "New VM with vmid 1, rest api successful"
fi

# Create new VMDK through REST API
curl -s -XPOST 'http://localhost:1984/vm/1/new_vmdk/1' \
-d '{"TargetID":"1","LunID":"1","DevPath":"/var/tmp/iscsi-disk1","VmID":"1","VmdkID":"1","BlockSize":"4096","Compression":{"Enabled":"false"},"Encryption":{"Enabled":"false"},"RamCache":{"Enabled":"true","MemoryInMB":"1024"},"FileCache":{"Enabled":"false"},"SuccessHandler":{"Enabled":"true"}}' \
-H'Content-Type: application/json' 2>&1 > /dev/null

if [ ! $? -eq 0 ]; then
echo "Create new VMDK REST API failed"
cleanup
exit $?
else
echo "New VMDK with vmdkid 1, rest api successful"
fi

# Make the target discoverable
tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL

if [ ! $? -eq 0 ]; then
echo "Target discoverable command failed"
cleanup
exit $?
else
echo "Target with tid 1 is now discoverable"
fi

# Discover
iscsiadm --mode discovery --type sendtargets --portal 127.0.0.1

# Login through iscsi on this target
iscsiadm --mode node --targetname disk1 --portal 127.0.0.1:3260 --login

if [ ! $? -eq 0 ]; then
echo "iscsi login to target tid 1 failed"
cleanup
exit $?
else
echo "iscsi login to target tid 1 successful"
fi

# run fio
FIO_PATH=$HOME/fio_$$

mkdir $FIO_PATH

if [ ! $? -eq 0 ]; then
echo "mkdir $FIO_PATH failed"
cleanup
exit $?
else
echo "FIO logs with be at $FIO_PATH"
fi

cd $FIO_PATH

fio $HOME/config.fio

if [ ! $? -eq 0 ]; then
echo "fio run failed"
else
echo "fio run succeeded"
fi

# logout
iscsiadm --mode node --targetname disk1 --portal 127.0.0.1:3260 --logout

cleanup

20 changes: 20 additions & 0 deletions config.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[global]
group_reporting=1
exitall
runtime=1m
time_based=1

# writers, will repeatedly randomly write and verify data
[writers]
rw=randwrite
bsrange=4k-16k
ioengine=libaio
iodepth=128
filename=/dev/sdb
verify=crc32c
verify_backlog=1024
verify_backlog_batch=512
verify_interval=512
numjobs=1
create_serialize=0

31 changes: 31 additions & 0 deletions dockers/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Pull base image
FROM ubuntu:16.04

# Install essential packages

RUN rm -rf /var/lib/apt/lists/*
RUN apt-get -y update
RUN apt-get -y upgrade

# for folly
RUN apt-get install -y cmake libboost-all-dev libevent-dev libdouble-conversion-dev libgoogle-glog-dev
RUN apt-get install -y libgflags-dev libiberty-dev liblz4-dev liblzma-dev libsnappy-dev make
RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get install -y zlib1g-dev binutils-dev libjemalloc-dev libssl-dev pkg-config

# for storage layer
RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:jonathonf/gcc-7.2
RUN apt-get -y update
RUN apt-get install -y gcc-7 g++-7
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7

ADD run.sh /opt/run.sh

VOLUME /shared
WORKDIR /shared
RUN chmod +x /opt/run.sh
CMD ["/opt/run.sh"]
73 changes: 73 additions & 0 deletions dockers/build/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/bash

echo "this is run.sh for tgt"

# uncomment the below line and comment rest all to aid debug
#tail -F -n0 /etc/hosts

cwd=$(pwd)

echo "build folly start"
cd folly
rm -rf _build
mkdir _build
cd _build
cmake configure .. -DBUILD_SHARED_LIBS=ON
make
make install
echo "build folly complete"

cd $cwd
echo "build CRoaring start"
cd hyc-storage-layer/thirdparty/CRoaring
rm -rf _build
mkdir _build
cd _build
cmake ..
make
make install
echo "build CRoaring complete"

cd $cwd
echo "build restbed start"
cd hyc-storage-layer/thirdparty/restbed
rm -rf _build
mkdir _build
cd _build
cmake -DBUILD_SHARED=YES ..
make
make install
echo "build restbed complete"

cd $cwd
echo "gtest build start"
cd googletest
rm -rf _build
mkdir _build
cd _build
cmake ..
make
make install
echo "gtest build complete"

cd $cwd
echo "storage lib build start"
cd hyc-storage-layer
rm -rf _build
mkdir _build
cd _build
cmake ..
make
make test
make install
echo "storage lib build complete"

cd $cwd
echo "tgt build start"
cd tgt
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/hyc
make
echo "tgt build complete"

cd $cwd
echo "run.sh for tgt exiting"
3 changes: 3 additions & 0 deletions readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
how to run tgt:
#./usr/tgtd -f -e "http://127.0.0.1:2379" -s "tgt_svc" -v "v1.0" -p 9001 -D "127.0.0.1" -P 9876

35 changes: 35 additions & 0 deletions setup_cmds.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Following are the list of commands in order that has to be run to configure
hyc tgt :
...........................................................................

1. Start the tgtd.
2. Create new VM through Rest API
# curl -v -XPOST 'http://localhost:1984/new_vm/1' -d '{"vmid":"1"}' \
-H'Content-Type: application/json'
3. Create new VMDK through Rest API
# curl -v -XPOST 'http://localhost:1984/vm/1/new_vmdk/1' \
-d '{"VmID":"1","VmdkID":"1","BlockSize":"4096",\
"Compression":{"Enabled":"false"},"Encryption":{"Enabled":"false"},\
"RamCache":{"Enabled":"true","MemoryInMB":"1024"},\
"FileCache":{"Enabled":"false"},"SuccessHandler":{"Enabled":"true"}}'\
-H'Content-Type: application/json'

4. Create new target.
# sudo ./tgtadm --lld iscsi --mode target --op new --tid=1 \
--targetname disk1

5. Create a new LUN for this new target.
# sudo ./tgtadm --lld iscsi --mode logicalunit --op new --tid 1 \
--lun 1 -b /var/tmp/iscsi-disk1 --bstype hyc \
--bsopts vmid=1:vmdkid:1
NOTE: bstype indicates, backing store type, we have our own named "hyc".

6. Make this target discoverable
# sudo ./tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL

7. Discover this target from iscsi client
# iscsiadm --mode discovery --type sendtargets --portal 127.0.0.1

8. Login to this target from iscsi client
# iscsiadm --mode node --targetname disk1 --portal 127.0.0.1:3260 --login

1 change: 1 addition & 0 deletions thirdparty/ha-lib
Submodule ha-lib added at 5dbb8b
Loading