From 584750f996bf0336d5c743634cbb0d2e02e78783 Mon Sep 17 00:00:00 2001
From: Nachi Ueno <nachi@ntti3.com>
Date: Mon, 15 Jul 2013 18:22:21 -0700
Subject: [PATCH] Update neutron-vpn-agent path

Fix path of vpn-agent as same as lbaas

- If q-vpn service is enabled, this patch switches the l3-agent to
vpn-agent

Change-Id: Ifbe3d51b5c89f759a71e904960c5f6cc99c44a5f
---
 lib/neutron                      | 8 ++++++--
 lib/neutron_plugins/services/vpn | 6 +-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/neutron b/lib/neutron
index e6f5911cbd..835f900425 100644
--- a/lib/neutron
+++ b/lib/neutron
@@ -415,7 +415,12 @@ function start_neutron_agents() {
     # Start up the neutron agents if enabled
     screen_it q-agt "cd $NEUTRON_DIR && python $AGENT_BINARY --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE"
     screen_it q-dhcp "cd $NEUTRON_DIR && python $AGENT_DHCP_BINARY --config-file $NEUTRON_CONF --config-file=$Q_DHCP_CONF_FILE"
-    screen_it q-l3 "cd $NEUTRON_DIR && python $AGENT_L3_BINARY --config-file $NEUTRON_CONF --config-file=$Q_L3_CONF_FILE"
+
+    if is_service_enabled q-vpn; then
+        screen_it q-vpn "cd $NEUTRON_DIR && $AGENT_VPN_BINARY --config-file $NEUTRON_CONF --config-file=$Q_L3_CONF_FILE"
+    else
+        screen_it q-l3 "cd $NEUTRON_DIR && python $AGENT_L3_BINARY --config-file $NEUTRON_CONF --config-file=$Q_L3_CONF_FILE"
+    fi
     screen_it q-meta "cd $NEUTRON_DIR && python $AGENT_META_BINARY --config-file $NEUTRON_CONF --config-file=$Q_META_CONF_FILE"
 
     if [ "$VIRT_DRIVER" = 'xenserver' ]; then
@@ -585,7 +590,6 @@ function _configure_neutron_vpn()
 {
     neutron_vpn_install_agent_packages
     neutron_vpn_configure_common
-    neutron_vpn_configure_agent
 }
 
 # _configure_neutron_plugin_agent() - Set config files for neutron plugin agent
diff --git a/lib/neutron_plugins/services/vpn b/lib/neutron_plugins/services/vpn
index 3c030c5f42..0a79a697ad 100644
--- a/lib/neutron_plugins/services/vpn
+++ b/lib/neutron_plugins/services/vpn
@@ -6,7 +6,7 @@ MY_XTRACE=$(set +o | grep xtrace)
 set +o xtrace
 
 
-VPN_BINARY="$NEUTRON_DIR/bin/neutron-vpn-agent"
+AGENT_VPN_BINARY="$NEUTRON_BIN_DIR/neutron-vpn-agent"
 VPN_PLUGIN="neutron.services.vpn.plugin.VPNDriverPlugin"
 
 function neutron_vpn_install_agent_packages() {
@@ -21,9 +21,5 @@ function neutron_vpn_configure_common() {
     fi
 }
 
-function neutron_vpn_configure_agent() {
-    AGENT_L3_BINARY="$NEUTRON_DIR/bin/neutron-vpn-agent"
-}
-
 # Restore xtrace
 $MY_XTRACE