From 27a196e26064aba615b0177435071d569b82389b Mon Sep 17 00:00:00 2001 From: Tan Lin Date: Fri, 31 Oct 2014 15:44:34 +0800 Subject: [PATCH] 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 --- lib/neutron | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/neutron b/lib/neutron index 98636b4b41..573fd6fbb0 100644 --- a/lib/neutron +++ b/lib/neutron @@ -229,6 +229,14 @@ TUNNEL_ENDPOINT_IP=${TUNNEL_ENDPOINT_IP:-$HOST_IP} # Example: ``OVS_ENABLE_TUNNELING=True`` OVS_ENABLE_TUNNELING=${OVS_ENABLE_TUNNELING:-$ENABLE_TENANT_TUNNELS} +# Use DHCP agent for providing metadata service in the case of +# without L3 agent (No Route Agent), set to True in localrc. +ENABLE_ISOLATED_METADATA=${ENABLE_ISOLATED_METADATA:-False} + +# Add a static route as dhcp option, so the request to 169.254.169.254 +# will be able to reach through a route(DHCP agent) +# This option require ENABLE_ISOLATED_METADATA = True +ENABLE_METADATA_NETWORK=${ENABLE_METADATA_NETWORK:-False} # Neutron plugin specific functions # --------------------------------- @@ -687,6 +695,17 @@ function _configure_neutron_dhcp_agent { iniset $Q_DHCP_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE iniset $Q_DHCP_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND" + if ! is_service_enabled q-l3; then + if [[ "$ENABLE_ISOLATED_METADATA" = "True" ]]; then + iniset $Q_DHCP_CONF_FILE DEFAULT enable_isolated_metadata $ENABLE_ISOLATED_METADATA + iniset $Q_DHCP_CONF_FILE DEFAULT enable_metadata_network $ENABLE_METADATA_NETWORK + else + if [[ "$ENABLE_METADATA_NETWORK" = "True" ]]; then + die "$LINENO" "Enable isolated metadata is a must for metadata network" + fi + fi + fi + _neutron_setup_interface_driver $Q_DHCP_CONF_FILE neutron_plugin_configure_dhcp_agent