Browse code

Add options to enable using DHCP agent Metadata-proxy

Add options to support DHCP agent providing metadata-proxy.
In some cases, users have to disable L3 Agent. But people still
need metadata services.

Change-Id: I4664fc3a4937c3b7b5c27e74f509b683ffbedd09

Tan Lin authored on 2014/10/31 16:44:34
Showing 1 changed files
... ...
@@ -229,6 +229,14 @@ TUNNEL_ENDPOINT_IP=${TUNNEL_ENDPOINT_IP:-$HOST_IP}
229 229
 # Example: ``OVS_ENABLE_TUNNELING=True``
230 230
 OVS_ENABLE_TUNNELING=${OVS_ENABLE_TUNNELING:-$ENABLE_TENANT_TUNNELS}
231 231
 
232
+# Use DHCP agent for providing metadata service in the case of
233
+# without L3 agent (No Route Agent), set to True in localrc.
234
+ENABLE_ISOLATED_METADATA=${ENABLE_ISOLATED_METADATA:-False}
235
+
236
+# Add a static route as dhcp option, so the request to 169.254.169.254
237
+# will be able to reach through a route(DHCP agent)
238
+# This option require ENABLE_ISOLATED_METADATA = True
239
+ENABLE_METADATA_NETWORK=${ENABLE_METADATA_NETWORK:-False}
232 240
 # Neutron plugin specific functions
233 241
 # ---------------------------------
234 242
 
... ...
@@ -687,6 +695,17 @@ function _configure_neutron_dhcp_agent {
687 687
     iniset $Q_DHCP_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
688 688
     iniset $Q_DHCP_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
689 689
 
690
+    if ! is_service_enabled q-l3; then
691
+        if [[ "$ENABLE_ISOLATED_METADATA" = "True" ]]; then
692
+            iniset $Q_DHCP_CONF_FILE DEFAULT enable_isolated_metadata $ENABLE_ISOLATED_METADATA
693
+            iniset $Q_DHCP_CONF_FILE DEFAULT enable_metadata_network $ENABLE_METADATA_NETWORK
694
+        else
695
+            if [[ "$ENABLE_METADATA_NETWORK" = "True" ]]; then
696
+                die "$LINENO" "Enable isolated metadata is a must for metadata network"
697
+            fi
698
+        fi
699
+    fi
700
+
690 701
     _neutron_setup_interface_driver $Q_DHCP_CONF_FILE
691 702
 
692 703
     neutron_plugin_configure_dhcp_agent