blob: bc9a36f2992f1445ecee4057549c5e711a347e69 [file] [log] [blame]
Dan Wendlandt555ecd02013-02-23 23:07:07 -08001# Quantum Nicira NVP plugin
2# ---------------------------
3
4# Save trace setting
5MY_XTRACE=$(set +o | grep xtrace)
6set +o xtrace
7
8source $TOP_DIR/lib/quantum_plugins/ovs_base
9
10function setup_integration_bridge() {
11 OVS_BRIDGE=${OVS_BRIDGE:-br-int}
12 _quantum_ovs_base_setup_bridge $OVS_BRIDGE
13 # Set manager to NVP controller (1st of list)
14 if [[ "$NVP_CONTROLLERS" != "" ]]; then
15 # Get the first controller
16 controllers=(${NVP_CONTROLLERS//,/ })
17 OVS_MGR_IP=${controllers[0]}
18 elif [[ "$NVP_CONTROLLER_CONNECTION" != "" ]]; then
19 conn=(${NVP_CONTROLLER_CONNECTION//\:/ })
20 OVS_MGR_IP=${conn[0]}
21 else
22 echo "Error - No controller specified. Unable to set a manager for OVS"
23 exit 1
24 fi
25 sudo ovs-vsctl set-manager ssl:$OVS_MGR_IP
26}
27
28function is_quantum_ovs_base_plugin() {
29 # NVP uses OVS, but not the l3-agent
30 return 0
31}
32
33function quantum_plugin_create_nova_conf() {
34 NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtOpenVswitchDriver"}
35 # if n-cpu is enabled, then setup integration bridge
36 if is_service_enabled n-cpu; then
37 setup_integration_bridge
38 fi
39}
40
41function quantum_plugin_install_agent_packages() {
42 # Nicira Plugin does not run q-agt
43 :
44}
45
46function quantum_plugin_configure_common() {
47 Q_PLUGIN_CONF_PATH=etc/quantum/plugins/nicira
48 Q_PLUGIN_CONF_FILENAME=nvp.ini
49 Q_DB_NAME="quantum_nvp"
50 Q_PLUGIN_CLASS="quantum.plugins.nicira.nicira_nvp_plugin.QuantumPlugin.NvpPluginV2"
51}
52
53function quantum_plugin_configure_debug_command() {
54 :
55}
56
57function quantum_plugin_configure_dhcp_agent() {
58 setup_integration_bridge
59 iniset $Q_DHCP_CONF_FILE DEFAULT enable_isolated_metadata True
60 iniset $Q_DHCP_CONF_FILE DEFAULT enable_metadata_network True
61 iniset $Q_DHCP_CONF_FILE DEFAULT ovs_use_veth True
62}
63
64function quantum_plugin_configure_l3_agent() {
65 # Nicira plugin does not run L3 agent
66 echo "ERROR - q-l3 should must not be executed with Nicira plugin!"
67 exit 1
68}
69
70function quantum_plugin_configure_plugin_agent() {
71 # Nicira plugin does not run L2 agent
72 echo "ERROR - q-agt must not be executed with Nicira plugin!"
73 exit 1
74}
75
76function quantum_plugin_configure_service() {
77 if [[ "$MAX_LP_PER_BRIDGED_LS" != "" ]]; then
78 iniset /$Q_PLUGIN_CONF_FILE NVP max_lp_per_bridged_ls $MAX_LP_PER_BRIDGED_LS
79 fi
80 if [[ "$MAX_LP_PER_OVERLAY_LS" != "" ]]; then
81 iniset /$Q_PLUGIN_CONF_FILE NVP max_lp_per_overlay_ls $MAX_LP_PER_OVERLAY_LS
82 fi
83 if [[ "$FAILOVER_TIME" != "" ]]; then
84 iniset /$Q_PLUGIN_CONF_FILE NVP failover_time $FAILOVER_TIME
85 fi
86 if [[ "$CONCURRENT_CONNECTIONS" != "" ]]; then
87 iniset /$Q_PLUGIN_CONF_FILE NVP concurrent_connections $CONCURRENT_CONNECTIONS
88 fi
89
90 if [[ "$DEFAULT_CLUSTER" != "" ]]; then
91 # Make name shorter for sake of readability
92 DC=$DEFAULT_CLUSTER
93 if [[ "$DEFAULT_TZ_UUID" != "" ]]; then
94 iniset /$Q_PLUGIN_CONF_FILE "CLUSTER:$DC" default_tz_uuid $DEFAULT_TZ_UUID
95 else
96 echo "ERROR - The nicira plugin won't work without a default transport zone."
97 exit 1
98 fi
99 if [[ "$DEFAULT_L3_GW_SVC_UUID" != "" ]]; then
100 iniset /$Q_PLUGIN_CONF_FILE "CLUSTER:$DC" default_l3_gw_service_uuid $DEFAULT_L3_GW_SVC_UUID
101 Q_L3_ENABLED=True
102 Q_L3_ROUTER_PER_TENANT=True
103 iniset /$Q_PLUGIN_CONF_FILE NVP enable_metadata_access_network True
104 else
105 echo "WARNING - No l3 gw service enabled. You will not be able to use the L3 API extension"
106 fi
107 if [[ "$DEFAULT_L2_GW_SVC_UUID" != "" ]]; then
108 iniset /$Q_PLUGIN_CONF_FILE "CLUSTER:$DC" default_l2_gw_service_uuid $DEFAULT_L2_GW_SVC_UUID
109 fi
110 # NVP_CONTROLLERS must be a comma separated string
111 if [[ "$NVP_CONTROLLERS" != "" ]]; then
112 iniset /$Q_PLUGIN_CONF_FILE "CLUSTER:$DC" nvp_controllers $NVP_CONTROLLERS
113 elif [[ "$NVP_CONTROLLER_CONNECTION" != "" ]]; then
114 # Only 1 controller can be specified in this case
115 iniset /$Q_PLUGIN_CONF_FILE "CLUSTER:$DC" nvp_controller_connection $NVP_CONTROLLER_CONNECTION
116 else
117 echo "ERROR - The nicira plugin needs at least an NVP controller."
118 exit 1
119 fi
120 if [[ "$NVP_USER" != "" ]]; then
121 iniset /$Q_PLUGIN_CONF_FILE "CLUSTER:$DC" nvp_user $NVP_USER
122 fi
123 if [[ "$NVP_PASSWORD" != "" ]]; then
124 iniset /$Q_PLUGIN_CONF_FILE "CLUSTER:$DC" nvp_password $NVP_PASSWORD
125 fi
126 if [[ "$NVP_REQ_TIMEOUT" != "" ]]; then
127 iniset /$Q_PLUGIN_CONF_FILE "CLUSTER:$DC" req_timeout $NVP_REQ_TIMEOUT
128 fi
129 if [[ "$NVP_HTTP_TIMEOUT" != "" ]]; then
130 iniset /$Q_PLUGIN_CONF_FILE "CLUSTER:$DC" http_timeout $NVP_HTTP_TIMEOUT
131 fi
132 if [[ "$NVP_RETRIES" != "" ]]; then
133 iniset /$Q_PLUGIN_CONF_FILE "CLUSTER:$DC" retries $NVP_RETRIES
134 fi
135 if [[ "$NVP_REDIRECTS" != "" ]]; then
136 iniset /$Q_PLUGIN_CONF_FILE "CLUSTER:$DC" redirects $NVP_REDIRECTS
137 fi
138 else
139 echo "ERROR - Default cluster not configured. Quantum will not start"
140 exit 1
141 fi
142}
143
144function quantum_plugin_setup_interface_driver() {
145 local conf_file=$1
146 iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver
147}
148
149# Restore xtrace
150$MY_XTRACE