summaryrefslogtreecommitdiffstats
path: root/ci/deploy/deploy.sh
blob: 29c63cd083b78beae47cecc7049651d75d3a71bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
##############################################################################
# Copyright (c) 2016 ZTE Coreporation and others.
# hu.zhijiang@zte.com.cn
# sun.jing22@zte.com.cn
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
#daisy host discover
######exit before finish test#######
exit 0

##########TODO after test#########################
DAISYDIR=$WORKSPACE
json_file=$DAISYDIR/deploy/config/vm_environment/zte-virtual/template.json
source ~/daisyrc_admin
daisy discover-host-add 192.168.122.152 ossdbg1
daisy discover-host

cnt=30
while [ $cnt -ge 0 ]; do
    host_id=`daisy host-list | awk -F "|" '{print $2}'| grep -o "[^ ]\+\( \+[^ ]\+\)*" `
    if [ -z "$host_id" ]; then
        echo "host have not discoverd , loop again  ... "
        cnt=$[$cnt-1]
        sleep 30
    else
        echo "host list checkout successful... "
    break
    fi
done
daisy host-list

echo "======prepare install os(centos) & kolla(openstack) ==========="
daisy import-json-to-template $json_file
daisy import-template-to-db template testdaisy
daisy template-to-host testdaisy DaisyNode $host_id

echo "======daisy install kolla(openstack)==========="
cluster_id=`daisy cluster-list | awk -F "|" '{print $2}' | sed -n '4p'`
daisy install $cluster_id

echo "check installing proess..."
var=1
while [ $var -eq 1 ]; do
    echo "loop for judge openstack installing  progress..."
    openstack_install_active=`daisy host-list --cluster-id $cluster_id | awk -F "|" '{print $12}' | grep -c "active" `
    openstack_install_failed=`daisy host-list --cluster-id $cluster_id | awk -F "|" '{print $12}' | grep -c "install-failed" `
    if [ $openstack_install_active -eq 1 ]; then
        echo "openstack installing successful ..."
        break
    elif [ $openstack_install_failed -gt 0 ]; then
        echo "openstack installing have failed..."
        tail -n 200 /var/log/daisy/kolla_$cluster_id*
        exit 1
    else
        echo " openstack in installing , please waiting ..."
    fi
done
exit 0