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