summaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
authorJustin chi <chigang@huawei.com>2015-08-13 08:26:05 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2015-08-13 08:26:05 +0000
commitade17ce57eb08dbf262cb9b6f1893367e2832dc1 (patch)
tree3f6c489086ca0f002f15114e71f4d64d1564f2b8 /ci
parent7951b094df92c40417ec66c4be58871911bbed07 (diff)
parent10e776642a16b2584be88e5be8740f05535d7d06 (diff)
Merge "Add deploy scripts for compass"
Diffstat (limited to 'ci')
-rwxr-xr-xci/deploy.sh9
-rwxr-xr-xci/launch.sh65
-rwxr-xr-xci/log.sh22
3 files changed, 96 insertions, 0 deletions
diff --git a/ci/deploy.sh b/ci/deploy.sh
new file mode 100755
index 00000000..197bf63b
--- /dev/null
+++ b/ci/deploy.sh
@@ -0,0 +1,9 @@
+#set -x
+COMPASS_DIR=`cd ${BASH_SOURCE[0]%/*}/../;pwd`
+export COMPASS_DIR
+
+apt-get install screen
+screen -ls |grep deploy|awk -F. '{print $1}'|xargs kill -9
+screen -wipe
+#screen -dmSL deploy bash $COMPASS_DIR/ci/launch.sh $*
+$COMPASS_DIR/ci/launch.sh $*
diff --git a/ci/launch.sh b/ci/launch.sh
new file mode 100755
index 00000000..316b06f5
--- /dev/null
+++ b/ci/launch.sh
@@ -0,0 +1,65 @@
+#set -x
+WORK_DIR=$COMPASS_DIR/ci/work
+
+if [[ $# -ge 1 ]];then
+ CONF_NAME=$1
+else
+ CONF_NAME=cluster
+fi
+
+source ${COMPASS_DIR}/ci/log.sh
+source ${COMPASS_DIR}/deploy/conf/${CONF_NAME}.conf
+source ${COMPASS_DIR}/deploy/prepare.sh
+source ${COMPASS_DIR}/deploy/network.sh
+
+if [[ ! -z $VIRT_NUMBER ]];then
+ source ${COMPASS_DIR}/deploy/host_vm.sh
+else
+ source ${COMPASS_DIR}/deploy/host_baremetal.sh
+fi
+
+source ${COMPASS_DIR}/deploy/compass_vm.sh
+source ${COMPASS_DIR}/deploy/deploy_host.sh
+
+######################### main process
+
+if ! prepare_env;then
+ echo "prepare_env failed"
+ exit 1
+fi
+
+log_info "########## get host mac begin #############"
+machines=`get_host_macs`
+if [[ -z $machines ]];then
+ log_error "get_host_macs failed"
+ exit 1
+fi
+
+log_info "deploy host macs: $machines"
+export machines
+
+log_info "########## set up network begin #############"
+if ! create_nets;then
+ log_error "create_nets failed"
+ exit 1
+fi
+
+if ! launch_compass;then
+ log_error "launch_compass failed"
+ exit 1
+fi
+if [[ ! -z $VIRT_NUMBER ]];then
+ if ! launch_host_vms;then
+ log_error "launch_host_vms failed"
+ exit 1
+ fi
+fi
+if ! deploy_host;then
+ #tear_down_machines
+ #tear_down_compass
+ exit 1
+else
+ #tear_down_machines
+ #tear_down_compass
+ exit 0
+fi
diff --git a/ci/log.sh b/ci/log.sh
new file mode 100755
index 00000000..f54fdca5
--- /dev/null
+++ b/ci/log.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+reset=`tput sgr0`
+red=`tput setaf 1`
+green=`tput setaf 2`
+yellow=`tput setaf 3`
+
+function log_info() {
+ echo -e "${green}$*${reset}"
+}
+
+function log_warn() {
+ echo -e "${yellow}$*${reset}"
+}
+
+function log_error() {
+ echo -e "${red}$*${reset}"
+}
+
+function log_progress() {
+ echo -en "${yellow}$*\r${reset}"
+}
+