* Move quantum installation to lib/quantum
* Refactor quantum configuration
* Move Quantum service account creation from keystone_data.sh to lib/quantum
* Define generic functions to install third party programs
* Minor cleanups related to Quantum
* Kill dnsmasq which watches an interface 'ns-XXXXXX' in unstack.sh
* Set default_floating_pool in nova.conf to make default flaoting pool
work when PUBLIC_NETWORK_NAME is other than 'nova'
* Make tempest work even when PRIVATE_NETWORK_NAME is other than 'private'
Change-Id: I4a6e7fcebfb11556968f53ab6a0e862ce16bb139
... | ... |
@@ -1,6 +1,7 @@ |
1 | 1 |
Aaron Lee <aaron.lee@rackspace.com> |
2 | 2 |
Aaron Rosen <arosen@nicira.com> |
3 | 3 |
Adam Gandelman <adamg@canonical.com> |
4 |
+Akihiro MOTOKI <motoki@da.jp.nec.com> |
|
4 | 5 |
Andrew Laski <andrew.laski@rackspace.com> |
5 | 6 |
Andy Smith <github@anarkystic.com> |
6 | 7 |
Anthony Young <sleepsonthefloor@gmail.com> |
... | ... |
@@ -5,7 +5,6 @@ |
5 | 5 |
# Tenant User Roles |
6 | 6 |
# ------------------------------------------------------------------ |
7 | 7 |
# service glance admin |
8 |
-# service quantum admin # if enabled |
|
9 | 8 |
# service swift admin # if enabled |
10 | 9 |
# service heat admin # if enabled |
11 | 10 |
# service ceilometer admin # if enabled |
... | ... |
@@ -148,30 +147,6 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then |
148 | 148 |
fi |
149 | 149 |
fi |
150 | 150 |
|
151 |
-if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then |
|
152 |
- QUANTUM_USER=$(get_id keystone user-create \ |
|
153 |
- --name=quantum \ |
|
154 |
- --pass="$SERVICE_PASSWORD" \ |
|
155 |
- --tenant_id $SERVICE_TENANT \ |
|
156 |
- --email=quantum@example.com) |
|
157 |
- keystone user-role-add \ |
|
158 |
- --tenant_id $SERVICE_TENANT \ |
|
159 |
- --user_id $QUANTUM_USER \ |
|
160 |
- --role_id $ADMIN_ROLE |
|
161 |
- if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
|
162 |
- QUANTUM_SERVICE=$(get_id keystone service-create \ |
|
163 |
- --name=quantum \ |
|
164 |
- --type=network \ |
|
165 |
- --description="Quantum Service") |
|
166 |
- keystone endpoint-create \ |
|
167 |
- --region RegionOne \ |
|
168 |
- --service_id $QUANTUM_SERVICE \ |
|
169 |
- --publicurl "http://$SERVICE_HOST:9696/" \ |
|
170 |
- --adminurl "http://$SERVICE_HOST:9696/" \ |
|
171 |
- --internalurl "http://$SERVICE_HOST:9696/" |
|
172 |
- fi |
|
173 |
-fi |
|
174 |
- |
|
175 | 151 |
if [[ "$ENABLED_SERVICES" =~ "ceilometer" ]]; then |
176 | 152 |
CEILOMETER_USER=$(get_id keystone user-create --name=ceilometer \ |
177 | 153 |
--pass="$SERVICE_PASSWORD" \ |
... | ... |
@@ -348,6 +348,7 @@ function create_nova_conf() { |
348 | 348 |
add_nova_opt "dhcpbridge_flagfile=$NOVA_CONF" |
349 | 349 |
add_nova_opt "force_dhcp_release=True" |
350 | 350 |
add_nova_opt "fixed_range=$FIXED_RANGE" |
351 |
+ add_nova_opt "default_floating_pool=$PUBLIC_NETWORK_NAME" |
|
351 | 352 |
add_nova_opt "s3_host=$SERVICE_HOST" |
352 | 353 |
add_nova_opt "s3_port=$S3_SERVICE_PORT" |
353 | 354 |
add_nova_opt "osapi_compute_extension=nova.api.openstack.compute.contrib.standard_extensions" |
... | ... |
@@ -413,6 +414,16 @@ function create_nova_conf() { |
413 | 413 |
done |
414 | 414 |
} |
415 | 415 |
|
416 |
+function create_nova_conf_nova_network() { |
|
417 |
+ add_nova_opt "network_manager=nova.network.manager.$NET_MAN" |
|
418 |
+ add_nova_opt "public_interface=$PUBLIC_INTERFACE" |
|
419 |
+ add_nova_opt "vlan_interface=$VLAN_INTERFACE" |
|
420 |
+ add_nova_opt "flat_network_bridge=$FLAT_NETWORK_BRIDGE" |
|
421 |
+ if [ -n "$FLAT_INTERFACE" ]; then |
|
422 |
+ add_nova_opt "flat_interface=$FLAT_INTERFACE" |
|
423 |
+ fi |
|
424 |
+} |
|
425 |
+ |
|
416 | 426 |
# init_nova() - Initialize databases, etc. |
417 | 427 |
function init_nova() { |
418 | 428 |
# Nova Database |
... | ... |
@@ -5,6 +5,36 @@ |
5 | 5 |
# ``functions`` file |
6 | 6 |
# ``DEST`` must be defined |
7 | 7 |
|
8 |
+# ``stack.sh`` calls the entry points in this order: |
|
9 |
+# |
|
10 |
+# install_quantum |
|
11 |
+# install_quantumclient |
|
12 |
+# install_quantum_agent_packages |
|
13 |
+# install_quantum_third_party |
|
14 |
+# setup_quantum |
|
15 |
+# setup_quantumclient |
|
16 |
+# configure_quantum |
|
17 |
+# init_quantum |
|
18 |
+# configure_quantum_third_party |
|
19 |
+# init_quantum_third_party |
|
20 |
+# start_quantum_third_party |
|
21 |
+# create_nova_conf_quantum |
|
22 |
+# start_quantum_service_and_check |
|
23 |
+# create_quantum_initial_network |
|
24 |
+# setup_quantum_debug |
|
25 |
+# start_quantum_agents |
|
26 |
+# |
|
27 |
+# ``unstack.sh`` calls the entry points in this order: |
|
28 |
+# |
|
29 |
+# stop_quantum |
|
30 |
+ |
|
31 |
+# Functions in lib/quantum are classified into the following categories: |
|
32 |
+# |
|
33 |
+# - entry points (called from stack.sh or unstack.sh) |
|
34 |
+# - internal functions |
|
35 |
+# - quantum exercises |
|
36 |
+# - 3rd party programs |
|
37 |
+ |
|
8 | 38 |
|
9 | 39 |
# Quantum Networking |
10 | 40 |
# ------------------ |
... | ... |
@@ -31,8 +61,8 @@ XTRACE=$(set +o | grep xtrace) |
31 | 31 |
set +o xtrace |
32 | 32 |
|
33 | 33 |
|
34 |
-# Defaults |
|
35 |
-# -------- |
|
34 |
+# Quantum Network Configuration |
|
35 |
+# ----------------------------- |
|
36 | 36 |
|
37 | 37 |
# Set up default directories |
38 | 38 |
QUANTUM_DIR=$DEST/quantum |
... | ... |
@@ -49,7 +79,6 @@ Q_PLUGIN=${Q_PLUGIN:-openvswitch} |
49 | 49 |
Q_PORT=${Q_PORT:-9696} |
50 | 50 |
# Default Quantum Host |
51 | 51 |
Q_HOST=${Q_HOST:-$HOST_IP} |
52 |
-# Which Quantum API nova should use |
|
53 | 52 |
# Default admin username |
54 | 53 |
Q_ADMIN_USERNAME=${Q_ADMIN_USERNAME:-quantum} |
55 | 54 |
# Default auth strategy |
... | ... |
@@ -59,6 +88,8 @@ Q_USE_NAMESPACE=${Q_USE_NAMESPACE:-True} |
59 | 59 |
Q_USE_ROOTWRAP=${Q_USE_ROOTWRAP:-True} |
60 | 60 |
# Meta data IP |
61 | 61 |
Q_META_DATA_IP=${Q_META_DATA_IP:-$HOST_IP} |
62 |
+# Allow Overlapping IP among subnets |
|
63 |
+Q_ALLOW_OVERLAPPING_IP=${Q_ALLOW_OVERLAPPING_IP:-False} |
|
62 | 64 |
# Use quantum-debug command |
63 | 65 |
Q_USE_DEBUG_COMMAND=${Q_USE_DEBUG_COMMAND:-False} |
64 | 66 |
|
... | ... |
@@ -70,14 +101,587 @@ if is_service_enabled quantum; then |
70 | 70 |
QUANTUM_ROOTWRAP=$(get_rootwrap_location quantum) |
71 | 71 |
Q_RR_COMMAND="sudo $QUANTUM_ROOTWRAP $Q_RR_CONF_FILE" |
72 | 72 |
fi |
73 |
-fi |
|
74 | 73 |
|
74 |
+ # Provider Network Configurations |
|
75 |
+ # -------------------------------- |
|
76 |
+ |
|
77 |
+ # The following variables control the Quantum openvswitch and |
|
78 |
+ # linuxbridge plugins' allocation of tenant networks and |
|
79 |
+ # availability of provider networks. If these are not configured |
|
80 |
+ # in localrc, tenant networks will be local to the host (with no |
|
81 |
+ # remote connectivity), and no physical resources will be |
|
82 |
+ # available for the allocation of provider networks. |
|
83 |
+ |
|
84 |
+ # To use GRE tunnels for tenant networks, set to True in |
|
85 |
+ # localrc. GRE tunnels are only supported by the openvswitch |
|
86 |
+ # plugin, and currently only on Ubuntu. |
|
87 |
+ ENABLE_TENANT_TUNNELS=${ENABLE_TENANT_TUNNELS:-False} |
|
88 |
+ |
|
89 |
+ # If using GRE tunnels for tenant networks, specify the range of |
|
90 |
+ # tunnel IDs from which tenant networks are allocated. Can be |
|
91 |
+ # overriden in localrc in necesssary. |
|
92 |
+ TENANT_TUNNEL_RANGES=${TENANT_TUNNEL_RANGE:-1:1000} |
|
93 |
+ |
|
94 |
+ # To use VLANs for tenant networks, set to True in localrc. VLANs |
|
95 |
+ # are supported by the openvswitch and linuxbridge plugins, each |
|
96 |
+ # requiring additional configuration described below. |
|
97 |
+ ENABLE_TENANT_VLANS=${ENABLE_TENANT_VLANS:-False} |
|
98 |
+ |
|
99 |
+ # If using VLANs for tenant networks, set in localrc to specify |
|
100 |
+ # the range of VLAN VIDs from which tenant networks are |
|
101 |
+ # allocated. An external network switch must be configured to |
|
102 |
+ # trunk these VLANs between hosts for multi-host connectivity. |
|
103 |
+ # |
|
104 |
+ # Example: ``TENANT_VLAN_RANGE=1000:1999`` |
|
105 |
+ TENANT_VLAN_RANGE=${TENANT_VLAN_RANGE:-} |
|
106 |
+ |
|
107 |
+ # If using VLANs for tenant networks, or if using flat or VLAN |
|
108 |
+ # provider networks, set in localrc to the name of the physical |
|
109 |
+ # network, and also configure OVS_PHYSICAL_BRIDGE for the |
|
110 |
+ # openvswitch agent or LB_PHYSICAL_INTERFACE for the linuxbridge |
|
111 |
+ # agent, as described below. |
|
112 |
+ # |
|
113 |
+ # Example: ``PHYSICAL_NETWORK=default`` |
|
114 |
+ PHYSICAL_NETWORK=${PHYSICAL_NETWORK:-} |
|
115 |
+ |
|
116 |
+ # With the openvswitch plugin, if using VLANs for tenant networks, |
|
117 |
+ # or if using flat or VLAN provider networks, set in localrc to |
|
118 |
+ # the name of the OVS bridge to use for the physical network. The |
|
119 |
+ # bridge will be created if it does not already exist, but a |
|
120 |
+ # physical interface must be manually added to the bridge as a |
|
121 |
+ # port for external connectivity. |
|
122 |
+ # |
|
123 |
+ # Example: ``OVS_PHYSICAL_BRIDGE=br-eth1`` |
|
124 |
+ OVS_PHYSICAL_BRIDGE=${OVS_PHYSICAL_BRIDGE:-} |
|
125 |
+ |
|
126 |
+ # With the linuxbridge plugin, if using VLANs for tenant networks, |
|
127 |
+ # or if using flat or VLAN provider networks, set in localrc to |
|
128 |
+ # the name of the network interface to use for the physical |
|
129 |
+ # network. |
|
130 |
+ # |
|
131 |
+ # Example: ``LB_PHYSICAL_INTERFACE=eth1`` |
|
132 |
+ LB_PHYSICAL_INTERFACE=${LB_PHYSICAL_INTERFACE:-} |
|
133 |
+ |
|
134 |
+ # With the openvswitch plugin, set to True in localrc to enable |
|
135 |
+ # provider GRE tunnels when ``ENABLE_TENANT_TUNNELS`` is False. |
|
136 |
+ # |
|
137 |
+ # Example: ``OVS_ENABLE_TUNNELING=True`` |
|
138 |
+ OVS_ENABLE_TUNNELING=${OVS_ENABLE_TUNNELING:-$ENABLE_TENANT_TUNNELS} |
|
139 |
+fi |
|
75 | 140 |
|
76 | 141 |
# Entry Points |
77 | 142 |
# ------------ |
78 | 143 |
|
79 |
-# configure_quantum_rootwrap() - configure Quantum's rootwrap |
|
80 |
-function configure_quantum_rootwrap() { |
|
144 |
+# configure_quantum() |
|
145 |
+# Set common config for all quantum server and agents. |
|
146 |
+function configure_quantum() { |
|
147 |
+ _configure_quantum_common |
|
148 |
+ _configure_quantum_rpc |
|
149 |
+ |
|
150 |
+ if is_service_enabled q-svc; then |
|
151 |
+ _configure_quantum_service |
|
152 |
+ fi |
|
153 |
+ if is_service_enabled q-agt; then |
|
154 |
+ _configure_quantum_plugin_agent |
|
155 |
+ fi |
|
156 |
+ if is_service_enabled q-dhcp; then |
|
157 |
+ _configure_quantum_dhcp_agent |
|
158 |
+ fi |
|
159 |
+ if is_service_enabled q-l3; then |
|
160 |
+ _configure_quantum_l3_agent |
|
161 |
+ fi |
|
162 |
+ if is_service_enabled q-meta; then |
|
163 |
+ _configure_quantum_metadata_agent |
|
164 |
+ fi |
|
165 |
+ |
|
166 |
+ _configure_quantum_debug_command |
|
167 |
+ |
|
168 |
+ _cleanup_quantum |
|
169 |
+} |
|
170 |
+ |
|
171 |
+function create_nova_conf_quantum() { |
|
172 |
+ add_nova_opt "network_api_class=nova.network.quantumv2.api.API" |
|
173 |
+ add_nova_opt "quantum_admin_username=$Q_ADMIN_USERNAME" |
|
174 |
+ add_nova_opt "quantum_admin_password=$SERVICE_PASSWORD" |
|
175 |
+ add_nova_opt "quantum_admin_auth_url=$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v2.0" |
|
176 |
+ add_nova_opt "quantum_auth_strategy=$Q_AUTH_STRATEGY" |
|
177 |
+ add_nova_opt "quantum_admin_tenant_name=$SERVICE_TENANT_NAME" |
|
178 |
+ add_nova_opt "quantum_url=http://$Q_HOST:$Q_PORT" |
|
179 |
+ |
|
180 |
+ if [[ "$Q_PLUGIN" = "openvswitch" ]]; then |
|
181 |
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver"} |
|
182 |
+ elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
183 |
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.QuantumLinuxBridgeVIFDriver"} |
|
184 |
+ elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
185 |
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"quantum.plugins.ryu.nova.vif.LibvirtOpenVswitchOFPRyuDriver"} |
|
186 |
+ add_nova_opt "libvirt_ovs_integration_bridge=$OVS_BRIDGE" |
|
187 |
+ add_nova_opt "linuxnet_ovs_ryu_api_host=$RYU_API_HOST:$RYU_API_PORT" |
|
188 |
+ add_nova_opt "libvirt_ovs_ryu_api_host=$RYU_API_HOST:$RYU_API_PORT" |
|
189 |
+ fi |
|
190 |
+ add_nova_opt "libvirt_vif_driver=$NOVA_VIF_DRIVER" |
|
191 |
+ add_nova_opt "linuxnet_interface_driver=$LINUXNET_VIF_DRIVER" |
|
192 |
+ if is_service_enabled q-meta; then |
|
193 |
+ add_nova_opt "service_quantum_metadata_proxy=True" |
|
194 |
+ fi |
|
195 |
+} |
|
196 |
+ |
|
197 |
+# create_quantum_accounts() - Set up common required quantum accounts |
|
198 |
+ |
|
199 |
+# Tenant User Roles |
|
200 |
+# ------------------------------------------------------------------ |
|
201 |
+# service quantum admin # if enabled |
|
202 |
+ |
|
203 |
+# Migrated from keystone_data.sh |
|
204 |
+function create_quantum_accounts() { |
|
205 |
+ |
|
206 |
+ SERVICE_TENANT=$(keystone tenant-list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }") |
|
207 |
+ ADMIN_ROLE=$(keystone role-list | awk "/ admin / { print \$2 }") |
|
208 |
+ |
|
209 |
+ if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then |
|
210 |
+ QUANTUM_USER=$(keystone user-create \ |
|
211 |
+ --name=quantum \ |
|
212 |
+ --pass="$SERVICE_PASSWORD" \ |
|
213 |
+ --tenant_id $SERVICE_TENANT \ |
|
214 |
+ --email=quantum@example.com \ |
|
215 |
+ | grep " id " | get_field 2) |
|
216 |
+ keystone user-role-add \ |
|
217 |
+ --tenant_id $SERVICE_TENANT \ |
|
218 |
+ --user_id $QUANTUM_USER \ |
|
219 |
+ --role_id $ADMIN_ROLE |
|
220 |
+ if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
|
221 |
+ QUANTUM_SERVICE=$(keystone service-create \ |
|
222 |
+ --name=quantum \ |
|
223 |
+ --type=network \ |
|
224 |
+ --description="Quantum Service" \ |
|
225 |
+ | grep " id " | get_field 2) |
|
226 |
+ keystone endpoint-create \ |
|
227 |
+ --region RegionOne \ |
|
228 |
+ --service_id $QUANTUM_SERVICE \ |
|
229 |
+ --publicurl "http://$SERVICE_HOST:9696/" \ |
|
230 |
+ --adminurl "http://$SERVICE_HOST:9696/" \ |
|
231 |
+ --internalurl "http://$SERVICE_HOST:9696/" |
|
232 |
+ fi |
|
233 |
+ fi |
|
234 |
+} |
|
235 |
+ |
|
236 |
+function create_quantum_initial_network() { |
|
237 |
+ TENANT_ID=$(keystone tenant-list | grep " demo " | get_field 1) |
|
238 |
+ |
|
239 |
+ # Create a small network |
|
240 |
+ # Since quantum command is executed in admin context at this point, |
|
241 |
+ # ``--tenant_id`` needs to be specified. |
|
242 |
+ NET_ID=$(quantum net-create --tenant_id $TENANT_ID "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2) |
|
243 |
+ SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2) |
|
244 |
+ |
|
245 |
+ if is_service_enabled q-l3; then |
|
246 |
+ # Create a router, and add the private subnet as one of its interfaces |
|
247 |
+ ROUTER_ID=$(quantum router-create --tenant_id $TENANT_ID router1 | grep ' id ' | get_field 2) |
|
248 |
+ quantum router-interface-add $ROUTER_ID $SUBNET_ID |
|
249 |
+ # Create an external network, and a subnet. Configure the external network as router gw |
|
250 |
+ EXT_NET_ID=$(quantum net-create "$PUBLIC_NETWORK_NAME" -- --router:external=True | grep ' id ' | get_field 2) |
|
251 |
+ EXT_GW_IP=$(quantum subnet-create --ip_version 4 $EXT_NET_ID $FLOATING_RANGE -- --enable_dhcp=False | grep 'gateway_ip' | get_field 2) |
|
252 |
+ quantum router-gateway-set $ROUTER_ID $EXT_NET_ID |
|
253 |
+ |
|
254 |
+ if is_quantum_ovs_base_plugin "$Q_PLUGIN" && [[ "$Q_USE_NAMESPACE" = "True" ]]; then |
|
255 |
+ CIDR_LEN=${FLOATING_RANGE#*/} |
|
256 |
+ sudo ip addr add $EXT_GW_IP/$CIDR_LEN dev $PUBLIC_BRIDGE |
|
257 |
+ sudo ip link set $PUBLIC_BRIDGE up |
|
258 |
+ ROUTER_GW_IP=`quantum port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' '{ print $8; }'` |
|
259 |
+ sudo route add -net $FIXED_RANGE gw $ROUTER_GW_IP |
|
260 |
+ fi |
|
261 |
+ if [[ "$Q_USE_NAMESPACE" == "False" ]]; then |
|
262 |
+ # Explicitly set router id in l3 agent configuration |
|
263 |
+ iniset $Q_L3_CONF_FILE DEFAULT router_id $ROUTER_ID |
|
264 |
+ fi |
|
265 |
+ fi |
|
266 |
+} |
|
267 |
+ |
|
268 |
+# init_quantum() - Initialize databases, etc. |
|
269 |
+function init_quantum() { |
|
270 |
+ : |
|
271 |
+} |
|
272 |
+ |
|
273 |
+# install_quantum() - Collect source and prepare |
|
274 |
+function install_quantum() { |
|
275 |
+ git_clone $QUANTUM_REPO $QUANTUM_DIR $QUANTUM_BRANCH |
|
276 |
+} |
|
277 |
+ |
|
278 |
+# install_quantumclient() - Collect source and prepare |
|
279 |
+function install_quantumclient() { |
|
280 |
+ git_clone $QUANTUMCLIENT_REPO $QUANTUMCLIENT_DIR $QUANTUMCLIENT_BRANCH |
|
281 |
+} |
|
282 |
+ |
|
283 |
+# install_quantum_agent_packages() - Collect source and prepare |
|
284 |
+function install_quantum_agent_packages() { |
|
285 |
+ if is_quantum_ovs_base_plugin "$Q_PLUGIN"; then |
|
286 |
+ # Install deps |
|
287 |
+ # FIXME add to ``files/apts/quantum``, but don't install if not needed! |
|
288 |
+ if is_ubuntu; then |
|
289 |
+ kernel_version=`cat /proc/version | cut -d " " -f3` |
|
290 |
+ install_package make fakeroot dkms openvswitch-switch openvswitch-datapath-dkms linux-headers-$kernel_version |
|
291 |
+ else |
|
292 |
+ ### FIXME(dtroyer): Find RPMs for OpenVSwitch |
|
293 |
+ echo "OpenVSwitch packages need to be located" |
|
294 |
+ # Fedora does not started OVS by default |
|
295 |
+ restart_service openvswitch |
|
296 |
+ fi |
|
297 |
+ elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
298 |
+ install_package bridge-utils |
|
299 |
+ fi |
|
300 |
+} |
|
301 |
+ |
|
302 |
+function is_quantum_ovs_base_plugin() { |
|
303 |
+ local plugin=$1 |
|
304 |
+ if [[ ",openvswitch,ryu," =~ ,${plugin}, ]]; then |
|
305 |
+ return 0 |
|
306 |
+ fi |
|
307 |
+ return 1 |
|
308 |
+} |
|
309 |
+ |
|
310 |
+function setup_quantum() { |
|
311 |
+ setup_develop $QUANTUM_DIR |
|
312 |
+} |
|
313 |
+ |
|
314 |
+function setup_quantumclient() { |
|
315 |
+ setup_develop $QUANTUMCLIENT_DIR |
|
316 |
+} |
|
317 |
+ |
|
318 |
+# Start running processes, including screen |
|
319 |
+function start_quantum_service_and_check() { |
|
320 |
+ # Start the Quantum service |
|
321 |
+ screen_it q-svc "cd $QUANTUM_DIR && python $QUANTUM_DIR/bin/quantum-server --config-file $QUANTUM_CONF --config-file /$Q_PLUGIN_CONF_FILE" |
|
322 |
+ echo "Waiting for Quantum to start..." |
|
323 |
+ if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://127.0.0.1:9696; do sleep 1; done"; then |
|
324 |
+ echo "Quantum did not start" |
|
325 |
+ exit 1 |
|
326 |
+ fi |
|
327 |
+} |
|
328 |
+ |
|
329 |
+# Start running processes, including screen |
|
330 |
+function start_quantum_agents() { |
|
331 |
+ # Start up the quantum agents if enabled |
|
332 |
+ screen_it q-agt "python $AGENT_BINARY --config-file $QUANTUM_CONF --config-file /$Q_PLUGIN_CONF_FILE" |
|
333 |
+ screen_it q-dhcp "python $AGENT_DHCP_BINARY --config-file $QUANTUM_CONF --config-file=$Q_DHCP_CONF_FILE" |
|
334 |
+ screen_it q-meta "python $AGENT_META_BINARY --config-file $QUANTUM_CONF --config-file=$Q_META_CONF_FILE" |
|
335 |
+ screen_it q-l3 "python $AGENT_L3_BINARY --config-file $QUANTUM_CONF --config-file=$Q_L3_CONF_FILE" |
|
336 |
+} |
|
337 |
+ |
|
338 |
+# stop_quantum() - Stop running processes (non-screen) |
|
339 |
+function stop_quantum() { |
|
340 |
+ if is_service_enabled q-dhcp; then |
|
341 |
+ pid=$(ps aux | awk '/[d]nsmasq.+interface=(tap|ns-)/ { print $2 }') |
|
342 |
+ [ ! -z "$pid" ] && sudo kill -9 $pid |
|
343 |
+ fi |
|
344 |
+} |
|
345 |
+ |
|
346 |
+# _cleanup_quantum() - Remove residual data files, anything left over from previous |
|
347 |
+# runs that a clean run would need to clean up |
|
348 |
+function _cleanup_quantum() { |
|
349 |
+ : |
|
350 |
+} |
|
351 |
+ |
|
352 |
+# _configure_quantum_common() |
|
353 |
+# Set common config for all quantum server and agents. |
|
354 |
+# This MUST be called before other _configure_quantum_* functions. |
|
355 |
+function _configure_quantum_common() { |
|
356 |
+ # Put config files in ``QUANTUM_CONF_DIR`` for everyone to find |
|
357 |
+ if [[ ! -d $QUANTUM_CONF_DIR ]]; then |
|
358 |
+ sudo mkdir -p $QUANTUM_CONF_DIR |
|
359 |
+ fi |
|
360 |
+ sudo chown `whoami` $QUANTUM_CONF_DIR |
|
361 |
+ |
|
362 |
+ cp $QUANTUM_DIR/etc/quantum.conf $QUANTUM_CONF |
|
363 |
+ |
|
364 |
+ if [[ "$Q_PLUGIN" = "openvswitch" ]]; then |
|
365 |
+ Q_PLUGIN_CONF_PATH=etc/quantum/plugins/openvswitch |
|
366 |
+ Q_PLUGIN_CONF_FILENAME=ovs_quantum_plugin.ini |
|
367 |
+ Q_DB_NAME="ovs_quantum" |
|
368 |
+ Q_PLUGIN_CLASS="quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2" |
|
369 |
+ elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
370 |
+ Q_PLUGIN_CONF_PATH=etc/quantum/plugins/linuxbridge |
|
371 |
+ Q_PLUGIN_CONF_FILENAME=linuxbridge_conf.ini |
|
372 |
+ Q_DB_NAME="quantum_linux_bridge" |
|
373 |
+ Q_PLUGIN_CLASS="quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2" |
|
374 |
+ elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
375 |
+ Q_PLUGIN_CONF_PATH=etc/quantum/plugins/ryu |
|
376 |
+ Q_PLUGIN_CONF_FILENAME=ryu.ini |
|
377 |
+ Q_DB_NAME="ovs_quantum" |
|
378 |
+ Q_PLUGIN_CLASS="quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2" |
|
379 |
+ fi |
|
380 |
+ |
|
381 |
+ if [[ $Q_PLUGIN_CONF_PATH == '' || $Q_PLUGIN_CONF_FILENAME == '' || $Q_PLUGIN_CLASS == '' ]]; then |
|
382 |
+ echo "Quantum plugin not set.. exiting" |
|
383 |
+ exit 1 |
|
384 |
+ fi |
|
385 |
+ |
|
386 |
+ # If needed, move config file from ``$QUANTUM_DIR/etc/quantum`` to ``QUANTUM_CONF_DIR`` |
|
387 |
+ mkdir -p /$Q_PLUGIN_CONF_PATH |
|
388 |
+ Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME |
|
389 |
+ cp $QUANTUM_DIR/$Q_PLUGIN_CONF_FILE /$Q_PLUGIN_CONF_FILE |
|
390 |
+ |
|
391 |
+ database_connection_url dburl $Q_DB_NAME |
|
392 |
+ iniset /$Q_PLUGIN_CONF_FILE DATABASE sql_connection $dburl |
|
393 |
+ unset dburl |
|
394 |
+ |
|
395 |
+ _quantum_setup_rootwrap |
|
396 |
+} |
|
397 |
+ |
|
398 |
+function _configure_quantum_debug_command() { |
|
399 |
+ if [[ "$Q_USE_DEBUG_COMMAND" != "True" ]]; then |
|
400 |
+ return |
|
401 |
+ fi |
|
402 |
+ |
|
403 |
+ cp $QUANTUM_DIR/etc/l3_agent.ini $QUANTUM_TEST_CONFIG_FILE |
|
404 |
+ |
|
405 |
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT verbose False |
|
406 |
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT debug False |
|
407 |
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE |
|
408 |
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT root_helper "$Q_RR_COMMAND" |
|
409 |
+ |
|
410 |
+ _quantum_setup_keystone $QUANTUM_TEST_CONFIG_FILE DEFAULT set_auth_url |
|
411 |
+ _quantum_setup_interface_driver $QUANTUM_TEST_CONFIG_FILE |
|
412 |
+ |
|
413 |
+ if is_quantum_ovs_base_plugin "$Q_PLUGIN"; then |
|
414 |
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
|
415 |
+ elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
416 |
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge '' |
|
417 |
+ fi |
|
418 |
+ |
|
419 |
+ if [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
420 |
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
421 |
+ fi |
|
422 |
+} |
|
423 |
+ |
|
424 |
+function _configure_quantum_dhcp_agent() { |
|
425 |
+ AGENT_DHCP_BINARY="$QUANTUM_DIR/bin/quantum-dhcp-agent" |
|
426 |
+ Q_DHCP_CONF_FILE=$QUANTUM_CONF_DIR/dhcp_agent.ini |
|
427 |
+ |
|
428 |
+ cp $QUANTUM_DIR/etc/dhcp_agent.ini $Q_DHCP_CONF_FILE |
|
429 |
+ |
|
430 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT verbose True |
|
431 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT debug True |
|
432 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE |
|
433 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT state_path $DATA_DIR/quantum |
|
434 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND" |
|
435 |
+ |
|
436 |
+ _quantum_setup_keystone $Q_DHCP_CONF_FILE DEFAULT set_auth_url |
|
437 |
+ _quantum_setup_interface_driver $Q_DHCP_CONF_FILE |
|
438 |
+ |
|
439 |
+ if [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
440 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
441 |
+ fi |
|
442 |
+} |
|
443 |
+ |
|
444 |
+function _configure_quantum_l3_agent() { |
|
445 |
+ AGENT_L3_BINARY="$QUANTUM_DIR/bin/quantum-l3-agent" |
|
446 |
+ PUBLIC_BRIDGE=${PUBLIC_BRIDGE:-br-ex} |
|
447 |
+ Q_L3_CONF_FILE=$QUANTUM_CONF_DIR/l3_agent.ini |
|
448 |
+ |
|
449 |
+ cp $QUANTUM_DIR/etc/l3_agent.ini $Q_L3_CONF_FILE |
|
450 |
+ |
|
451 |
+ iniset $Q_L3_CONF_FILE DEFAULT verbose True |
|
452 |
+ iniset $Q_L3_CONF_FILE DEFAULT debug True |
|
453 |
+ iniset $Q_L3_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE |
|
454 |
+ iniset $Q_L3_CONF_FILE DEFAULT state_path $DATA_DIR/quantum |
|
455 |
+ iniset $Q_L3_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND" |
|
456 |
+ |
|
457 |
+ _quantum_setup_keystone $Q_L3_CONF_FILE DEFAULT set_auth_url |
|
458 |
+ _quantum_setup_interface_driver $Q_L3_CONF_FILE |
|
459 |
+ |
|
460 |
+ if is_quantum_ovs_base_plugin "$Q_PLUGIN"; then |
|
461 |
+ iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
|
462 |
+ _quantum_setup_external_bridge $PUBLIC_BRIDGE |
|
463 |
+ elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
464 |
+ iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge '' |
|
465 |
+ fi |
|
466 |
+ |
|
467 |
+ if [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
468 |
+ iniset $Q_L3_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
469 |
+ fi |
|
470 |
+} |
|
471 |
+ |
|
472 |
+function _configure_quantum_metadata_agent() { |
|
473 |
+ AGENT_META_BINARY="$QUANTUM_DIR/bin/quantum-metadata-agent" |
|
474 |
+ Q_META_CONF_FILE=$QUANTUM_CONF_DIR/metadata_agent.ini |
|
475 |
+ |
|
476 |
+ cp $QUANTUM_DIR/etc/metadata_agent.ini $Q_META_CONF_FILE |
|
477 |
+ |
|
478 |
+ iniset $Q_META_CONF_FILE DEFAULT verbose True |
|
479 |
+ iniset $Q_META_CONF_FILE DEFAULT debug True |
|
480 |
+ iniset $Q_META_CONF_FILE DEFAULT state_path $DATA_DIR/quantum |
|
481 |
+ iniset $Q_META_CONF_FILE DEFAULT nova_metadata_ip $Q_META_DATA_IP |
|
482 |
+ iniset $Q_META_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND" |
|
483 |
+ |
|
484 |
+ _quantum_setup_keystone $Q_META_CONF_FILE DEFAULT set_auth_url |
|
485 |
+} |
|
486 |
+ |
|
487 |
+# _configure_quantum_plugin_agent() - Set config files for quantum plugin agent |
|
488 |
+# It is called when q-agt is enabled. |
|
489 |
+function _configure_quantum_plugin_agent() { |
|
490 |
+ # Configure agent for plugin |
|
491 |
+ if [[ "$Q_PLUGIN" = "openvswitch" ]]; then |
|
492 |
+ _configure_quantum_plugin_agent_openvswitch |
|
493 |
+ elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
494 |
+ _configure_quantum_plugin_agent_linuxbridge |
|
495 |
+ elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
496 |
+ _configure_quantum_plugin_agent_ryu |
|
497 |
+ fi |
|
498 |
+ |
|
499 |
+ iniset /$Q_PLUGIN_CONF_FILE AGENT root_helper "$Q_RR_COMMAND" |
|
500 |
+} |
|
501 |
+ |
|
502 |
+function _configure_quantum_plugin_agent_linuxbridge() { |
|
503 |
+ # Setup physical network interface mappings. Override |
|
504 |
+ # ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` for more |
|
505 |
+ # complex physical network configurations. |
|
506 |
+ if [[ "$LB_INTERFACE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$LB_PHYSICAL_INTERFACE" != "" ]]; then |
|
507 |
+ LB_INTERFACE_MAPPINGS=$PHYSICAL_NETWORK:$LB_PHYSICAL_INTERFACE |
|
508 |
+ fi |
|
509 |
+ if [[ "$LB_INTERFACE_MAPPINGS" != "" ]]; then |
|
510 |
+ iniset /$Q_PLUGIN_CONF_FILE LINUX_BRIDGE physical_interface_mappings $LB_INTERFACE_MAPPINGS |
|
511 |
+ fi |
|
512 |
+ AGENT_BINARY="$QUANTUM_DIR/bin/quantum-linuxbridge-agent" |
|
513 |
+} |
|
514 |
+ |
|
515 |
+function _configure_quantum_plugin_agent_openvswitch() { |
|
516 |
+ # Setup integration bridge |
|
517 |
+ OVS_BRIDGE=${OVS_BRIDGE:-br-int} |
|
518 |
+ _quantum_setup_ovs_bridge $OVS_BRIDGE |
|
519 |
+ |
|
520 |
+ # Setup agent for tunneling |
|
521 |
+ if [[ "$OVS_ENABLE_TUNNELING" = "True" ]]; then |
|
522 |
+ # Verify tunnels are supported |
|
523 |
+ # REVISIT - also check kernel module support for GRE and patch ports |
|
524 |
+ OVS_VERSION=`ovs-vsctl --version | head -n 1 | awk '{print $4;}'` |
|
525 |
+ if [ $OVS_VERSION \< "1.4" ] && ! is_service_enabled q-svc ; then |
|
526 |
+ echo "You are running OVS version $OVS_VERSION." |
|
527 |
+ echo "OVS 1.4+ is required for tunneling between multiple hosts." |
|
528 |
+ exit 1 |
|
529 |
+ fi |
|
530 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS enable_tunneling True |
|
531 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS local_ip $HOST_IP |
|
532 |
+ fi |
|
533 |
+ |
|
534 |
+ # Setup physical network bridge mappings. Override |
|
535 |
+ # ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc`` for more |
|
536 |
+ # complex physical network configurations. |
|
537 |
+ if [[ "$OVS_BRIDGE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$OVS_PHYSICAL_BRIDGE" != "" ]]; then |
|
538 |
+ OVS_BRIDGE_MAPPINGS=$PHYSICAL_NETWORK:$OVS_PHYSICAL_BRIDGE |
|
539 |
+ |
|
540 |
+ # Configure bridge manually with physical interface as port for multi-node |
|
541 |
+ sudo ovs-vsctl --no-wait -- --may-exist add-br $OVS_PHYSICAL_BRIDGE |
|
542 |
+ fi |
|
543 |
+ if [[ "$OVS_BRIDGE_MAPPINGS" != "" ]]; then |
|
544 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS bridge_mappings $OVS_BRIDGE_MAPPINGS |
|
545 |
+ fi |
|
546 |
+ AGENT_BINARY="$QUANTUM_DIR/bin/quantum-openvswitch-agent" |
|
547 |
+} |
|
548 |
+ |
|
549 |
+function _configure_quantum_plugin_agent_ryu() { |
|
550 |
+ # Set up integration bridge |
|
551 |
+ OVS_BRIDGE=${OVS_BRIDGE:-br-int} |
|
552 |
+ _quantum_setup_ovs_bridge $OVS_BRIDGE |
|
553 |
+ if [ -n "$RYU_INTERNAL_INTERFACE" ]; then |
|
554 |
+ sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_BRIDGE $RYU_INTERNAL_INTERFACE |
|
555 |
+ fi |
|
556 |
+ AGENT_BINARY="$QUANTUM_DIR/quantum/plugins/ryu/agent/ryu_quantum_agent.py" |
|
557 |
+} |
|
558 |
+ |
|
559 |
+# Quantum RPC support - must be updated prior to starting any of the services |
|
560 |
+function _configure_quantum_rpc() { |
|
561 |
+ iniset $QUANTUM_CONF DEFAULT control_exchange quantum |
|
562 |
+ if is_service_enabled qpid ; then |
|
563 |
+ iniset $QUANTUM_CONF DEFAULT rpc_backend quantum.openstack.common.rpc.impl_qpid |
|
564 |
+ elif is_service_enabled zeromq; then |
|
565 |
+ iniset $QUANTUM_CONF DEFAULT rpc_backend quantum.openstack.common.rpc.impl_zmq |
|
566 |
+ elif [ -n "$RABBIT_HOST" ] && [ -n "$RABBIT_PASSWORD" ]; then |
|
567 |
+ iniset $QUANTUM_CONF DEFAULT rabbit_host $RABBIT_HOST |
|
568 |
+ iniset $QUANTUM_CONF DEFAULT rabbit_password $RABBIT_PASSWORD |
|
569 |
+ fi |
|
570 |
+} |
|
571 |
+ |
|
572 |
+# _configure_quantum_service() - Set config files for quantum service |
|
573 |
+# It is called when q-svc is enabled. |
|
574 |
+function _configure_quantum_service() { |
|
575 |
+ Q_API_PASTE_FILE=$QUANTUM_CONF_DIR/api-paste.ini |
|
576 |
+ Q_POLICY_FILE=$QUANTUM_CONF_DIR/policy.json |
|
577 |
+ |
|
578 |
+ cp $QUANTUM_DIR/etc/api-paste.ini $Q_API_PASTE_FILE |
|
579 |
+ cp $QUANTUM_DIR/etc/policy.json $Q_POLICY_FILE |
|
580 |
+ |
|
581 |
+ if is_service_enabled $DATABASE_BACKENDS; then |
|
582 |
+ recreate_database $Q_DB_NAME utf8 |
|
583 |
+ else |
|
584 |
+ echo "A database must be enabled in order to use the $Q_PLUGIN Quantum plugin." |
|
585 |
+ exit 1 |
|
586 |
+ fi |
|
587 |
+ |
|
588 |
+ # Update either configuration file with plugin |
|
589 |
+ iniset $QUANTUM_CONF DEFAULT core_plugin $Q_PLUGIN_CLASS |
|
590 |
+ |
|
591 |
+ iniset $QUANTUM_CONF DEFAULT verbose True |
|
592 |
+ iniset $QUANTUM_CONF DEFAULT debug True |
|
593 |
+ iniset $QUANTUM_CONF DEFAULT allow_overlapping_ips $Q_ALLOW_OVERLAPPING_IP |
|
594 |
+ |
|
595 |
+ iniset $QUANTUM_CONF DEFAULT auth_strategy $Q_AUTH_STRATEGY |
|
596 |
+ _quantum_setup_keystone $Q_API_PASTE_FILE filter:authtoken |
|
597 |
+ |
|
598 |
+ # Configure plugin |
|
599 |
+ if [[ "$Q_PLUGIN" = "openvswitch" ]]; then |
|
600 |
+ if [[ "$ENABLE_TENANT_TUNNELS" = "True" ]]; then |
|
601 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS tenant_network_type gre |
|
602 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS tunnel_id_ranges $TENANT_TUNNEL_RANGES |
|
603 |
+ elif [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then |
|
604 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS tenant_network_type vlan |
|
605 |
+ else |
|
606 |
+ echo "WARNING - The openvswitch plugin is using local tenant networks, with no connectivity between hosts." |
|
607 |
+ fi |
|
608 |
+ |
|
609 |
+ # Override ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc`` |
|
610 |
+ # for more complex physical network configurations. |
|
611 |
+ if [[ "$OVS_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then |
|
612 |
+ OVS_VLAN_RANGES=$PHYSICAL_NETWORK |
|
613 |
+ if [[ "$TENANT_VLAN_RANGE" != "" ]]; then |
|
614 |
+ OVS_VLAN_RANGES=$OVS_VLAN_RANGES:$TENANT_VLAN_RANGE |
|
615 |
+ fi |
|
616 |
+ fi |
|
617 |
+ if [[ "$OVS_VLAN_RANGES" != "" ]]; then |
|
618 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS network_vlan_ranges $OVS_VLAN_RANGES |
|
619 |
+ fi |
|
620 |
+ |
|
621 |
+ # Enable tunnel networks if selected |
|
622 |
+ if [[ $OVS_ENABLE_TUNNELING = "True" ]]; then |
|
623 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS enable_tunneling True |
|
624 |
+ fi |
|
625 |
+ elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
626 |
+ if [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then |
|
627 |
+ iniset /$Q_PLUGIN_CONF_FILE VLANS tenant_network_type vlan |
|
628 |
+ else |
|
629 |
+ echo "WARNING - The linuxbridge plugin is using local tenant networks, with no connectivity between hosts." |
|
630 |
+ fi |
|
631 |
+ |
|
632 |
+ # Override ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` |
|
633 |
+ # for more complex physical network configurations. |
|
634 |
+ if [[ "$LB_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then |
|
635 |
+ LB_VLAN_RANGES=$PHYSICAL_NETWORK |
|
636 |
+ if [[ "$TENANT_VLAN_RANGE" != "" ]]; then |
|
637 |
+ LB_VLAN_RANGES=$LB_VLAN_RANGES:$TENANT_VLAN_RANGE |
|
638 |
+ fi |
|
639 |
+ fi |
|
640 |
+ if [[ "$LB_VLAN_RANGES" != "" ]]; then |
|
641 |
+ iniset /$Q_PLUGIN_CONF_FILE VLANS network_vlan_ranges $LB_VLAN_RANGES |
|
642 |
+ fi |
|
643 |
+ elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
644 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS openflow_controller $RYU_OFP_HOST:$RYU_OFP_PORT |
|
645 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS openflow_rest_api $RYU_API_HOST:$RYU_API_PORT |
|
646 |
+ fi |
|
647 |
+} |
|
648 |
+ |
|
649 |
+# Utility Functions |
|
650 |
+#------------------ |
|
651 |
+ |
|
652 |
+# _quantum_setup_rootwrap() - configure Quantum's rootwrap |
|
653 |
+function _quantum_setup_rootwrap() { |
|
81 | 654 |
if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then |
82 | 655 |
return |
83 | 656 |
fi |
... | ... |
@@ -109,7 +713,7 @@ function configure_quantum_rootwrap() { |
109 | 109 |
} |
110 | 110 |
|
111 | 111 |
# Configures keystone integration for quantum service and agents |
112 |
-function quantum_setup_keystone() { |
|
112 |
+function _quantum_setup_keystone() { |
|
113 | 113 |
local conf_file=$1 |
114 | 114 |
local section=$2 |
115 | 115 |
local use_auth_url=$3 |
... | ... |
@@ -130,39 +734,54 @@ function quantum_setup_keystone() { |
130 | 130 |
rm -f $QUANTUM_AUTH_CACHE_DIR/* |
131 | 131 |
} |
132 | 132 |
|
133 |
-function quantum_setup_ovs_bridge() { |
|
133 |
+function _quantum_setup_ovs_bridge() { |
|
134 | 134 |
local bridge=$1 |
135 |
- for PORT in `sudo ovs-vsctl --no-wait list-ports $bridge`; do |
|
136 |
- if [[ "$PORT" =~ tap* ]]; then echo `sudo ip link delete $PORT` > /dev/null; fi |
|
137 |
- sudo ovs-vsctl --no-wait del-port $bridge $PORT |
|
138 |
- done |
|
139 |
- sudo ovs-vsctl --no-wait -- --if-exists del-br $bridge |
|
140 |
- sudo ovs-vsctl --no-wait add-br $bridge |
|
135 |
+ quantum-ovs-cleanup --ovs_integration_bridge $bridge |
|
136 |
+ sudo ovs-vsctl --no-wait -- --may-exist add-br $bridge |
|
141 | 137 |
sudo ovs-vsctl --no-wait br-set-external-id $bridge bridge-id $bridge |
142 | 138 |
} |
143 | 139 |
|
144 |
-function quantum_setup_external_bridge() { |
|
140 |
+function _quantum_setup_interface_driver() { |
|
141 |
+ local conf_file=$1 |
|
142 |
+ if [[ "$Q_PLUGIN" == "openvswitch" ]]; then |
|
143 |
+ iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver |
|
144 |
+ elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
145 |
+ iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver |
|
146 |
+ elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
147 |
+ iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.RyuInterfaceDriver |
|
148 |
+ fi |
|
149 |
+} |
|
150 |
+ |
|
151 |
+function _quantum_setup_external_bridge() { |
|
145 | 152 |
local bridge=$1 |
146 |
- # Create it if it does not exist |
|
153 |
+ quantum-ovs-cleanup --external_network_bridge $bridge |
|
147 | 154 |
sudo ovs-vsctl --no-wait -- --may-exist add-br $bridge |
148 |
- # remove internal ports |
|
149 |
- for PORT in `sudo ovs-vsctl --no-wait list-ports $bridge`; do |
|
150 |
- TYPE=$(sudo ovs-vsctl get interface $PORT type) |
|
151 |
- if [[ "$TYPE" == "internal" ]]; then |
|
152 |
- echo `sudo ip link delete $PORT` > /dev/null |
|
153 |
- sudo ovs-vsctl --no-wait del-port $bridge $PORT |
|
154 |
- fi |
|
155 |
- done |
|
156 | 155 |
# ensure no IP is configured on the public bridge |
157 | 156 |
sudo ip addr flush dev $bridge |
158 | 157 |
} |
159 | 158 |
|
160 |
-function is_quantum_ovs_base_plugin() { |
|
161 |
- local plugin=$1 |
|
162 |
- if [[ ",openvswitch,ryu," =~ ,${plugin}, ]]; then |
|
163 |
- return 0 |
|
159 |
+# Functions for Quantum Exercises |
|
160 |
+#-------------------------------- |
|
161 |
+ |
|
162 |
+function delete_probe() { |
|
163 |
+ local from_net="$1" |
|
164 |
+ net_id=`_get_net_id $from_net` |
|
165 |
+ probe_id=`quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}'` |
|
166 |
+ quantum-debug --os-tenant-name admin --os-username admin probe-delete $probe_id |
|
167 |
+} |
|
168 |
+ |
|
169 |
+function setup_quantum_debug() { |
|
170 |
+ if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then |
|
171 |
+ public_net_id=`_get_net_id $PUBLIC_NETWORK_NAME` |
|
172 |
+ quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create $public_net_id |
|
173 |
+ private_net_id=`_get_net_id $PRIVATE_NETWORK_NAME` |
|
174 |
+ quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create $private_net_id |
|
164 | 175 |
fi |
165 |
- return 1 |
|
176 |
+} |
|
177 |
+ |
|
178 |
+function teardown_quantum_debug() { |
|
179 |
+ delete_probe $PUBLIC_NETWORK_NAME |
|
180 |
+ delete_probe $PRIVATE_NETWORK_NAME |
|
166 | 181 |
} |
167 | 182 |
|
168 | 183 |
function _get_net_id() { |
... | ... |
@@ -176,13 +795,6 @@ function _get_probe_cmd_prefix() { |
176 | 176 |
echo "$Q_RR_COMMAND ip netns exec qprobe-$probe_id" |
177 | 177 |
} |
178 | 178 |
|
179 |
-function delete_probe() { |
|
180 |
- local from_net="$1" |
|
181 |
- net_id=`_get_net_id $from_net` |
|
182 |
- probe_id=`quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}'` |
|
183 |
- quantum-debug --os-tenant-name admin --os-username admin probe-delete $probe_id |
|
184 |
-} |
|
185 |
- |
|
186 | 179 |
function _ping_check_quantum() { |
187 | 180 |
local from_net=$1 |
188 | 181 |
local ip=$2 |
... | ... |
@@ -220,17 +832,59 @@ function _ssh_check_quantum() { |
220 | 220 |
fi |
221 | 221 |
} |
222 | 222 |
|
223 |
-function setup_quantum() { |
|
224 |
- public_net_id=`_get_net_id $PUBLIC_NETWORK_NAME` |
|
225 |
- quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create $public_net_id |
|
226 |
- private_net_id=`_get_net_id $PRIVATE_NETWORK_NAME` |
|
227 |
- quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create $private_net_id |
|
223 |
+# Quantum 3rd party programs |
|
224 |
+#--------------------------- |
|
225 |
+# A comma-separated list of 3rd party programs |
|
226 |
+QUANTUM_THIRD_PARTIES="ryu" |
|
227 |
+for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do |
|
228 |
+ source lib/$third_party |
|
229 |
+done |
|
230 |
+ |
|
231 |
+# configure_quantum_third_party() - Set config files, create data dirs, etc |
|
232 |
+function configure_quantum_third_party() { |
|
233 |
+ for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do |
|
234 |
+ if is_service_enabled $third_party; then |
|
235 |
+ configure_${third_party} |
|
236 |
+ fi |
|
237 |
+ done |
|
228 | 238 |
} |
229 | 239 |
|
230 |
-function teardown_quantum() { |
|
231 |
- delete_probe $PUBLIC_NETWORK_NAME |
|
232 |
- delete_probe $PRIVATE_NETWORK_NAME |
|
240 |
+# init_quantum_third_party() - Initialize databases, etc. |
|
241 |
+function init_quantum_third_party() { |
|
242 |
+ for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do |
|
243 |
+ if is_service_enabled $third_party; then |
|
244 |
+ init_${third_party} |
|
245 |
+ fi |
|
246 |
+ done |
|
247 |
+} |
|
248 |
+ |
|
249 |
+# install_quantum_third_party() - Collect source and prepare |
|
250 |
+function install_quantum_third_party() { |
|
251 |
+ for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do |
|
252 |
+ if is_service_enabled $third_party; then |
|
253 |
+ install_${third_party} |
|
254 |
+ fi |
|
255 |
+ done |
|
256 |
+} |
|
257 |
+ |
|
258 |
+# start_quantum_third_party() - Start running processes, including screen |
|
259 |
+function start_quantum_third_party() { |
|
260 |
+ for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do |
|
261 |
+ if is_service_enabled $third_party; then |
|
262 |
+ start_${third_party} |
|
263 |
+ fi |
|
264 |
+ done |
|
233 | 265 |
} |
234 | 266 |
|
267 |
+# stop_quantum_third_party - Stop running processes (non-screen) |
|
268 |
+function stop_quantum_third_party() { |
|
269 |
+ for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do |
|
270 |
+ if is_service_enabled $third_party; then |
|
271 |
+ stop_${third_party} |
|
272 |
+ fi |
|
273 |
+ done |
|
274 |
+} |
|
275 |
+ |
|
276 |
+ |
|
235 | 277 |
# Restore xtrace |
236 | 278 |
$XTRACE |
237 | 279 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,63 @@ |
0 |
+# Ryu OpenFlow Controller |
|
1 |
+# ----------------------- |
|
2 |
+ |
|
3 |
+# Save trace setting |
|
4 |
+XTRACE=$(set +o | grep xtrace) |
|
5 |
+set +o xtrace |
|
6 |
+ |
|
7 |
+ |
|
8 |
+RYU_DIR=$DEST/ryu |
|
9 |
+# Ryu API Host |
|
10 |
+RYU_API_HOST=${RYU_API_HOST:-127.0.0.1} |
|
11 |
+# Ryu API Port |
|
12 |
+RYU_API_PORT=${RYU_API_PORT:-8080} |
|
13 |
+# Ryu OFP Host |
|
14 |
+RYU_OFP_HOST=${RYU_OFP_HOST:-127.0.0.1} |
|
15 |
+# Ryu OFP Port |
|
16 |
+RYU_OFP_PORT=${RYU_OFP_PORT:-6633} |
|
17 |
+# Ryu Applications |
|
18 |
+RYU_APPS=${RYU_APPS:-ryu.app.simple_isolation,ryu.app.rest} |
|
19 |
+ |
|
20 |
+function configure_ryu() { |
|
21 |
+ setup_develop $RYU_DIR |
|
22 |
+} |
|
23 |
+ |
|
24 |
+function init_ryu() { |
|
25 |
+ RYU_CONF_DIR=/etc/ryu |
|
26 |
+ if [[ ! -d $RYU_CONF_DIR ]]; then |
|
27 |
+ sudo mkdir -p $RYU_CONF_DIR |
|
28 |
+ fi |
|
29 |
+ sudo chown `whoami` $RYU_CONF_DIR |
|
30 |
+ RYU_CONF=$RYU_CONF_DIR/ryu.conf |
|
31 |
+ sudo rm -rf $RYU_CONF |
|
32 |
+ |
|
33 |
+ cat <<EOF > $RYU_CONF |
|
34 |
+--app_lists=$RYU_APPS |
|
35 |
+--wsapi_host=$RYU_API_HOST |
|
36 |
+--wsapi_port=$RYU_API_PORT |
|
37 |
+--ofp_listen_host=$RYU_OFP_HOST |
|
38 |
+--ofp_tcp_listen_port=$RYU_OFP_PORT |
|
39 |
+EOF |
|
40 |
+} |
|
41 |
+ |
|
42 |
+function install_ryu() { |
|
43 |
+ git_clone $RYU_REPO $RYU_DIR $RYU_BRANCH |
|
44 |
+} |
|
45 |
+ |
|
46 |
+function is_ryu_required() { |
|
47 |
+ if is_service_enabled ryu || (is_service_enabled quantum && [[ "$Q_PLUGIN" = "ryu" ]]); then |
|
48 |
+ return 0 |
|
49 |
+ fi |
|
50 |
+ return 1 |
|
51 |
+} |
|
52 |
+ |
|
53 |
+function start_ryu() { |
|
54 |
+ screen_it ryu "cd $RYU_DIR && $RYU_DIR/bin/ryu-manager --flagfile $RYU_CONF" |
|
55 |
+} |
|
56 |
+ |
|
57 |
+function stop_ryu() { |
|
58 |
+ : |
|
59 |
+} |
|
60 |
+ |
|
61 |
+# Restore xtrace |
|
62 |
+$XTRACE |
... | ... |
@@ -190,7 +190,7 @@ function configure_tempest() { |
190 | 190 |
#Skip until #1074039 is fixed |
191 | 191 |
iniset $TEMPEST_CONF compute run_ssh False |
192 | 192 |
iniset $TEMPEST_CONF compute ssh_user ${DEFAULT_INSTANCE_USER:-$OS_USERNAME} |
193 |
- iniset $TEMPEST_CONF compute network_for_ssh private |
|
193 |
+ iniset $TEMPEST_CONF compute network_for_ssh $PRIVATE_NETWORK_NAME |
|
194 | 194 |
iniset $TEMPEST_CONF compute ip_version_for_ssh 4 |
195 | 195 |
iniset $TEMPEST_CONF compute ssh_timeout 4 |
196 | 196 |
iniset $TEMPEST_CONF compute image_ref $image_uuid |
... | ... |
@@ -199,7 +199,7 @@ function configure_tempest() { |
199 | 199 |
iniset $TEMPEST_CONF compute flavor_ref_alt $flavor_ref_alt |
200 | 200 |
iniset $TEMPEST_CONF compute source_dir $NOVA_SOURCE_DIR |
201 | 201 |
iniset $TEMPEST_CONF compute live_migration_available ${LIVE_MIGRATION_AVAILABLE:-False} |
202 |
- iniset $TEMPEST_CONF compute use_block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False} |
|
202 |
+ iniset $TEMPEST_CONF compute use_block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False} |
|
203 | 203 |
# Inherited behavior, might be wrong |
204 | 204 |
iniset $TEMPEST_CONF compute bin_dir $NOVA_BIN_DIR |
205 | 205 |
# TODO(jaypipes): Create the key file here... right now, no whitebox |
... | ... |
@@ -329,18 +329,6 @@ OPENSTACKCLIENT_DIR=$DEST/python-openstackclient |
329 | 329 |
NOVNC_DIR=$DEST/noVNC |
330 | 330 |
SWIFT3_DIR=$DEST/swift3 |
331 | 331 |
|
332 |
-RYU_DIR=$DEST/ryu |
|
333 |
-# Ryu API Host |
|
334 |
-RYU_API_HOST=${RYU_API_HOST:-127.0.0.1} |
|
335 |
-# Ryu API Port |
|
336 |
-RYU_API_PORT=${RYU_API_PORT:-8080} |
|
337 |
-# Ryu OFP Host |
|
338 |
-RYU_OFP_HOST=${RYU_OFP_HOST:-127.0.0.1} |
|
339 |
-# Ryu OFP Port |
|
340 |
-RYU_OFP_PORT=${RYU_OFP_PORT:-6633} |
|
341 |
-# Ryu Applications |
|
342 |
-RYU_APPS=${RYU_APPS:-ryu.app.simple_isolation,ryu.app.rest} |
|
343 |
- |
|
344 | 332 |
# Should cinder perform secure deletion of volumes? |
345 | 333 |
# Defaults to true, can be set to False to avoid this bug when testing: |
346 | 334 |
# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1023755 |
... | ... |
@@ -703,21 +691,7 @@ if is_service_enabled $DATABASE_BACKENDS; then |
703 | 703 |
fi |
704 | 704 |
|
705 | 705 |
if is_service_enabled q-agt; then |
706 |
- if is_quantum_ovs_base_plugin "$Q_PLUGIN"; then |
|
707 |
- # Install deps |
|
708 |
- # FIXME add to ``files/apts/quantum``, but don't install if not needed! |
|
709 |
- if is_ubuntu; then |
|
710 |
- kernel_version=`cat /proc/version | cut -d " " -f3` |
|
711 |
- install_package make fakeroot dkms openvswitch-switch openvswitch-datapath-dkms linux-headers-$kernel_version |
|
712 |
- else |
|
713 |
- ### FIXME(dtroyer): Find RPMs for OpenVSwitch |
|
714 |
- echo "OpenVSwitch packages need to be located" |
|
715 |
- # Fedora does not started OVS by default |
|
716 |
- restart_service openvswitch |
|
717 |
- fi |
|
718 |
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
719 |
- install_package bridge-utils |
|
720 |
- fi |
|
706 |
+ install_quantum_agent_packages |
|
721 | 707 |
fi |
722 | 708 |
|
723 | 709 |
TRACK_DEPENDS=${TRACK_DEPENDS:-False} |
... | ... |
@@ -778,11 +752,9 @@ if is_service_enabled horizon; then |
778 | 778 |
install_horizon |
779 | 779 |
fi |
780 | 780 |
if is_service_enabled quantum; then |
781 |
- git_clone $QUANTUMCLIENT_REPO $QUANTUMCLIENT_DIR $QUANTUMCLIENT_BRANCH |
|
782 |
-fi |
|
783 |
-if is_service_enabled quantum; then |
|
784 |
- # quantum |
|
785 |
- git_clone $QUANTUM_REPO $QUANTUM_DIR $QUANTUM_BRANCH |
|
781 |
+ install_quantum |
|
782 |
+ install_quantumclient |
|
783 |
+ install_quantum_third_party |
|
786 | 784 |
fi |
787 | 785 |
if is_service_enabled heat; then |
788 | 786 |
install_heat |
... | ... |
@@ -797,9 +769,6 @@ fi |
797 | 797 |
if is_service_enabled tempest; then |
798 | 798 |
install_tempest |
799 | 799 |
fi |
800 |
-if is_service_enabled ryu || (is_service_enabled quantum && [[ "$Q_PLUGIN" = "ryu" ]]); then |
|
801 |
- git_clone $RYU_REPO $RYU_DIR $RYU_BRANCH |
|
802 |
-fi |
|
803 | 800 |
|
804 | 801 |
|
805 | 802 |
# Initialization |
... | ... |
@@ -837,8 +806,8 @@ if is_service_enabled horizon; then |
837 | 837 |
configure_horizon |
838 | 838 |
fi |
839 | 839 |
if is_service_enabled quantum; then |
840 |
- setup_develop $QUANTUMCLIENT_DIR |
|
841 |
- setup_develop $QUANTUM_DIR |
|
840 |
+ setup_quantumclient |
|
841 |
+ setup_quantum |
|
842 | 842 |
fi |
843 | 843 |
if is_service_enabled heat; then |
844 | 844 |
configure_heat |
... | ... |
@@ -847,9 +816,6 @@ fi |
847 | 847 |
if is_service_enabled cinder; then |
848 | 848 |
configure_cinder |
849 | 849 |
fi |
850 |
-if is_service_enabled ryu || (is_service_enabled quantum && [[ "$Q_PLUGIN" = "ryu" ]]); then |
|
851 |
- setup_develop $RYU_DIR |
|
852 |
-fi |
|
853 | 850 |
|
854 | 851 |
if [[ $TRACK_DEPENDS = True ]] ; then |
855 | 852 |
$DEST/.venv/bin/pip freeze > $DEST/requires-post-pip |
... | ... |
@@ -962,6 +928,7 @@ if is_service_enabled key; then |
962 | 962 |
create_keystone_accounts |
963 | 963 |
create_nova_accounts |
964 | 964 |
create_cinder_accounts |
965 |
+ create_quantum_accounts |
|
965 | 966 |
|
966 | 967 |
# ``keystone_data.sh`` creates services, admin and demo users, and roles. |
967 | 968 |
ADMIN_PASSWORD=$ADMIN_PASSWORD SERVICE_TENANT_NAME=$SERVICE_TENANT_NAME SERVICE_PASSWORD=$SERVICE_PASSWORD \ |
... | ... |
@@ -1011,392 +978,22 @@ if is_service_enabled g-reg; then |
1011 | 1011 |
fi |
1012 | 1012 |
|
1013 | 1013 |
|
1014 |
-# Ryu |
|
1015 |
-# --- |
|
1016 |
- |
|
1017 |
-# Ryu is not a part of OpenStack project. Please ignore following block if |
|
1018 |
-# you are not interested in Ryu. |
|
1019 |
-# launch ryu manager |
|
1020 |
-if is_service_enabled ryu; then |
|
1021 |
- RYU_CONF_DIR=/etc/ryu |
|
1022 |
- if [[ ! -d $RYU_CONF_DIR ]]; then |
|
1023 |
- sudo mkdir -p $RYU_CONF_DIR |
|
1024 |
- fi |
|
1025 |
- sudo chown `whoami` $RYU_CONF_DIR |
|
1026 |
- RYU_CONF=$RYU_CONF_DIR/ryu.conf |
|
1027 |
- sudo rm -rf $RYU_CONF |
|
1028 |
- |
|
1029 |
- cat <<EOF > $RYU_CONF |
|
1030 |
-EOF |
|
1031 |
- screen_it ryu "cd $RYU_DIR && $RYU_DIR/bin/ryu-manager --flagfile $RYU_CONF" |
|
1032 |
-fi |
|
1033 |
- |
|
1034 |
- |
|
1035 | 1014 |
# Quantum |
1036 | 1015 |
# ------- |
1037 | 1016 |
|
1038 |
-# Quantum Network Configuration |
|
1039 | 1017 |
if is_service_enabled quantum; then |
1040 | 1018 |
echo_summary "Configuring Quantum" |
1041 | 1019 |
|
1042 |
- # The following variables control the Quantum openvswitch and |
|
1043 |
- # linuxbridge plugins' allocation of tenant networks and |
|
1044 |
- # availability of provider networks. If these are not configured |
|
1045 |
- # in localrc, tenant networks will be local to the host (with no |
|
1046 |
- # remote connectivity), and no physical resources will be |
|
1047 |
- # available for the allocation of provider networks. |
|
1048 |
- |
|
1049 |
- # To use GRE tunnels for tenant networks, set to True in |
|
1050 |
- # localrc. GRE tunnels are only supported by the openvswitch |
|
1051 |
- # plugin, and currently only on Ubuntu. |
|
1052 |
- ENABLE_TENANT_TUNNELS=${ENABLE_TENANT_TUNNELS:-False} |
|
1053 |
- |
|
1054 |
- # If using GRE tunnels for tenant networks, specify the range of |
|
1055 |
- # tunnel IDs from which tenant networks are allocated. Can be |
|
1056 |
- # overriden in localrc in necesssary. |
|
1057 |
- TENANT_TUNNEL_RANGES=${TENANT_TUNNEL_RANGE:-1:1000} |
|
1058 |
- |
|
1059 |
- # To use VLANs for tenant networks, set to True in localrc. VLANs |
|
1060 |
- # are supported by the openvswitch and linuxbridge plugins, each |
|
1061 |
- # requiring additional configuration described below. |
|
1062 |
- ENABLE_TENANT_VLANS=${ENABLE_TENANT_VLANS:-False} |
|
1063 |
- |
|
1064 |
- # If using VLANs for tenant networks, set in localrc to specify |
|
1065 |
- # the range of VLAN VIDs from which tenant networks are |
|
1066 |
- # allocated. An external network switch must be configured to |
|
1067 |
- # trunk these VLANs between hosts for multi-host connectivity. |
|
1068 |
- # |
|
1069 |
- # Example: ``TENANT_VLAN_RANGE=1000:1999`` |
|
1070 |
- TENANT_VLAN_RANGE=${TENANT_VLAN_RANGE:-} |
|
1071 |
- |
|
1072 |
- # If using VLANs for tenant networks, or if using flat or VLAN |
|
1073 |
- # provider networks, set in localrc to the name of the physical |
|
1074 |
- # network, and also configure OVS_PHYSICAL_BRIDGE for the |
|
1075 |
- # openvswitch agent or LB_PHYSICAL_INTERFACE for the linuxbridge |
|
1076 |
- # agent, as described below. |
|
1077 |
- # |
|
1078 |
- # Example: ``PHYSICAL_NETWORK=default`` |
|
1079 |
- PHYSICAL_NETWORK=${PHYSICAL_NETWORK:-} |
|
1080 |
- |
|
1081 |
- # With the openvswitch plugin, if using VLANs for tenant networks, |
|
1082 |
- # or if using flat or VLAN provider networks, set in localrc to |
|
1083 |
- # the name of the OVS bridge to use for the physical network. The |
|
1084 |
- # bridge will be created if it does not already exist, but a |
|
1085 |
- # physical interface must be manually added to the bridge as a |
|
1086 |
- # port for external connectivity. |
|
1087 |
- # |
|
1088 |
- # Example: ``OVS_PHYSICAL_BRIDGE=br-eth1`` |
|
1089 |
- OVS_PHYSICAL_BRIDGE=${OVS_PHYSICAL_BRIDGE:-} |
|
1090 |
- |
|
1091 |
- # With the linuxbridge plugin, if using VLANs for tenant networks, |
|
1092 |
- # or if using flat or VLAN provider networks, set in localrc to |
|
1093 |
- # the name of the network interface to use for the physical |
|
1094 |
- # network. |
|
1095 |
- # |
|
1096 |
- # Example: ``LB_PHYSICAL_INTERFACE=eth1`` |
|
1097 |
- LB_PHYSICAL_INTERFACE=${LB_PHYSICAL_INTERFACE:-} |
|
1098 |
- |
|
1099 |
- # With the openvswitch plugin, set to True in localrc to enable |
|
1100 |
- # provider GRE tunnels when ``ENABLE_TENANT_TUNNELS`` is False. |
|
1101 |
- # |
|
1102 |
- # Example: ``OVS_ENABLE_TUNNELING=True`` |
|
1103 |
- OVS_ENABLE_TUNNELING=${OVS_ENABLE_TUNNELING:-$ENABLE_TENANT_TUNNELS} |
|
1104 |
- |
|
1105 |
- # Put config files in ``QUANTUM_CONF_DIR`` for everyone to find |
|
1106 |
- if [[ ! -d $QUANTUM_CONF_DIR ]]; then |
|
1107 |
- sudo mkdir -p $QUANTUM_CONF_DIR |
|
1108 |
- fi |
|
1109 |
- sudo chown `whoami` $QUANTUM_CONF_DIR |
|
1110 |
- |
|
1111 |
- if [[ "$Q_PLUGIN" = "openvswitch" ]]; then |
|
1112 |
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/openvswitch |
|
1113 |
- Q_PLUGIN_CONF_FILENAME=ovs_quantum_plugin.ini |
|
1114 |
- Q_DB_NAME="ovs_quantum" |
|
1115 |
- Q_PLUGIN_CLASS="quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2" |
|
1116 |
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
1117 |
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/linuxbridge |
|
1118 |
- Q_PLUGIN_CONF_FILENAME=linuxbridge_conf.ini |
|
1119 |
- Q_DB_NAME="quantum_linux_bridge" |
|
1120 |
- Q_PLUGIN_CLASS="quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2" |
|
1121 |
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
1122 |
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/ryu |
|
1123 |
- Q_PLUGIN_CONF_FILENAME=ryu.ini |
|
1124 |
- Q_DB_NAME="ovs_quantum" |
|
1125 |
- Q_PLUGIN_CLASS="quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2" |
|
1126 |
- fi |
|
1127 |
- |
|
1128 |
- if [[ $Q_PLUGIN_CONF_PATH == '' || $Q_PLUGIN_CONF_FILENAME == '' || $Q_PLUGIN_CLASS == '' ]]; then |
|
1129 |
- echo "Quantum plugin not set.. exiting" |
|
1130 |
- exit 1 |
|
1131 |
- fi |
|
1132 |
- |
|
1133 |
- # If needed, move config file from ``$QUANTUM_DIR/etc/quantum`` to ``QUANTUM_CONF_DIR`` |
|
1134 |
- mkdir -p /$Q_PLUGIN_CONF_PATH |
|
1135 |
- Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME |
|
1136 |
- cp $QUANTUM_DIR/$Q_PLUGIN_CONF_FILE /$Q_PLUGIN_CONF_FILE |
|
1137 |
- |
|
1138 |
- database_connection_url dburl $Q_DB_NAME |
|
1139 |
- iniset /$Q_PLUGIN_CONF_FILE DATABASE sql_connection $dburl |
|
1140 |
- unset dburl |
|
1141 |
- |
|
1142 |
- cp $QUANTUM_DIR/etc/quantum.conf $QUANTUM_CONF |
|
1143 |
- configure_quantum_rootwrap |
|
1144 |
-fi |
|
1145 |
- |
|
1146 |
-# Quantum service (for controller node) |
|
1147 |
-if is_service_enabled q-svc; then |
|
1148 |
- Q_API_PASTE_FILE=$QUANTUM_CONF_DIR/api-paste.ini |
|
1149 |
- Q_POLICY_FILE=$QUANTUM_CONF_DIR/policy.json |
|
1150 |
- |
|
1151 |
- cp $QUANTUM_DIR/etc/api-paste.ini $Q_API_PASTE_FILE |
|
1152 |
- cp $QUANTUM_DIR/etc/policy.json $Q_POLICY_FILE |
|
1153 |
- |
|
1154 |
- if is_service_enabled $DATABASE_BACKENDS; then |
|
1155 |
- recreate_database $Q_DB_NAME utf8 |
|
1156 |
- else |
|
1157 |
- echo "A database must be enabled in order to use the $Q_PLUGIN Quantum plugin." |
|
1158 |
- exit 1 |
|
1159 |
- fi |
|
1160 |
- |
|
1161 |
- # Update either configuration file with plugin |
|
1162 |
- iniset $QUANTUM_CONF DEFAULT core_plugin $Q_PLUGIN_CLASS |
|
1163 |
- |
|
1164 |
- iniset $QUANTUM_CONF DEFAULT auth_strategy $Q_AUTH_STRATEGY |
|
1165 |
- quantum_setup_keystone $Q_API_PASTE_FILE filter:authtoken |
|
1166 |
- |
|
1167 |
- # Configure plugin |
|
1168 |
- if [[ "$Q_PLUGIN" = "openvswitch" ]]; then |
|
1169 |
- if [[ "$ENABLE_TENANT_TUNNELS" = "True" ]]; then |
|
1170 |
- iniset /$Q_PLUGIN_CONF_FILE OVS tenant_network_type gre |
|
1171 |
- iniset /$Q_PLUGIN_CONF_FILE OVS tunnel_id_ranges $TENANT_TUNNEL_RANGES |
|
1172 |
- elif [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then |
|
1173 |
- iniset /$Q_PLUGIN_CONF_FILE OVS tenant_network_type vlan |
|
1174 |
- else |
|
1175 |
- echo "WARNING - The openvswitch plugin is using local tenant networks, with no connectivity between hosts." |
|
1176 |
- fi |
|
1177 |
- |
|
1178 |
- # Override ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc`` |
|
1179 |
- # for more complex physical network configurations. |
|
1180 |
- if [[ "$OVS_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then |
|
1181 |
- OVS_VLAN_RANGES=$PHYSICAL_NETWORK |
|
1182 |
- if [[ "$TENANT_VLAN_RANGE" != "" ]]; then |
|
1183 |
- OVS_VLAN_RANGES=$OVS_VLAN_RANGES:$TENANT_VLAN_RANGE |
|
1184 |
- fi |
|
1185 |
- fi |
|
1186 |
- if [[ "$OVS_VLAN_RANGES" != "" ]]; then |
|
1187 |
- iniset /$Q_PLUGIN_CONF_FILE OVS network_vlan_ranges $OVS_VLAN_RANGES |
|
1188 |
- fi |
|
1189 |
- |
|
1190 |
- # Enable tunnel networks if selected |
|
1191 |
- if [[ $OVS_ENABLE_TUNNELING = "True" ]]; then |
|
1192 |
- iniset /$Q_PLUGIN_CONF_FILE OVS enable_tunneling True |
|
1193 |
- fi |
|
1194 |
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
1195 |
- if [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then |
|
1196 |
- iniset /$Q_PLUGIN_CONF_FILE VLANS tenant_network_type vlan |
|
1197 |
- else |
|
1198 |
- echo "WARNING - The linuxbridge plugin is using local tenant networks, with no connectivity between hosts." |
|
1199 |
- fi |
|
1200 |
- |
|
1201 |
- # Override ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` |
|
1202 |
- # for more complex physical network configurations. |
|
1203 |
- if [[ "$LB_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then |
|
1204 |
- LB_VLAN_RANGES=$PHYSICAL_NETWORK |
|
1205 |
- if [[ "$TENANT_VLAN_RANGE" != "" ]]; then |
|
1206 |
- LB_VLAN_RANGES=$LB_VLAN_RANGES:$TENANT_VLAN_RANGE |
|
1207 |
- fi |
|
1208 |
- fi |
|
1209 |
- if [[ "$LB_VLAN_RANGES" != "" ]]; then |
|
1210 |
- iniset /$Q_PLUGIN_CONF_FILE VLANS network_vlan_ranges $LB_VLAN_RANGES |
|
1211 |
- fi |
|
1212 |
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
1213 |
- iniset /$Q_PLUGIN_CONF_FILE OVS openflow_controller $RYU_OFP_HOST:$RYU_OFP_PORT |
|
1214 |
- iniset /$Q_PLUGIN_CONF_FILE OVS openflow_rest_api $RYU_API_HOST:$RYU_API_PORT |
|
1215 |
- fi |
|
1216 |
-fi |
|
1217 |
- |
|
1218 |
-# Quantum agent (for compute nodes) |
|
1219 |
-if is_service_enabled q-agt; then |
|
1220 |
- # Configure agent for plugin |
|
1221 |
- if [[ "$Q_PLUGIN" = "openvswitch" ]]; then |
|
1222 |
- # Setup integration bridge |
|
1223 |
- OVS_BRIDGE=${OVS_BRIDGE:-br-int} |
|
1224 |
- quantum_setup_ovs_bridge $OVS_BRIDGE |
|
1225 |
- |
|
1226 |
- # Setup agent for tunneling |
|
1227 |
- if [[ "$OVS_ENABLE_TUNNELING" = "True" ]]; then |
|
1228 |
- # Verify tunnels are supported |
|
1229 |
- # REVISIT - also check kernel module support for GRE and patch ports |
|
1230 |
- OVS_VERSION=`ovs-vsctl --version | head -n 1 | awk '{print $4;}'` |
|
1231 |
- if [ $OVS_VERSION \< "1.4" ] && ! is_service_enabled q-svc ; then |
|
1232 |
- echo "You are running OVS version $OVS_VERSION." |
|
1233 |
- echo "OVS 1.4+ is required for tunneling between multiple hosts." |
|
1234 |
- exit 1 |
|
1235 |
- fi |
|
1236 |
- iniset /$Q_PLUGIN_CONF_FILE OVS enable_tunneling True |
|
1237 |
- iniset /$Q_PLUGIN_CONF_FILE OVS local_ip $HOST_IP |
|
1238 |
- fi |
|
1239 |
- |
|
1240 |
- # Setup physical network bridge mappings. Override |
|
1241 |
- # ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc`` for more |
|
1242 |
- # complex physical network configurations. |
|
1243 |
- if [[ "$OVS_BRIDGE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$OVS_PHYSICAL_BRIDGE" != "" ]]; then |
|
1244 |
- OVS_BRIDGE_MAPPINGS=$PHYSICAL_NETWORK:$OVS_PHYSICAL_BRIDGE |
|
1245 |
- |
|
1246 |
- # Configure bridge manually with physical interface as port for multi-node |
|
1247 |
- sudo ovs-vsctl --no-wait -- --may-exist add-br $OVS_PHYSICAL_BRIDGE |
|
1248 |
- fi |
|
1249 |
- if [[ "$OVS_BRIDGE_MAPPINGS" != "" ]]; then |
|
1250 |
- iniset /$Q_PLUGIN_CONF_FILE OVS bridge_mappings $OVS_BRIDGE_MAPPINGS |
|
1251 |
- fi |
|
1252 |
- AGENT_BINARY="$QUANTUM_DIR/bin/quantum-openvswitch-agent" |
|
1253 |
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
1254 |
- # Setup physical network interface mappings. Override |
|
1255 |
- # ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` for more |
|
1256 |
- # complex physical network configurations. |
|
1257 |
- if [[ "$LB_INTERFACE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$LB_PHYSICAL_INTERFACE" != "" ]]; then |
|
1258 |
- LB_INTERFACE_MAPPINGS=$PHYSICAL_NETWORK:$LB_PHYSICAL_INTERFACE |
|
1259 |
- fi |
|
1260 |
- if [[ "$LB_INTERFACE_MAPPINGS" != "" ]]; then |
|
1261 |
- iniset /$Q_PLUGIN_CONF_FILE LINUX_BRIDGE physical_interface_mappings $LB_INTERFACE_MAPPINGS |
|
1262 |
- fi |
|
1263 |
- AGENT_BINARY="$QUANTUM_DIR/bin/quantum-linuxbridge-agent" |
|
1264 |
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
1265 |
- # Set up integration bridge |
|
1266 |
- OVS_BRIDGE=${OVS_BRIDGE:-br-int} |
|
1267 |
- quantum_setup_ovs_bridge $OVS_BRIDGE |
|
1268 |
- if [ -n "$RYU_INTERNAL_INTERFACE" ]; then |
|
1269 |
- sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_BRIDGE $RYU_INTERNAL_INTERFACE |
|
1270 |
- fi |
|
1271 |
- AGENT_BINARY="$QUANTUM_DIR/quantum/plugins/ryu/agent/ryu_quantum_agent.py" |
|
1272 |
- fi |
|
1273 |
- # Update config w/rootwrap |
|
1274 |
- iniset /$Q_PLUGIN_CONF_FILE AGENT root_helper "$Q_RR_COMMAND" |
|
1020 |
+ configure_quantum |
|
1021 |
+ init_quantum |
|
1275 | 1022 |
fi |
1276 | 1023 |
|
1277 |
-# Quantum DHCP |
|
1278 |
-if is_service_enabled q-dhcp; then |
|
1279 |
- AGENT_DHCP_BINARY="$QUANTUM_DIR/bin/quantum-dhcp-agent" |
|
1280 |
- |
|
1281 |
- Q_DHCP_CONF_FILE=$QUANTUM_CONF_DIR/dhcp_agent.ini |
|
1282 |
- |
|
1283 |
- cp $QUANTUM_DIR/etc/dhcp_agent.ini $Q_DHCP_CONF_FILE |
|
1284 |
- |
|
1285 |
- # Set verbose |
|
1286 |
- iniset $Q_DHCP_CONF_FILE DEFAULT verbose True |
|
1287 |
- # Set debug |
|
1288 |
- iniset $Q_DHCP_CONF_FILE DEFAULT debug True |
|
1289 |
- iniset $Q_DHCP_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE |
|
1290 |
- iniset $Q_DHCP_CONF_FILE DEFAULT state_path $DATA_DIR/quantum |
|
1291 |
- |
|
1292 |
- quantum_setup_keystone $Q_DHCP_CONF_FILE DEFAULT set_auth_url |
|
1293 |
- |
|
1294 |
- # Update config w/rootwrap |
|
1295 |
- iniset $Q_DHCP_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND" |
|
1296 |
- |
|
1297 |
- if [[ "$Q_PLUGIN" = "openvswitch" ]]; then |
|
1298 |
- iniset $Q_DHCP_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver |
|
1299 |
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
1300 |
- iniset $Q_DHCP_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver |
|
1301 |
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
1302 |
- iniset $Q_DHCP_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.RyuInterfaceDriver |
|
1303 |
- iniset $Q_DHCP_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
1304 |
- fi |
|
1305 |
-fi |
|
1306 |
- |
|
1307 |
-# Quantum L3 |
|
1308 |
-if is_service_enabled q-l3; then |
|
1309 |
- AGENT_L3_BINARY="$QUANTUM_DIR/bin/quantum-l3-agent" |
|
1310 |
- PUBLIC_BRIDGE=${PUBLIC_BRIDGE:-br-ex} |
|
1311 |
- Q_L3_CONF_FILE=$QUANTUM_CONF_DIR/l3_agent.ini |
|
1312 |
- |
|
1313 |
- cp $QUANTUM_DIR/etc/l3_agent.ini $Q_L3_CONF_FILE |
|
1314 |
- |
|
1315 |
- # Set verbose |
|
1316 |
- iniset $Q_L3_CONF_FILE DEFAULT verbose True |
|
1317 |
- # Set debug |
|
1318 |
- iniset $Q_L3_CONF_FILE DEFAULT debug True |
|
1319 |
- |
|
1320 |
- iniset $Q_L3_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE |
|
1321 |
- |
|
1322 |
- iniset $Q_L3_CONF_FILE DEFAULT state_path $DATA_DIR/quantum |
|
1323 |
- |
|
1324 |
- iniset $Q_L3_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND" |
|
1325 |
- |
|
1326 |
- quantum_setup_keystone $Q_L3_CONF_FILE DEFAULT set_auth_url |
|
1327 |
- if [[ "$Q_PLUGIN" == "openvswitch" ]]; then |
|
1328 |
- iniset $Q_L3_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver |
|
1329 |
- iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
|
1330 |
- # Set up external bridge |
|
1331 |
- quantum_setup_external_bridge $PUBLIC_BRIDGE |
|
1332 |
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
1333 |
- iniset $Q_L3_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver |
|
1334 |
- iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge '' |
|
1335 |
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
1336 |
- iniset $Q_L3_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.RyuInterfaceDriver |
|
1337 |
- iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
|
1338 |
- iniset $Q_L3_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
1339 |
- # Set up external bridge |
|
1340 |
- quantum_setup_external_bridge $PUBLIC_BRIDGE |
|
1341 |
- fi |
|
1342 |
-fi |
|
1343 |
- |
|
1344 |
-#Quantum Metadata |
|
1345 |
-if is_service_enabled q-meta; then |
|
1346 |
- AGENT_META_BINARY="$QUANTUM_DIR/bin/quantum-metadata-agent" |
|
1347 |
- Q_META_CONF_FILE=$QUANTUM_CONF_DIR/metadata_agent.ini |
|
1348 |
- |
|
1349 |
- cp $QUANTUM_DIR/etc/metadata_agent.ini $Q_META_CONF_FILE |
|
1350 |
- |
|
1351 |
- # Set verbose |
|
1352 |
- iniset $Q_META_CONF_FILE DEFAULT verbose True |
|
1353 |
- # Set debug |
|
1354 |
- iniset $Q_META_CONF_FILE DEFAULT debug True |
|
1355 |
- |
|
1356 |
- iniset $Q_META_CONF_FILE DEFAULT state_path $DATA_DIR/quantum |
|
1357 |
- |
|
1358 |
- iniset $Q_META_CONF_FILE DEFAULT nova_metadata_ip $Q_META_DATA_IP |
|
1359 |
- |
|
1360 |
- iniset $Q_META_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND" |
|
1361 |
- |
|
1362 |
- quantum_setup_keystone $Q_META_CONF_FILE DEFAULT set_auth_url |
|
1363 |
-fi |
|
1364 |
- |
|
1365 |
-# Quantum RPC support - must be updated prior to starting any of the services |
|
1024 |
+# Some Quantum plugins require network controllers which are not |
|
1025 |
+# a part of the OpenStack project. Configure and start them. |
|
1366 | 1026 |
if is_service_enabled quantum; then |
1367 |
- iniset $QUANTUM_CONF DEFAULT control_exchange quantum |
|
1368 |
- if is_service_enabled qpid ; then |
|
1369 |
- iniset $QUANTUM_CONF DEFAULT rpc_backend quantum.openstack.common.rpc.impl_qpid |
|
1370 |
- elif is_service_enabled zeromq; then |
|
1371 |
- iniset $QUANTUM_CONF DEFAULT rpc_backend quantum.openstack.common.rpc.impl_zmq |
|
1372 |
- elif [ -n "$RABBIT_HOST" ] && [ -n "$RABBIT_PASSWORD" ]; then |
|
1373 |
- iniset $QUANTUM_CONF DEFAULT rabbit_host $RABBIT_HOST |
|
1374 |
- iniset $QUANTUM_CONF DEFAULT rabbit_password $RABBIT_PASSWORD |
|
1375 |
- fi |
|
1376 |
- if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then |
|
1377 |
- cp $QUANTUM_DIR/etc/l3_agent.ini $QUANTUM_TEST_CONFIG_FILE |
|
1378 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT verbose False |
|
1379 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT debug False |
|
1380 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE |
|
1381 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT root_helper "$Q_RR_COMMAND" |
|
1382 |
- quantum_setup_keystone $QUANTUM_TEST_CONFIG_FILE DEFAULT set_auth_url |
|
1383 |
- if [[ "$Q_PLUGIN" == "openvswitch" ]]; then |
|
1384 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver |
|
1385 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
|
1386 |
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
1387 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver |
|
1388 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge '' |
|
1389 |
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
1390 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT interface_driver quantum.agent.linux.interface.RyuInterfaceDriver |
|
1391 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
|
1392 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
1393 |
- fi |
|
1394 |
- fi |
|
1027 |
+ configure_quantum_third_party |
|
1028 |
+ init_quantum_third_party |
|
1029 |
+ start_quantum_third_party |
|
1395 | 1030 |
fi |
1396 | 1031 |
|
1397 | 1032 |
|
... | ... |
@@ -1445,37 +1042,9 @@ if is_service_enabled nova; then |
1445 | 1445 |
|
1446 | 1446 |
# Additional Nova configuration that is dependent on other services |
1447 | 1447 |
if is_service_enabled quantum; then |
1448 |
- add_nova_opt "network_api_class=nova.network.quantumv2.api.API" |
|
1449 |
- add_nova_opt "quantum_admin_username=$Q_ADMIN_USERNAME" |
|
1450 |
- add_nova_opt "quantum_admin_password=$SERVICE_PASSWORD" |
|
1451 |
- add_nova_opt "quantum_admin_auth_url=$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v2.0" |
|
1452 |
- add_nova_opt "quantum_auth_strategy=$Q_AUTH_STRATEGY" |
|
1453 |
- add_nova_opt "quantum_admin_tenant_name=$SERVICE_TENANT_NAME" |
|
1454 |
- add_nova_opt "quantum_url=http://$Q_HOST:$Q_PORT" |
|
1455 |
- |
|
1456 |
- if [[ "$Q_PLUGIN" = "openvswitch" ]]; then |
|
1457 |
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver"} |
|
1458 |
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
1459 |
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.QuantumLinuxBridgeVIFDriver"} |
|
1460 |
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
1461 |
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"quantum.plugins.ryu.nova.vif.LibvirtOpenVswitchOFPRyuDriver"} |
|
1462 |
- add_nova_opt "libvirt_ovs_integration_bridge=$OVS_BRIDGE" |
|
1463 |
- add_nova_opt "linuxnet_ovs_ryu_api_host=$RYU_API_HOST:$RYU_API_PORT" |
|
1464 |
- add_nova_opt "libvirt_ovs_ryu_api_host=$RYU_API_HOST:$RYU_API_PORT" |
|
1465 |
- fi |
|
1466 |
- add_nova_opt "libvirt_vif_driver=$NOVA_VIF_DRIVER" |
|
1467 |
- add_nova_opt "linuxnet_interface_driver=$LINUXNET_VIF_DRIVER" |
|
1468 |
- if is_service_enabled q-meta; then |
|
1469 |
- add_nova_opt "service_quantum_metadata_proxy=True" |
|
1470 |
- fi |
|
1448 |
+ create_nova_conf_quantum |
|
1471 | 1449 |
elif is_service_enabled n-net; then |
1472 |
- add_nova_opt "network_manager=nova.network.manager.$NET_MAN" |
|
1473 |
- add_nova_opt "public_interface=$PUBLIC_INTERFACE" |
|
1474 |
- add_nova_opt "vlan_interface=$VLAN_INTERFACE" |
|
1475 |
- add_nova_opt "flat_network_bridge=$FLAT_NETWORK_BRIDGE" |
|
1476 |
- if [ -n "$FLAT_INTERFACE" ]; then |
|
1477 |
- add_nova_opt "flat_interface=$FLAT_INTERFACE" |
|
1478 |
- fi |
|
1450 |
+ create_nova_conf_nova_network |
|
1479 | 1451 |
fi |
1480 | 1452 |
# All nova-compute workers need to know the vnc configuration options |
1481 | 1453 |
# These settings don't hurt anything if n-xvnc and n-novnc are disabled |
... | ... |
@@ -1584,64 +1153,24 @@ fi |
1584 | 1584 |
|
1585 | 1585 |
if is_service_enabled q-svc; then |
1586 | 1586 |
echo_summary "Starting Quantum" |
1587 |
- # Start the Quantum service |
|
1588 |
- screen_it q-svc "cd $QUANTUM_DIR && python $QUANTUM_DIR/bin/quantum-server --config-file $QUANTUM_CONF --config-file /$Q_PLUGIN_CONF_FILE" |
|
1589 |
- echo "Waiting for Quantum to start..." |
|
1590 |
- if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://127.0.0.1:9696; do sleep 1; done"; then |
|
1591 |
- echo "Quantum did not start" |
|
1592 |
- exit 1 |
|
1593 |
- fi |
|
1594 | 1587 |
|
1595 |
- # Configure Quantum elements |
|
1596 |
- # Configure internal network & subnet |
|
1597 |
- |
|
1598 |
- TENANT_ID=$(keystone tenant-list | grep " demo " | get_field 1) |
|
1599 |
- |
|
1600 |
- # Create a small network |
|
1601 |
- # Since quantum command is executed in admin context at this point, |
|
1602 |
- # ``--tenant_id`` needs to be specified. |
|
1603 |
- NET_ID=$(quantum net-create --tenant_id $TENANT_ID "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2) |
|
1604 |
- SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2) |
|
1605 |
- if is_service_enabled q-l3; then |
|
1606 |
- # Create a router, and add the private subnet as one of its interfaces |
|
1607 |
- ROUTER_ID=$(quantum router-create --tenant_id $TENANT_ID router1 | grep ' id ' | get_field 2) |
|
1608 |
- quantum router-interface-add $ROUTER_ID $SUBNET_ID |
|
1609 |
- # Create an external network, and a subnet. Configure the external network as router gw |
|
1610 |
- EXT_NET_ID=$(quantum net-create "$PUBLIC_NETWORK_NAME" -- --router:external=True | grep ' id ' | get_field 2) |
|
1611 |
- EXT_GW_IP=$(quantum subnet-create --ip_version 4 $EXT_NET_ID $FLOATING_RANGE -- --enable_dhcp=False | grep 'gateway_ip' | get_field 2) |
|
1612 |
- quantum router-gateway-set $ROUTER_ID $EXT_NET_ID |
|
1613 |
- if is_quantum_ovs_base_plugin "$Q_PLUGIN" && [[ "$Q_USE_NAMESPACE" = "True" ]]; then |
|
1614 |
- CIDR_LEN=${FLOATING_RANGE#*/} |
|
1615 |
- sudo ip addr add $EXT_GW_IP/$CIDR_LEN dev $PUBLIC_BRIDGE |
|
1616 |
- sudo ip link set $PUBLIC_BRIDGE up |
|
1617 |
- ROUTER_GW_IP=`quantum port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' '{ print $8; }'` |
|
1618 |
- sudo route add -net $FIXED_RANGE gw $ROUTER_GW_IP |
|
1619 |
- fi |
|
1620 |
- if [[ "$Q_USE_NAMESPACE" == "False" ]]; then |
|
1621 |
- # Explicitly set router id in l3 agent configuration |
|
1622 |
- iniset $Q_L3_CONF_FILE DEFAULT router_id $ROUTER_ID |
|
1623 |
- fi |
|
1624 |
- fi |
|
1625 |
- if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then |
|
1626 |
- setup_quantum |
|
1627 |
- fi |
|
1588 |
+ start_quantum_service_and_check |
|
1589 |
+ create_quantum_initial_network |
|
1590 |
+ setup_quantum_debug |
|
1628 | 1591 |
elif is_service_enabled $DATABASE_BACKENDS && is_service_enabled n-net; then |
1629 | 1592 |
# Create a small network |
1630 | 1593 |
$NOVA_BIN_DIR/nova-manage network create "$PRIVATE_NETWORK_NAME" $FIXED_RANGE 1 $FIXED_NETWORK_SIZE $NETWORK_CREATE_ARGS |
1631 | 1594 |
|
1632 | 1595 |
# Create some floating ips |
1633 |
- $NOVA_BIN_DIR/nova-manage floating create $FLOATING_RANGE --pool=$PUBLIC_NETWORK |
|
1596 |
+ $NOVA_BIN_DIR/nova-manage floating create $FLOATING_RANGE --pool=$PUBLIC_NETWORK_NAME |
|
1634 | 1597 |
|
1635 | 1598 |
# Create a second pool |
1636 | 1599 |
$NOVA_BIN_DIR/nova-manage floating create --ip_range=$TEST_FLOATING_RANGE --pool=$TEST_FLOATING_POOL |
1637 | 1600 |
fi |
1638 | 1601 |
|
1639 |
-# Start up the quantum agents if enabled |
|
1640 |
-screen_it q-agt "python $AGENT_BINARY --config-file $QUANTUM_CONF --config-file /$Q_PLUGIN_CONF_FILE" |
|
1641 |
-screen_it q-dhcp "python $AGENT_DHCP_BINARY --config-file $QUANTUM_CONF --config-file=$Q_DHCP_CONF_FILE" |
|
1642 |
-screen_it q-meta "python $AGENT_META_BINARY --config-file $QUANTUM_CONF --config-file=$Q_META_CONF_FILE" |
|
1643 |
-screen_it q-l3 "python $AGENT_L3_BINARY --config-file $QUANTUM_CONF --config-file=$Q_L3_CONF_FILE" |
|
1644 |
- |
|
1602 |
+if is_service_enabled quantum; then |
|
1603 |
+ start_quantum_agents |
|
1604 |
+fi |
|
1645 | 1605 |
if is_service_enabled nova; then |
1646 | 1606 |
echo_summary "Starting Nova" |
1647 | 1607 |
start_nova |
... | ... |
@@ -28,6 +28,7 @@ DATA_DIR=${DATA_DIR:-${DEST}/data} |
28 | 28 |
source $TOP_DIR/lib/cinder |
29 | 29 |
source $TOP_DIR/lib/horizon |
30 | 30 |
source $TOP_DIR/lib/swift |
31 |
+source $TOP_DIR/lib/quantum |
|
31 | 32 |
|
32 | 33 |
# Determine what system we are running on. This provides ``os_VENDOR``, |
33 | 34 |
# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME`` |
... | ... |
@@ -39,8 +40,7 @@ fi |
39 | 39 |
|
40 | 40 |
if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then |
41 | 41 |
source $TOP_DIR/openrc |
42 |
- source $TOP_DIR/lib/quantum |
|
43 |
- teardown_quantum |
|
42 |
+ teardown_quantum_debug |
|
44 | 43 |
fi |
45 | 44 |
|
46 | 45 |
# Shut down devstack's screen to get the bulk of OpenStack services in one shot |
... | ... |
@@ -119,8 +119,7 @@ if [[ -n "$UNSTACK_ALL" ]]; then |
119 | 119 |
fi |
120 | 120 |
fi |
121 | 121 |
|
122 |
-# Quantum dhcp agent runs dnsmasq |
|
123 |
-if is_service_enabled q-dhcp; then |
|
124 |
- pid=$(ps aux | awk '/[d]nsmasq.+interface=tap/ { print $2 }') |
|
125 |
- [ ! -z "$pid" ] && sudo kill -9 $pid |
|
122 |
+if is_service_enabled quantum; then |
|
123 |
+ stop_quantum |
|
124 |
+ stop_quantum_third_party |
|
126 | 125 |
fi |