-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup-share-node.sh
executable file
·257 lines (221 loc) · 8.86 KB
/
setup-share-node.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
#!/bin/sh
##
## Setup a OpenStack share node for Manila.
##
set -x
DIRNAME=`dirname $0`
# Gotta know the rules!
if [ $EUID -ne 0 ] ; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Grab our libs
. "$DIRNAME/setup-lib.sh"
if [ "$HOSTNAME" != "$SHAREHOST" ]; then
exit 0;
fi
if [ -f $OURDIR/setup-share-host-done ]; then
exit 0
fi
logtstart "share-node"
if [ -f $SETTINGS ]; then
. $SETTINGS
fi
if [ -f $LOCALSETTINGS ]; then
. $LOCALSETTINGS
fi
#
# We need whatever Neutron ML2 plugin we're supposed to use, on this node.
#
$DIRNAME/setup-network-plugin.sh
maybe_install_packages manila-share $DBDPACKAGE
crudini --set /etc/manila/manila.conf \
database connection "${DBDSTRING}://manila:$MANILA_DBPASS@$CONTROLLER/manila"
crudini --del /etc/manila/manila.conf keystone_authtoken auth_host
crudini --del /etc/manila/manila.conf keystone_authtoken auth_port
crudini --del /etc/manila/manila.conf keystone_authtoken auth_protocol
crudini --set /etc/manila/manila.conf DEFAULT auth_strategy keystone
crudini --set /etc/manila/manila.conf DEFAULT verbose ${VERBOSE_LOGGING}
crudini --set /etc/manila/manila.conf DEFAULT debug ${DEBUG_LOGGING}
crudini --set /etc/manila/manila.conf DEFAULT my_ip ${MGMTIP}
crudini --set /etc/manila/manila.conf DEFAULT \
default_share_type default_share_type
crudini --set /etc/manila/manila.conf DEFAULT \
rootwrap_config /etc/manila/rootwrap.conf
if [ $OSVERSION -lt $OSNEWTON ]; then
crudini --set /etc/manila/manila.conf DEFAULT rpc_backend rabbit
crudini --set /etc/manila/manila.conf oslo_messaging_rabbit \
rabbit_host $CONTROLLER
crudini --set /etc/manila/manila.conf oslo_messaging_rabbit \
rabbit_userid ${RABBIT_USER}
crudini --set /etc/manila/manila.conf oslo_messaging_rabbit \
rabbit_password "${RABBIT_PASS}"
else
crudini --set /etc/manila/manila.conf DEFAULT transport_url $RABBIT_URL
fi
crudini --set /etc/manila/manila.conf keystone_authtoken \
memcached_servers ${CONTROLLER}:11211
crudini --set /etc/manila/manila.conf keystone_authtoken \
${AUTH_URI_KEY} http://${CONTROLLER}:5000
crudini --set /etc/manila/manila.conf keystone_authtoken \
auth_url http://${CONTROLLER}:${KADMINPORT}
crudini --set /etc/manila/manila.conf keystone_authtoken \
${AUTH_TYPE_PARAM} password
crudini --set /etc/manila/manila.conf keystone_authtoken \
${PROJECT_DOMAIN_PARAM} default
crudini --set /etc/manila/manila.conf keystone_authtoken \
${USER_DOMAIN_PARAM} default
crudini --set /etc/manila/manila.conf keystone_authtoken \
project_name service
crudini --set /etc/manila/manila.conf keystone_authtoken \
username manila
crudini --set /etc/manila/manila.conf keystone_authtoken \
password "${MANILA_PASS}"
crudini --set /etc/manila/manila.conf oslo_concurrency \
lock_path /var/lib/manila/tmp
#
# Setup the share node details:
#
maybe_install_packages lvm2 nfs-kernel-server
if [ "$MANILADRIVER" = "lvm" ]; then
$DIRNAME/setup-extra-space.sh
. $LOCALSETTINGS
MANILAVGNAME=${VGNAME}
if [ $LVM -eq 0 ] ; then
MANILAVGNAME=manila-volumes
dd if=/dev/zero of=/storage/pvloop.2 bs=32768 count=131072
LDEV=`losetup -f`
losetup $LDEV /storage/pvloop.2
pvcreate $LDEV
vgcreate $MANILAVGNAME $LDEV
fi
echo "MANILAVGNAME=${MANILAVGNAME}" >> $LOCALSETTINGS
fi
if [ "$MANILADRIVER" = "lvm" ]; then
# XXX: add LVM devices { filter ... } to /etc/lvm/lvm.conf ...
crudini --set /etc/manila/manila.conf DEFAULT enabled_share_backends lvm
crudini --set /etc/manila/manila.conf DEFAULT enabled_share_protocols NFS,CIFS
crudini --set /etc/manila/manila.conf lvm share_backend_name LVM
crudini --set /etc/manila/manila.conf lvm \
share_driver manila.share.drivers.lvm.LVMShareDriver
crudini --set /etc/manila/manila.conf lvm \
driver_handles_share_servers False
crudini --set /etc/manila/manila.conf lvm lvm_share_volume_group ${MANILAVGNAME}
crudini --set /etc/manila/manila.conf lvm lvm_share_export_ip ${MGMTIP}
crudini --set /etc/manila/manila.conf lvm
else
crudini --set /etc/manila/manila.conf DEFAULT share_backend_name GENERIC
crudini --set /etc/manila/manila.conf DEFAULT enabled_share_backends generic
crudini --set /etc/manila/manila.conf DEFAULT enabled_share_protocols NFS,CIFS
crudini --set /etc/manila/manila.conf DEFAULT \
scheduler_driver manila.scheduler.drivers.filter.FilterScheduler
crudini --set /etc/manila/manila.conf generic \
share_driver manila.share.drivers.generic.GenericShareDriver
crudini --set /etc/manila/manila.conf generic \
driver_handles_share_servers True
if [ "${ML2PLUGIN}" = "openvswitch" ]; then
crudini --set /etc/manila/manila.conf generic \
interface_driver manila.network.linux.interface.OVSInterfaceDriver
else
crudini --set /etc/manila/manila.conf generic \
interface_driver manila.network.linux.interface.BridgeInterfaceDriver
fi
crudini --set /etc/manila/manila.conf generic \
service_instance_user manila
crudini --set /etc/manila/manila.conf generic \
service_instance_password ${MANILA_PASS}
# Setup key and key configuration
MANILAHOME=`getent passwd manila | cut -f6 -d:`
crudini --set /etc/manila/manila.conf generic \
path_to_private_key ${MANILAHOME}/.ssh/id_rsa
crudini --set /etc/manila/manila.conf generic \
path_to_public_key ${MANILAHOME}/.ssh/id_rsa.pub
mkdir -p ${MANILAHOME}/.ssh
ssh-keygen -t rsa -f ${MANILAHOME}/.ssh/id_rsa -N ''
chmod 700 ${MANILAHOME}/.ssh
chmod 600 ${MANILAHOME}/.ssh/*
chown -R manila.manila ${MANILAHOME}/.ssh
# Setup service image and flavor (these are created later in setup-basic-*)
crudini --set /etc/manila/manila.conf generic \
service_image_name manila-service-image
# NB: this flavor id has to match the one created in setup-controller.sh !
crudini --set /etc/manila/manila.conf generic \
service_instance_flavor_id 100
# NB: this CIDR is approximately in the middle of the 10.11-254.0.0
# range we will allocate to virtual networks. Recall that osp.py starts
# allocating flat/vlan nets at 10.11, and the tunnel networks start
# at 10.254 and go down from there.
crudini --set /etc/manila/manila.conf generic \
service_network_cidr 10.133.0.0/16
crudini --set /etc/manila/manila.conf nova \
${AUTH_URI_KEY} http://${CONTROLLER}:5000
crudini --set /etc/manila/manila.conf nova \
auth_url http://${CONTROLLER}:${KADMINPORT}
crudini --set /etc/manila/manila.conf nova \
auth_type password
crudini --set /etc/manila/manila.conf nova \
${PROJECT_DOMAIN_PARAM} default
crudini --set /etc/manila/manila.conf nova \
${USER_DOMAIN_PARAM} default
crudini --set /etc/manila/manila.conf nova \
project_name service
crudini --set /etc/manila/manila.conf nova \
username nova
crudini --set /etc/manila/manila.conf nova \
password "${NOVA_PASS}"
crudini --set /etc/manila/manila.conf nova \
memcached_servers ${CONTROLLER}:11211
crudini --set /etc/manila/manila.conf nova \
region_name $REGION
crudini --set /etc/manila/manila.conf cinder \
${AUTH_URI_KEY} http://${CONTROLLER}:5000
crudini --set /etc/manila/manila.conf cinder \
auth_url http://${CONTROLLER}:${KADMINPORT}
crudini --set /etc/manila/manila.conf cinder \
auth_type password
crudini --set /etc/manila/manila.conf cinder \
${PROJECT_DOMAIN_PARAM} default
crudini --set /etc/manila/manila.conf cinder \
${USER_DOMAIN_PARAM} default
crudini --set /etc/manila/manila.conf cinder \
project_name service
crudini --set /etc/manila/manila.conf cinder \
username cinder
crudini --set /etc/manila/manila.conf cinder \
password "${CINDER_PASS}"
crudini --set /etc/manila/manila.conf cinder \
memcached_servers ${CONTROLLER}:11211
crudini --set /etc/manila/manila.conf cinder \
region_name $REGION
crudini --set /etc/manila/manila.conf neutron \
url http://${CONTROLLER}:9696
crudini --set /etc/manila/manila.conf neutron \
${AUTH_URI_KEY} http://${CONTROLLER}:5000
crudini --set /etc/manila/manila.conf neutron \
auth_url http://${CONTROLLER}:${KADMINPORT}
crudini --set /etc/manila/manila.conf neutron \
auth_type password
crudini --set /etc/manila/manila.conf neutron \
${PROJECT_DOMAIN_PARAM} default
crudini --set /etc/manila/manila.conf neutron \
${USER_DOMAIN_PARAM} default
crudini --set /etc/manila/manila.conf neutron \
project_name service
crudini --set /etc/manila/manila.conf neutron \
username neutron
crudini --set /etc/manila/manila.conf neutron \
password "${NEUTRON_PASS}"
crudini --set /etc/manila/manila.conf neutron \
memcached_servers ${CONTROLLER}:11211
crudini --set /etc/manila/manila.conf neutron \
region_name $REGION
fi
if [ $OSVERSION -eq $OSPIKE ]; then
patch -p1 -d /usr/lib/python2.7/dist-packages \
< $DIRNAME/etc/manila-pike-bug-1716922.patch
fi
service_restart manila-share
service_enable manila-share
touch $OURDIR/setup-share-host-done
logtstart "share-node"
exit 0