summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhijiang Hu <hu.zhijiang@zte.com.cn>2017-04-15 07:46:07 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-04-15 07:46:07 +0000
commit0d7114ad9efedeba16c7e0a448606c9d955aa338 (patch)
tree594687fd0e9af5aba41ddf55f9461d9e7bb487ac
parenta6b5bc153f14a3f1d10733fe7fb4bf457d0ecf5f (diff)
parent3f09e7e05515811537376ccad532ac52d4bd3305 (diff)
Merge "add the argument WORKDIR in daisy-img-modify.sh"
-rwxr-xr-xci/deploy/deploy.sh8
-rwxr-xr-xtools/daisy-img-modify.sh12
2 files changed, 12 insertions, 8 deletions
diff --git a/ci/deploy/deploy.sh b/ci/deploy/deploy.sh
index eba6b581..85d211fe 100755
--- a/ci/deploy/deploy.sh
+++ b/ci/deploy/deploy.sh
@@ -138,7 +138,7 @@ DHA=$REMOTE_SPACE/labs/$LAB_NAME/$POD_NAME/daisy/config/deploy.yml
NETWORK=$REMOTE_SPACE/labs/$LAB_NAME/$POD_NAME/daisy/config/network.yml
# set temporay workdir
-WORKDIR=${WORKDIR:-/tmp/workdir}
+WORKDIR=${WORKDIR:-/tmp/workdir/daisy}
[[ $POD_NAME =~ (virtual) ]] && IS_BARE=0
@@ -268,16 +268,12 @@ else
virsh destroy daisy
virsh undefine daisy
fi
-if [ -f $WORKDIR/daisy/centos7.qcow2 ]; then
- rm -rf $WORKDIR/daisy/centos7.qcow2
-fi
echo "=======create daisy node================"
+$CREATE_QCOW2_PATH/daisy-img-modify.sh -c $CREATE_QCOW2_PATH/centos-img-modify.sh -w $WORKDIR -a $DAISY_IP $PARAS_IMAGE
if [ $IS_BARE == 0 ];then
- $CREATE_QCOW2_PATH/daisy-img-modify.sh -c $CREATE_QCOW2_PATH/centos-img-modify.sh -a $DAISY_IP $PARAS_IMAGE
create_node $VMDELOY_DAISY_SERVER_NET daisy1 $VMDEPLOY_DAISY_SERVER_VM daisy
else
- $CREATE_QCOW2_PATH/daisy-img-modify.sh -c $CREATE_QCOW2_PATH/centos-img-modify.sh -a $DAISY_IP $PARAS_IMAGE
virsh define $BMDEPLOY_DAISY_SERVER_VM
virsh start daisy
fi
diff --git a/tools/daisy-img-modify.sh b/tools/daisy-img-modify.sh
index 8e025168..f172ceec 100755
--- a/tools/daisy-img-modify.sh
+++ b/tools/daisy-img-modify.sh
@@ -15,19 +15,21 @@ usage()
{
cat << EOF
USAGE: `basename $0` [-c sub-Command] [-a IP Address] [-g Gateway IP address] [-s image Size in GB]
-
+ [-w workdir]
OPTIONS:
-c sub-command to modify the content
-a IP address for the sub-command to set in the image
-g gateway IP address for the sub-command to set in the image
-s image size of gigabytes. If it is absent, the image size will not be changed.
+ -w workdir for temporary usage, optional
+ -h print this message and exit
EXAMPLE:
sudo `basename $0` -c centos-img-modify.sh -a 10.20.11.2 -g 10.20.11.1 -s 100
EOF
}
-while getopts "c:a:g:s:h" OPTION
+while getopts "c:a:g:s:w:h" OPTION
do
case $OPTION in
c)
@@ -47,6 +49,9 @@ do
s)
img_size=${OPTARG}
;;
+ w)
+ WORKDIR=${OPTARG}
+ ;;
h)
usage
exit 0
@@ -206,6 +211,9 @@ cleanup() {
kpartx -dv $raw_imgfile || eliminate
fi
rm -f $raw_imgfile
+ if [ -f $imgfile ]; then
+ rm -rf $imgfile
+ fi
rm -rf $mountdir
}