blob: 0b26622464292ff69257c826427993b88ed9b84f [file] [log] [blame]
Salvatore Orlandod6767d02012-08-31 04:55:20 -07001# lib/quantum
2# functions - funstions specific to quantum
3
4# Save trace setting
5XTRACE=$(set +o | grep xtrace)
6set +o xtrace
7
8# Configures keystone integration for quantum service and agents
9function quantum_setup_keystone() {
10 local conf_file=$1
11 local section=$2
12 local use_auth_url=$3
13 if [[ -n $use_auth_url ]]; then
14 iniset $conf_file $section auth_url "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_AUTH_HOST:$KEYSTONE_AUTH_PORT/v2.0"
15 else
16 iniset $conf_file $section auth_host $KEYSTONE_SERVICE_HOST
17 iniset $conf_file $section auth_port $KEYSTONE_AUTH_PORT
18 iniset $conf_file $section auth_protocol $KEYSTONE_SERVICE_PROTOCOL
19 fi
20 iniset $conf_file $section admin_tenant_name $SERVICE_TENANT_NAME
21 iniset $conf_file $section admin_user $Q_ADMIN_USERNAME
22 iniset $conf_file $section admin_password $SERVICE_PASSWORD
23}
24
25function quantum_setup_ovs_bridge() {
26 local bridge=$1
27 for PORT in `sudo ovs-vsctl --no-wait list-ports $bridge`; do
28 if [[ "$PORT" =~ tap* ]]; then echo `sudo ip link delete $PORT` > /dev/null; fi
29 sudo ovs-vsctl --no-wait del-port $bridge $PORT
30 done
31 sudo ovs-vsctl --no-wait -- --if-exists del-br $bridge
32 sudo ovs-vsctl --no-wait add-br $bridge
33 sudo ovs-vsctl --no-wait br-set-external-id $bridge bridge-id $bridge
34}
35
Yoshihiro Kaneko602cf9b2012-07-23 06:27:36 +000036function quantum_setup_external_bridge() {
37 local bridge=$1
38 # Create it if it does not exist
39 sudo ovs-vsctl --no-wait -- --may-exist add-br $bridge
40 # remove internal ports
41 for PORT in `sudo ovs-vsctl --no-wait list-ports $bridge`; do
42 TYPE=$(sudo ovs-vsctl get interface $PORT type)
43 if [[ "$TYPE" == "internal" ]]; then
44 echo `sudo ip link delete $PORT` > /dev/null
45 sudo ovs-vsctl --no-wait del-port $bridge $PORT
46 fi
47 done
48 # ensure no IP is configured on the public bridge
49 sudo ip addr flush dev $bridge
50}
51
52function is_quantum_ovs_base_plugin() {
53 local plguin=$1
54 if [[ ",openvswitch,ryu," =~ ,${plugin}, ]]; then
55 return 0
56 fi
57 return 1
58}
59
Salvatore Orlandod6767d02012-08-31 04:55:20 -070060# Restore xtrace
61$XTRACE