blob: d274723fc1ae3cd9e9b868045a6fde68f56d9380 [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]}
Dan Wendlandt555ecd02013-02-23 23:07:07 -080017 else
Nachi Ueno07115eb2013-02-26 12:38:18 -080018 die $LINENO "Error - No controller specified. Unable to set a manager for OVS"
Dan Wendlandt555ecd02013-02-23 23:07:07 -080019 fi
20 sudo ovs-vsctl set-manager ssl:$OVS_MGR_IP
21}
22
23function is_quantum_ovs_base_plugin() {
24 # NVP uses OVS, but not the l3-agent
25 return 0
26}
27
28function quantum_plugin_create_nova_conf() {
29 NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtOpenVswitchDriver"}
30 # if n-cpu is enabled, then setup integration bridge
31 if is_service_enabled n-cpu; then
32 setup_integration_bridge
33 fi
34}
35
36function quantum_plugin_install_agent_packages() {
armando-migliaccio174c7512013-06-11 14:09:08 -070037 # Nicira Plugin does not run q-agt, but it currently needs dhcp and metadata agents
38 _quantum_ovs_base_install_agent_packages
Dan Wendlandt555ecd02013-02-23 23:07:07 -080039}
40
41function quantum_plugin_configure_common() {
42 Q_PLUGIN_CONF_PATH=etc/quantum/plugins/nicira
43 Q_PLUGIN_CONF_FILENAME=nvp.ini
44 Q_DB_NAME="quantum_nvp"
45 Q_PLUGIN_CLASS="quantum.plugins.nicira.nicira_nvp_plugin.QuantumPlugin.NvpPluginV2"
46}
47
48function quantum_plugin_configure_debug_command() {
49 :
50}
51
52function quantum_plugin_configure_dhcp_agent() {
53 setup_integration_bridge
54 iniset $Q_DHCP_CONF_FILE DEFAULT enable_isolated_metadata True
55 iniset $Q_DHCP_CONF_FILE DEFAULT enable_metadata_network True
56 iniset $Q_DHCP_CONF_FILE DEFAULT ovs_use_veth True
57}
58
59function quantum_plugin_configure_l3_agent() {
60 # Nicira plugin does not run L3 agent
Nachi Ueno07115eb2013-02-26 12:38:18 -080061 die $LINENO "q-l3 should must not be executed with Nicira plugin!"
Dan Wendlandt555ecd02013-02-23 23:07:07 -080062}
63
64function quantum_plugin_configure_plugin_agent() {
65 # Nicira plugin does not run L2 agent
Nachi Ueno07115eb2013-02-26 12:38:18 -080066 die $LINENO "q-agt must not be executed with Nicira plugin!"
Dan Wendlandt555ecd02013-02-23 23:07:07 -080067}
68
69function quantum_plugin_configure_service() {
70 if [[ "$MAX_LP_PER_BRIDGED_LS" != "" ]]; then
71 iniset /$Q_PLUGIN_CONF_FILE NVP max_lp_per_bridged_ls $MAX_LP_PER_BRIDGED_LS
72 fi
73 if [[ "$MAX_LP_PER_OVERLAY_LS" != "" ]]; then
74 iniset /$Q_PLUGIN_CONF_FILE NVP max_lp_per_overlay_ls $MAX_LP_PER_OVERLAY_LS
75 fi
76 if [[ "$FAILOVER_TIME" != "" ]]; then
77 iniset /$Q_PLUGIN_CONF_FILE NVP failover_time $FAILOVER_TIME
78 fi
79 if [[ "$CONCURRENT_CONNECTIONS" != "" ]]; then
80 iniset /$Q_PLUGIN_CONF_FILE NVP concurrent_connections $CONCURRENT_CONNECTIONS
81 fi
82
armando-migliaccioa25fa9d2013-04-15 13:46:35 -070083 if [[ "$DEFAULT_TZ_UUID" != "" ]]; then
84 iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_tz_uuid $DEFAULT_TZ_UUID
Dan Wendlandt555ecd02013-02-23 23:07:07 -080085 else
armando-migliaccioa25fa9d2013-04-15 13:46:35 -070086 die $LINENO "The nicira plugin won't work without a default transport zone."
87 fi
88 if [[ "$DEFAULT_L3_GW_SVC_UUID" != "" ]]; then
89 iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_l3_gw_service_uuid $DEFAULT_L3_GW_SVC_UUID
90 Q_L3_ENABLED=True
91 Q_L3_ROUTER_PER_TENANT=True
92 iniset /$Q_PLUGIN_CONF_FILE NVP enable_metadata_access_network True
93 fi
94 if [[ "$DEFAULT_L2_GW_SVC_UUID" != "" ]]; then
95 iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_l2_gw_service_uuid $DEFAULT_L2_GW_SVC_UUID
96 fi
97 # NVP_CONTROLLERS must be a comma separated string
98 if [[ "$NVP_CONTROLLERS" != "" ]]; then
99 iniset /$Q_PLUGIN_CONF_FILE DEFAULT nvp_controllers $NVP_CONTROLLERS
100 else
101 die $LINENO "The nicira plugin needs at least an NVP controller."
102 fi
103 if [[ "$NVP_USER" != "" ]]; then
104 iniset /$Q_PLUGIN_CONF_FILE DEFAULT nvp_user $NVP_USER
105 fi
106 if [[ "$NVP_PASSWORD" != "" ]]; then
107 iniset /$Q_PLUGIN_CONF_FILE DEFAULT nvp_password $NVP_PASSWORD
108 fi
109 if [[ "$NVP_REQ_TIMEOUT" != "" ]]; then
110 iniset /$Q_PLUGIN_CONF_FILE DEFAULT req_timeout $NVP_REQ_TIMEOUT
111 fi
112 if [[ "$NVP_HTTP_TIMEOUT" != "" ]]; then
113 iniset /$Q_PLUGIN_CONF_FILE DEFAULT http_timeout $NVP_HTTP_TIMEOUT
114 fi
115 if [[ "$NVP_RETRIES" != "" ]]; then
116 iniset /$Q_PLUGIN_CONF_FILE DEFAULT retries $NVP_RETRIES
117 fi
118 if [[ "$NVP_REDIRECTS" != "" ]]; then
119 iniset /$Q_PLUGIN_CONF_FILE DEFAULT redirects $NVP_REDIRECTS
Dan Wendlandt555ecd02013-02-23 23:07:07 -0800120 fi
121}
122
123function quantum_plugin_setup_interface_driver() {
124 local conf_file=$1
125 iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver
126}
127
Akihiro MOTOKI3452f8e2013-03-21 14:11:27 +0900128function has_quantum_plugin_security_group() {
129 # 0 means True here
130 return 0
131}
132
armando-migliaccio7c025fe2013-05-08 11:33:07 -0700133function quantum_plugin_check_adv_test_requirements() {
134 is_service_enabled q-dhcp && return 0
135}
136
Dan Wendlandt555ecd02013-02-23 23:07:07 -0800137# Restore xtrace
138$MY_XTRACE