Skip to content

Commit

Permalink
Just modify run.sh/setupIFTdriver.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
billsung committed Jul 27, 2018
1 parent 6f06822 commit 5f87b4c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 36 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ It manages storage by Infortrend CLI tool.

## How to setup and use

- If Cinder runs on Ubuntu, run `. setupIFTDriver.sh` to quick update Cinder-volume with this Cinder Driver.
- Please check our [user manual](https://github.com/infortrend-openstack/openstack-cinder-manaul).

# Run Test
Expand Down
29 changes: 1 addition & 28 deletions run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

export CINDER_DIR=./cinder
export CINDER_REPO_URL="https://git.openstack.org/openstack/cinder"
export INFORTREND_TEST_DIR="cinder/tests/unit/volume/drivers/infortrend"
export INFORTREND_DRIVER_DIR="cinder/volume/drivers/infortrend"

echo "Running Flake8..."
flake8 infortrend/
Expand All @@ -26,32 +24,7 @@ else
echo "Skip Cloning cinder."
fi

if [ ! -d "$CINDER_DIR/$INFORTREND_DRIVER_DIR" ]; then
mkdir $CINDER_DIR/$INFORTREND_DRIVER_DIR
fi

if [ ! -d "$CINDER_DIR/$INFORTREND_TEST_DIR" ]; then
mkdir $CINDER_DIR/$INFORTREND_TEST_DIR
fi

echo "Copy ./infortrend/*"
cp ./infortrend/* $CINDER_DIR/$INFORTREND_DRIVER_DIR/ -r
echo "Copy ./test/infortrend/*"
cp ./test/infortrend/* $CINDER_DIR/$INFORTREND_TEST_DIR/ -r

if grep "infortrend" -q "$CINDER_DIR/cinder/opts.py"; then
echo "Driver opts already set."
else
echo "Setup infortrend opts/exceptions.."
source setupIFTdriver.sh
fi

sed -i '125 ifrom cinder.volume.drivers.infortrend.raidcmd_cli import common_cli as \\\n cinder_volume_drivers_infortrend' ./cinder/cinder/opts.py
sed -i '305 i\\ cinder_volume_drivers_infortrend.infortrend_opts,' ./cinder/cinder/opts.py
echo '# Infortrend Driver' >> ./cinder/cinder/exception.py
echo 'class InfortrendCliException(CinderException):' >> ./cinder/cinder/exception.py
echo ' message = _("Infortrend CLI exception: %(err)s Param: %(param)s "' >> ./cinder/cinder/exception.py
echo ' "(Return Code: %(rc)s) (Output: %(out)s)")' >> ./cinder/cinder/exception.py
source setupIFTdriver.sh $CINDER_DIR

cd $CINDER_DIR

Expand Down
42 changes: 34 additions & 8 deletions setupIFTdriver.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
#!/bin/bash

export BASE=./cinder/cinder/

sed -i '131 ifrom cinder.volume.drivers.infortrend.raidcmd_cli import common_cli as \\\n cinder_volume_drivers_infortrend' $BASE/opts.py
sed -i '325 i\\ cinder_volume_drivers_infortrend.infortrend_opts,' $BASE/opts.py
echo '# Infortrend Driver' >> $BASE/exception.py
echo 'class InfortrendCliException(CinderException):' >> $BASE/exception.py
echo ' message = _("Infortrend CLI exception: %(err)s Param: %(param)s "' >> $BASE/exception.py
echo ' "(Return Code: %(rc)s) (Output: %(out)s)")' >> $BASE/exception.py
export INFORTREND_TEST_DIR="tests/unit/volume/drivers/infortrend"
export INFORTREND_DRIVER_DIR="volume/drivers/infortrend"

if [ -z "${1}" ]; then
export BASE=/usr/lib/python2.7/dist-packages/cinder
else
export BASE=${1}/cinder
fi

if [ ! -d "$BASE/$INFORTREND_DRIVER_DIR" ]; then
mkdir $BASE/$INFORTREND_DRIVER_DIR
fi

if [ ! -d "$BASE/$INFORTREND_TEST_DIR" ]; then
mkdir $BASE/$INFORTREND_TEST_DIR
fi

echo "Copying ./infortrend/* to $BASE/$INFORTREND_DRIVER_DIR/"
cp ./infortrend/* $BASE/$INFORTREND_DRIVER_DIR/ -r
echo "Copying ./test/infortrend/* to $BASE/$INFORTREND_TEST_DIR/"
cp ./test/infortrend/* $BASE/$INFORTREND_TEST_DIR/ -r

if grep "infortrend" -q "$BASE/opts.py"; then
echo "Skip adding IFT opts/exceptions."
else
# 131 & 325 will need to change as if opts.py/exceptions.py is updated
echo "Setup infortrend opts/exceptions.."
sed -i '131 ifrom cinder.volume.drivers.infortrend.raidcmd_cli import common_cli as \\\n cinder_volume_drivers_infortrend' $BASE/opts.py
sed -i '325 i\\ cinder_volume_drivers_infortrend.infortrend_opts,' $BASE/opts.py
echo '# Infortrend Driver' >> $BASE/exception.py
echo 'class InfortrendCliException(CinderException):' >> $BASE/exception.py
echo ' message = _("Infortrend CLI exception: %(err)s Param: %(param)s "' >> $BASE/exception.py
echo ' "(Return Code: %(rc)s) (Output: %(out)s)")' >> $BASE/exception.py
fi

0 comments on commit 5f87b4c

Please sign in to comment.