diff --git a/devstack/README.md b/devstack/README.md index ae4cb5da9..d9159a00f 100644 --- a/devstack/README.md +++ b/devstack/README.md @@ -1,26 +1,3 @@ -This directory contains the neutron-vpnaas devstack plugin. To -configure VPNaaS, in the [[local|localrc]] section, you will need -to enable the neutron-vpnaas devstack plugin. +This directory contains the neutron-vpnaas devstack plugin. Please +see the devref for how to set up VPNaaS with devstack. -Add a line of the form: - - enable_plugin neutron-vpnaas [GITREF] - -where - - is the URL of a neutron-vpnaas repository - [GITREF] is an optional git ref (branch/ref/tag). The default is - master. - -For example - - enable_plugin neutron-vpnaas https://git.openstack.org/openstack/neutron-vpnaas stable/kilo - -Note: Since the VPN agent process, is a subclass of the L3 agent, -which is a subclass of the FW agent, the DevStack plugin will -check for the FW service being enabled, and if so, will include -the config file specified in Q_FWAAS_CONF_FILE (default is -fwaas_driver.ini). - -For more information, see the "Externally Hosted Plugins" section of -http://docs.openstack.org/developer/devstack/plugins.html. diff --git a/devstack/plugin.sh b/devstack/plugin.sh index c4ee08e22..42f0edea3 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -5,7 +5,9 @@ set -o xtrace function neutron_vpnaas_install { setup_develop $NEUTRON_VPNAAS_DIR - neutron_agent_vpnaas_install_agent_packages + if is_service_enabled q-l3; then + neutron_agent_vpnaas_install_agent_packages + fi } function neutron_agent_vpnaas_install_agent_packages { @@ -26,7 +28,10 @@ function neutron_vpnaas_configure_common { inicomment $NEUTRON_VPNAAS_CONF service_providers service_provider iniadd $NEUTRON_VPNAAS_CONF service_providers service_provider $NEUTRON_VPNAAS_SERVICE_PROVIDER iniset $NEUTRON_CONF DEFAULT service_plugins $Q_SERVICE_PLUGIN_CLASSES - $NEUTRON_BIN_DIR/neutron-db-manage --service vpnaas --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head +} + +function neutron_vpnaas_configure_db { + $NEUTRON_BIN_DIR/neutron-db-manage --subproject neutron-vpnaas --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head } function neutron_vpnaas_configure_agent { @@ -83,17 +88,27 @@ if [[ "$1" == "stack" && "$2" == "install" ]]; then neutron_vpnaas_install elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then - echo_summary "Configuring neutron-vpnaas" neutron_vpnaas_generate_config_files neutron_vpnaas_configure_common - neutron_vpnaas_configure_agent + if is_service_enabled q-svc; then + echo_summary "Configuring neutron-vpnaas on controller" + neutron_vpnaas_configure_db + fi + if is_service_enabled q-l3; then + echo_summary "Configuring neutron-vpnaas agent" + neutron_vpnaas_configure_agent + fi elif [[ "$1" == "stack" && "$2" == "extra" ]]; then - echo_summary "Initializing neutron-vpnaas" - neutron_vpnaas_start + if is_service_enabled q-l3; then + echo_summary "Initializing neutron-vpnaas" + neutron_vpnaas_start + fi elif [[ "$1" == "unstack" ]]; then - neutron_vpnaas_stop + if is_service_enabled q-l3; then + neutron_vpnaas_stop + fi # NOP for clean step diff --git a/doc/source/devref/devstack.rst b/doc/source/devref/devstack.rst new file mode 100644 index 000000000..bbef21678 --- /dev/null +++ b/doc/source/devref/devstack.rst @@ -0,0 +1,46 @@ +=============================== +Configuring VPNaaS for DevStack +=============================== + +----------------------- +Multinode vs All-In-One +----------------------- + +Devstack typically runs in single or "All-In-One" (AIO) mode. However, it +can also be deployed to run on multiple nodes. For VPNaaS, running on an +AIO setup is simple, as everything happens on the same node. However, to +deploy to a multinode setup requires the following things to happen: + +#. Each controller node requires database migrations in support of running + VPNaaS. +#. Each network node that would run the L3 agent needs to run the Neutron + VPNaaS agent in its place. + +Therefore, the devstack plugin script needs some extra logic. + +---------------- +How to Configure +---------------- + +To configure VPNaaS, it is only necessary to enable the neutron-vpnaas +devstack plugin by adding the following line to the [[local|localrc]] +section of devstack's local.conf file:: + + enable_plugin neutron-vpnaas [BRANCH] + + is the URL of a neutron-vpnaas repository + [BRANCH] is an optional git ref (branch/ref/tag). The default is master. + + For example:: + + enable_plugin neutron-vpnaas https://git.openstack.org/openstack/neutron-vpnaas stable/kilo + +This VPNaaS devstack plugin code will then + +#. Install the common VPNaaS configuration and code, + +#. Apply database migrations on nodes that are running the controller (as + determined by enabling the q-svc service), + +#. Run the VPNaaS agent on nodes that would normally be running the L3 agent + (as determined by enabling the q-l3 service). diff --git a/doc/source/devref/index.rst b/doc/source/devref/index.rst index f33b795d8..e0fe61079 100644 --- a/doc/source/devref/index.rst +++ b/doc/source/devref/index.rst @@ -42,12 +42,13 @@ VPNaaS Internals multiple-local-subnets - Testing ------- .. toctree:: :maxdepth: 3 + devstack + .. todo:: Add notes about functional testing, with info on how