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