From a14e0a1115f0b84c140d669250c98554ff20fcd8 Mon Sep 17 00:00:00 2001 From: Zhou Ya Date: Fri, 23 Dec 2016 10:11:43 +0800 Subject: clean up env before deploy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、modify function param standarded 2、modify centos version 3、clean up net and host before deploy 4、modify daisyserver password and node size Change-Id: I9cbf4c5ed9984b12941afc8e45dba216f2b5ee0d Signed-off-by: Zhou Ya --- ci/deploy/deploy.sh | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) (limited to 'ci') diff --git a/ci/deploy/deploy.sh b/ci/deploy/deploy.sh index 91d97784..79ec2439 100755 --- a/ci/deploy/deploy.sh +++ b/ci/deploy/deploy.sh @@ -13,6 +13,7 @@ # exit 0 ##########TODO after test########## +WORKDIR=/tmp/workdir DHA=$WORKSPACE/$1 NETWORK=$WORKSPACE/$2 deploy_path=$WORKSPACE/deploy @@ -33,16 +34,22 @@ daisy_gateway=`echo $parameter_from_deploy | cut -d " " -f 6` function execute_on_jumpserver { - ssh $1 -o UserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no $2 + local jumpserver_ip=$1 + local cmd=$2 + ssh $jumpserver_ip -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $cmd } function create_node { - virsh net-define $1 - virsh net-autostart $2 - virsh net-start $2 - virsh define $3 - virsh start $4 + local net_template=$1 + local net_name=$2 + local vms_template=$3 + local vms_name=$4 + virsh net-define $net_template + virsh net-autostart $net_name + virsh net-start $net_name + virsh define $vms_template + virsh start $vms_name } #update key = value config option in an conf or ini file @@ -79,9 +86,25 @@ function update_config fi } +function clean_up +{ + local vm_name=$1 + local network_name=$2 + virsh destroy $vm_name + virsh undefine $vm_name + virsh net-destroy $network_name + virsh net-undefine $network_name +} + +echo "=====clean up all node and network======" +clean_up all_in_one daisy2 +clean_up daisy daisy1 +if [ -f $WORKDIR/daisy ]; then + rm -rf $WORKDIR +fi + echo "=======create daisy node================" $create_qcow2_path/daisy-img-modify.sh -c $create_qcow2_path/centos-img-modify.sh -a $daisy_ip -g $daisy_gateway -s $daisyserver_size -#qemu-img resize centos7.qcow2 100G create_node $net_daisy1 daisy1 $pod_daisy daisy sleep 20 @@ -103,7 +126,7 @@ fi echo "====== add relate config of kolla===========" execute_on_jumpserver $daisy_ip "mkdir -p /etc/kolla/config/nova" -execute_on_jumpserver $daisy_ip "echo -e "[libvirt]\nvirt_type=qemu" > /etc/kolla/config/nova/nova-compute.conf" +execute_on_jumpserver $daisy_ip "echo -e '[libvirt]\nvirt_type=qemu' > /etc/kolla/config/nova/nova-compute.conf" echo "===prepare cluster and pxe===" execute_on_jumpserver $daisy_ip "python $WORKSPACE/deploy/tempest.py --dha $DHA --network $NETWORK --cluster "yes"" @@ -121,6 +144,8 @@ virsh destroy all_in_one virsh start all_in_one echo "===========check install progress===========" +execute_on_jumpserver $daisy_ip "systemctl restart daisy-api" +execute_on_jumpserver $daisy_ip "systemctl restart daisy-registry" execute_on_jumpserver $daisy_ip "$WORKSPACE/deploy/check_os_progress.sh" virsh reboot all_in_one execute_on_jumpserver $daisy_ip "$WORKSPACE/deploy/check_openstack_progress.sh" -- cgit 1.2.3-korg