adding Quantum metadata service support

Change-Id: I8985c169401eee7a435b99293bdf6d42f28ab66c
diff --git a/stack.sh b/stack.sh
index dbb53ec..6d8e1f6 100755
--- a/stack.sh
+++ b/stack.sh
@@ -1331,9 +1331,10 @@
     # Set debug
     iniset $Q_L3_CONF_FILE DEFAULT debug True
 
-    iniset $Q_L3_CONF_FILE DEFAULT metadata_ip $Q_META_DATA_IP
     iniset $Q_L3_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
 
+    iniset $Q_L3_CONF_FILE DEFAULT state_path $DATA_DIR/quantum
+
     iniset $Q_L3_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
 
     quantum_setup_keystone $Q_L3_CONF_FILE DEFAULT set_auth_url
@@ -1354,6 +1355,27 @@
     fi
 fi
 
+#Quantum Metadata
+if is_service_enabled q-meta; then
+    AGENT_META_BINARY="$QUANTUM_DIR/bin/quantum-metadata-agent"
+    Q_META_CONF_FILE=/etc/quantum/metadata_agent.ini
+
+    cp $QUANTUM_DIR/etc/metadata_agent.ini $Q_META_CONF_FILE
+
+    # Set verbose
+    iniset $Q_META_CONF_FILE DEFAULT verbose True
+    # Set debug
+    iniset $Q_META_CONF_FILE DEFAULT debug True
+
+    iniset $Q_META_CONF_FILE DEFAULT state_path $DATA_DIR/quantum
+
+    iniset $Q_META_CONF_FILE DEFAULT nova_metadata_ip $Q_META_DATA_IP
+
+    iniset $Q_META_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
+
+    quantum_setup_keystone $Q_META_CONF_FILE DEFAULT set_auth_url
+fi
+
 # Quantum RPC support - must be updated prior to starting any of the services
 if is_service_enabled quantum; then
     iniset $Q_CONF_FILE DEFAULT control_exchange quantum
@@ -1442,6 +1464,9 @@
         fi
         add_nova_opt "libvirt_vif_driver=$NOVA_VIF_DRIVER"
         add_nova_opt "linuxnet_interface_driver=$LINUXNET_VIF_DRIVER"
+        if is_service_enabled q-meta; then
+            add_nova_opt "service_quantum_metadata_proxy=True"
+        fi
     elif is_service_enabled n-net; then
         add_nova_opt "network_manager=nova.network.manager.$NET_MAN"
         add_nova_opt "public_interface=$PUBLIC_INTERFACE"
@@ -1611,6 +1636,7 @@
 # Start up the quantum agents if enabled
 screen_it q-agt "python $AGENT_BINARY --config-file $Q_CONF_FILE --config-file /$Q_PLUGIN_CONF_FILE"
 screen_it q-dhcp "python $AGENT_DHCP_BINARY --config-file $Q_CONF_FILE --config-file=$Q_DHCP_CONF_FILE"
+screen_it q-meta "python $AGENT_META_BINARY --config-file $Q_CONF_FILE --config-file=$Q_META_CONF_FILE"
 screen_it q-l3 "python $AGENT_L3_BINARY --config-file $Q_CONF_FILE --config-file=$Q_L3_CONF_FILE"
 
 if is_service_enabled nova; then