aboutsummaryrefslogtreecommitdiffstats
path: root/deploy
diff options
context:
space:
mode:
authorshuai chen <chenshuai@huawei.com>2016-08-19 08:03:05 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-08-19 08:03:06 +0000
commitdfa5128cfb407eaf4d1fe93404d3b423e26d8c8b (patch)
treeda5ab8fcab40ae077fb9ca2cc01aea7b77effb33 /deploy
parentd74aefc2d04b69a8a0a74af3f4e3114020ca748e (diff)
parent00214a8cf06840cf5be6427d3c8d0ba84a7a1069 (diff)
Merge "Revert "Prepare the jump host offline""
Diffstat (limited to 'deploy')
-rwxr-xr-xdeploy/launch.sh16
-rwxr-xr-xdeploy/prepare.sh94
2 files changed, 39 insertions, 71 deletions
diff --git a/deploy/launch.sh b/deploy/launch.sh
index 2c272c79..488e0fd7 100755
--- a/deploy/launch.sh
+++ b/deploy/launch.sh
@@ -15,6 +15,7 @@ mkdir -p $WORK_DIR/script
export DEPLOY_FIRST_TIME=${DEPLOY_FIRST_TIME-"true"}
source ${COMPASS_DIR}/deploy/prepare.sh
+prepare_python_env
source ${COMPASS_DIR}/util/log.sh
source ${COMPASS_DIR}/deploy/deploy_parameter.sh
source $(process_input_para $*) || exit 1
@@ -29,16 +30,6 @@ source ${COMPASS_DIR}/deploy/compass_vm.sh
source ${COMPASS_DIR}/deploy/deploy_host.sh
######################### main process
-download_iso
-pre_prepare
-prepare_env
-if [[ "$DEPLOY_COMPASS" == "true" ]]; then
- if ! prepare_python_env;then
- echo "prepare_python_env failed"
- exit 1
- fi
-fi
-
print_logo
if [[ ! -z $VIRT_NUMBER ]];then
@@ -55,6 +46,11 @@ fi
export machines
if [[ "$DEPLOY_COMPASS" == "true" ]]; then
+ if ! prepare_env;then
+ echo "prepare_env failed"
+ exit 1
+ fi
+
log_info "########## set up network begin #############"
if ! create_nets;then
log_error "create_nets failed"
diff --git a/deploy/prepare.sh b/deploy/prepare.sh
index 7d7a02d5..a4f606af 100755
--- a/deploy/prepare.sh
+++ b/deploy/prepare.sh
@@ -9,11 +9,11 @@
##############################################################################
function print_logo()
{
-# if ! apt --installed list 2>/dev/null | grep "figlet"
-# then
-# sudo apt-get update -y
-# sudo apt-get install -y --force-yes figlet
-# fi
+ if ! apt --installed list 2>/dev/null | grep "figlet"
+ then
+ sudo apt-get update -y
+ sudo apt-get install -y --force-yes figlet
+ fi
figlet -ctf slant Compass Installer
set +x; sleep 2; set -x
@@ -32,19 +32,32 @@ function download_iso()
fi
fi
- rm -rf $WORK_DIR/iso
- mkdir -p $WORK_DIR/iso
- mkdir -p $WORK_DIR/cache
curl --connect-timeout 10 -o $WORK_DIR/cache/$iso_name $ISO_URL
-
}
-function pre_prepare() {
+function prepare_env() {
+ if [[ "$DEPLOY_FIRST_TIME" == "true" ]]; then
+ sudo apt-get update -y
+ sudo apt-get install -y --force-yes mkisofs bc curl ipmitool openvswitch-switch
+ sudo apt-get install -y --force-yes git python-dev
+ sudo apt-get install -y --force-yes libxslt-dev libxml2-dev libvirt-dev build-essential qemu-utils qemu-kvm libvirt-bin virtinst libmysqld-dev
+ sudo apt-get install -y --force-yes libffi-dev libssl-dev
+ fi
+
+ sudo service libvirt-bin restart
+ if sudo service openvswitch-switch status|grep stop; then
+ sudo service openvswitch-switch start
+ fi
+
# prepare work dir
- rm -rf $WORK_DIR/{installer,vm,network}
+ rm -rf $WORK_DIR/{installer,vm,network,iso}
mkdir -p $WORK_DIR/installer
mkdir -p $WORK_DIR/vm
mkdir -p $WORK_DIR/network
+ mkdir -p $WORK_DIR/iso
+ mkdir -p $WORK_DIR/cache
+
+ download_iso
cp $WORK_DIR/cache/`basename $ISO_URL` $WORK_DIR/iso/centos.iso -f
@@ -59,65 +72,24 @@ function pre_prepare() {
chmod 755 $WORK_DIR -R
sudo cp ${COMPASS_DIR}/deploy/qemu_hook.sh /etc/libvirt/hooks/qemu
-
- rm -rf $WORK_DIR/cache/compass_tmp
- mkdir -p $WORK_DIR/cache/compass_tmp
- rm -rf $WORK_DIR/cache/jh_env_tmp
- mkdir -p $WORK_DIR/cache/jh_env_tmp
- sudo mount -o loop $WORK_DIR/cache/$iso_name $WORK_DIR/cache/compass_tmp/
- cp $WORK_DIR/cache/compass_tmp/jh_env_package/*.tar.gz $WORK_DIR/cache/jh_env_tmp/
- sudo umount $WORK_DIR/cache/compass_tmp/
- rm -rf $WORK_DIR/cache/compass_tmp
- tar -zxvf $WORK_DIR/cache/jh_env_tmp/env_trusty_deb.tar.gz -C $WORK_DIR/cache/jh_env_tmp
- tar -zxvf $WORK_DIR/cache/jh_env_tmp/env_trusty_pip.tar.gz -C $WORK_DIR/cache/jh_env_tmp
-}
-
-function prepare_env() {
- if [[ "$DEPLOY_FIRST_TIME" == "true" ]]; then
- cd $WORK_DIR/cache/jh_env_tmp/jh_deb
- dpkg -i *.deb
- cd -
- fi
}
function _prepare_python_env() {
rm -rf $WORK_DIR/venv
mkdir -p $WORK_DIR/venv
- rm -rf ~/.pip
- mkdir -p ~/.pip
- cd $WORK_DIR/cache/jh_env_tmp/
-
-cat <<EOF > ~/.pip/pip.conf
-[global]
-find-links = http://127.0.0.1:9999/jh_pip
-no-index = true
-[install]
-trusted-host=127.0.0.1
-EOF
-
- nohup python -m SimpleHTTPServer 9999 &
-
- cd -
-
+ sudo apt-get install -y --force-yes python-pip
+ sudo pip install --upgrade virtualenv
virtualenv $WORK_DIR/venv
source $WORK_DIR/venv/bin/activate
- PIP="markupsafe virtualenv cheetah pyyaml requests netaddr pbr oslo.config ansible"
- for i in ${PIP}; do
- pip install --upgrade $i
- done
- service libvirt-bin restart
- if sudo service openvswitch-switch status|grep stop; then
- sudo service openvswitch-switch start
- fi
-
- pid=$(ps -ef | grep SimpleHTTPServer | grep 9999 | awk '{print $2}')
- echo $pid
- kill -9 $pid
-
- rm -rf ~/.pip/pip.conf
- rm -rf $WORK_DIR/cache/jh_env_tmp
+ pip install --upgrade pip
+ pip install --upgrade cheetah
+ pip install --upgrade pyyaml
+ pip install --upgrade requests
+ pip install --upgrade netaddr
+ pip install --upgrade oslo.config
+ pip install --upgrade ansible
}
function prepare_python_env()