From 850a3a0efecac0556daba2a9e4f5ce4929a12c8d Mon Sep 17 00:00:00 2001 From: grakiss Date: Mon, 14 Dec 2015 19:29:10 +0800 Subject: deploy compass-core and hosts seperately JIRA: COMPASS-194 - add two entry for seperate deployment Change-Id: I7ea964f7fc1ac7e9191b4c21032e24a1a70aa07d Signed-off-by: grakiss --- deploy.sh | 4 ++++ deploy/launch.sh | 19 ++++++++++++++++--- deploy_compass_only.sh | 3 +++ deploy_host_only.sh | 3 +++ 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100755 deploy_compass_only.sh create mode 100755 deploy_host_only.sh diff --git a/deploy.sh b/deploy.sh index 4cfe89e8..b95475b1 100755 --- a/deploy.sh +++ b/deploy.sh @@ -2,6 +2,10 @@ COMPASS_DIR=`cd ${BASH_SOURCE[0]%/*}/;pwd` export COMPASS_DIR +if [[ -z "$DEPLOY_STEP" ]]; then + export DEPLOY_STEP="all" +fi + for i in python-cheetah python-yaml screen; do if [[ `dpkg-query -l $i` == 0 ]]; then continue diff --git a/deploy/launch.sh b/deploy/launch.sh index bad03cf7..9a223ec9 100755 --- a/deploy/launch.sh +++ b/deploy/launch.sh @@ -18,7 +18,7 @@ source ${COMPASS_DIR}/deploy/compass_vm.sh source ${COMPASS_DIR}/deploy/deploy_host.sh ######################### main process -if true +if [[ "$DEPLOY_STEP" == "compass_only" || "$DEPLOY_STEP" == "all" ]] then if ! prepare_env;then echo "prepare_env failed" @@ -34,7 +34,7 @@ fi log_info "deploy host macs: $machines" export machines - +echo "export machines=\""$machines"\"" > $WORK_DIR/switch_machines log_info "########## set up network begin #############" if ! create_nets;then log_error "create_nets failed" @@ -45,10 +45,21 @@ if ! launch_compass;then log_error "launch_compass failed" exit 1 fi + else + # test code -export machines="'00:00:3d:a4:ee:4c','00:00:63:35:3c:2b','00:00:f2:f2:b7:a5','00:00:2f:d3:88:28','00:00:46:67:11:e7'" +if [[ -f $WORK_DIR/switch_machines ]]; then + echo "using last generated machines" + source $WORK_DIR/switch_machines +else + export machines="'00:00:3d:a4:ee:4c','00:00:63:35:3c:2b','00:00:f2:f2:b7:a5','00:00:2f:d3:88:28','00:00:46:67:11:e7'" +fi + fi + +if [[ "$DEPLOY_STEP" == "host_only" || "$DEPLOY_STEP" == "all" ]]; then + if [[ ! -z $VIRT_NUMBER ]];then if ! launch_host_vms;then log_error "launch_host_vms failed" @@ -64,3 +75,5 @@ else #tear_down_compass exit 0 fi + +fi diff --git a/deploy_compass_only.sh b/deploy_compass_only.sh new file mode 100755 index 00000000..8cb31eb8 --- /dev/null +++ b/deploy_compass_only.sh @@ -0,0 +1,3 @@ +export DEPLOY_STEP="compass_only" + +./deploy.sh $* diff --git a/deploy_host_only.sh b/deploy_host_only.sh new file mode 100755 index 00000000..accade38 --- /dev/null +++ b/deploy_host_only.sh @@ -0,0 +1,3 @@ +export DEPLOY_STEP="host_only" + +./deploy.sh $* -- cgit 1.2.3-korg