-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopensuse_devstack.sh
163 lines (133 loc) · 4.93 KB
/
opensuse_devstack.sh
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/bin/bash
##########################################################################
# Setup devstack and run Tempest
##########################################################################
DEVSTACK_DIR="/tmp/devstack"
set -ex
zypper="zypper --gpg-auto-import-keys -n"
function h_echo_header {
local text=$1
echo "################################################"
echo "$text"
echo "################################################"
}
function h_setup_base_repos {
if [[ -r /etc/os-release ]]; then
. /etc/os-release
# openSUSE Leap has a space in it's name
DIST_NAME=${NAME// /_}
DIST_VERSION=${VERSION_ID}
# /etc/os-release has SLES as $NAME, but we need SLE for repositories
if [[ $DIST_NAME == "SLES" ]]; then
DIST_NAME="SLE"
DIST_VERSION=${VERSION}
fi
# /etc/os-release has a date and string combination for Tumbleweed
# we need only the string for repositories
if [[ $VERSION == *"Tumbleweed"* ]]; then
DIST_VERSION="Tumbleweed"
fi
fi
if [[ $DIST_NAME == "openSUSE_Leap" ]]; then
$zypper ar -f http://download.opensuse.org/distribution/leap/${DIST_VERSION}/repo/oss/ Base || true
$zypper ar -f http://download.opensuse.org/update/leap/${DIST_VERSION}/oss/openSUSE:Leap:${DIST_VERSION}:Update.repo || true
fi
if [[ $DIST_NAME == "openSUSE" ]]; then
if [[ $DIST_VERSION == "Tumbleweed" ]]; then
# Tumbleweed needs to be lower case
dv=${DIST_VERSION,,}
$zypper ar -f http://download.opensuse.org/${dv}/repo/oss/ Base || true
else
$zypper ar -f http://download.opensuse.org/distribution/${DIST_VERSION}/repo/oss/ Base || true
$zypper ar -f http://download.opensuse.org/update/${DIST_VERSION}/${DIST_NAME}:${DIST_VERSION}:Update.repo || true
fi
fi
if [[ $DIST_NAME == "SLE" ]]; then
if [[ $DIST_VERSION == 12* ]]; then
$zypper ar -f "http://smt-internal.opensuse.org/repo/\$RCE/SUSE/Updates/SLE-SERVER/${DIST_VERSION}/x86_64/update/" Updates || true
$zypper ar -f "http://smt-internal.opensuse.org/repo/\$RCE/SUSE/Products/SLE-SERVER/${DIST_VERSION}/x86_64/product" Base || true
$zypper ar -f "http://smt-internal.opensuse.org/repo/\$RCE/SUSE/Products/SLE-SDK/${DIST_VERSION}/x86_64/product" SDK || true
$zypper ar -f "http://smt-internal.opensuse.org/repo/\$RCE/SUSE/Updates/SLE-SDK/${DIST_VERSION}/x86_64/update/" SDK-Update || true
fi
fi
}
function h_setup_extra_repos {
# NOTE(toabctl): This is currently needed for i.e. haproxy package (and I guess for other packages/OS-versions too)
# This package is not available in openSUSE 13.1 but needs to be installed for lbaas tempest tests
# NOTE(toabctl): On Cloud:OpenStack:Master, for SLE12SP1 it must be 12_SP1 (not 12-SP1 which is used in the smt-internal path). It's crazy...
$zypper ar -f http://download.opensuse.org/repositories/Cloud:/OpenStack:/Master/${DIST_NAME}_${DIST_VERSION//-/_}/Cloud:OpenStack:Master.repo || true
}
function h_setup_screen {
cat > ~/.screenrc <<EOF
altscreen on
defscrollback 20000
startup_message off
hardstatus alwayslastline
hardstatus string '%H (%S%?;%u%?) %-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<'
EOF
}
function h_setup_extra_disk {
mkfs.ext3 /dev/vdb
mkdir -p /opt/stack
mount /dev/vdb /opt/stack
}
function h_setup_devstack {
$zypper in git-core which
git clone https://github.com/openstack-dev/devstack.git $DEVSTACK_DIR
# setup non-root user (username is "stack")
(cd $DEVSTACK_DIR && ./tools/create-stack-user.sh)
# configure devstack
cat > $DEVSTACK_DIR/local.conf <<EOF
[[local|localrc]]
SERVICE_TOKEN=testtoken
DATABASE_PASSWORD=test
ADMIN_PASSWORD=test
RABBIT_PASSWORD=test
SERVICE_PASSWORD=test
RECLONE=yes
HOST_IP=127.0.0.1
LOGFILE=stack.sh.log
LOGDAYS=1
SCREEN_LOGDIR=/opt/stack/logs
LOG_COLOR=False
API_RATE_LIMIT=False
TEMPEST_ALLOW_TENANT_ISOLATION=True
# use postgres instead of mysql as database
disable_service mysql
enable_service postgresql
# swift is disabled by default
#enable_service s-proxy s-object s-container s-account
# Use Neutron instead of Nova network
disable_service n-net
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
enable_service q-metering
# vpn disabled for now. openswan required by devstack but not available in openSUSE
# enable_service q-vpn
enable_service q-fwaas
enable_service q-lbaas
# for testing
enable_service tempest
EOF
chown stack:stack -R $DEVSTACK_DIR
}
###################### Start running code #########################
h_echo_header "Setup"
h_setup_base_repos
h_setup_extra_repos
$zypper ref
h_setup_screen
# setup extra disk if parameters given
if [ -e "/dev/vdb" ]; then
h_setup_extra_disk
fi
h_setup_devstack
h_echo_header "Run devstack"
sudo -u stack -i <<EOF
cd $DEVSTACK_DIR
FORCE=yes ./stack.sh
EOF
exit 0