From 3d6e97ba836b6e15e4146ad0482c5ac276daffd0 Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Wed, 31 Jul 2013 23:51:31 +0800 Subject: [PATCH] Added logic to configure the plugin type through debconf. Rewritten-From: 4c85442fbed93bc49913e57954ff1dbc42d93503 --- trusty/debian/neutron-common.config.in | 2 ++ trusty/debian/neutron-common.postinst.in | 8 ++++++ trusty/debian/neutron-common.postrm | 1 + trusty/debian/neutron-common.templates | 11 ++++++++ trusty/debian/neutron-server.default | 9 ------- trusty/debian/neutron-server.init | 7 ++--- trusty/debian/neutron.mydefault | 33 ++++++++++++++++++++++++ trusty/debian/rules | 3 +++ 8 files changed, 62 insertions(+), 12 deletions(-) delete mode 100644 trusty/debian/neutron-server.default create mode 100644 trusty/debian/neutron.mydefault diff --git a/trusty/debian/neutron-common.config.in b/trusty/debian/neutron-common.config.in index 993a71f17..7402d89bc 100644 --- a/trusty/debian/neutron-common.config.in +++ b/trusty/debian/neutron-common.config.in @@ -12,4 +12,6 @@ pkgos_var_user_group neutron chmod 755 /var/lib/neutron pkgos_read_admin_creds ${N_CONF} keystone_authtoken neutron +pkgos_read_config -p high /etc/default/neutron-server NO_SECTION NEUTRON_plugin_path neutron/plugin-select + exit 0 diff --git a/trusty/debian/neutron-common.postinst.in b/trusty/debian/neutron-common.postinst.in index f33ae3804..52f797e9f 100644 --- a/trusty/debian/neutron-common.postinst.in +++ b/trusty/debian/neutron-common.postinst.in @@ -11,6 +11,14 @@ if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then pkgos_var_user_group neutron chmod 755 /var/lib/neutron + + if [ ! -e /etc/default/neutron ] ; then + install -D -m 0664 /usr/share/neutron-common/neutron-default /etc/default/neutron + fi + db_get neutron/plugin-select + if [ -n "${RET}" ] ; then + pkgos_inifile -shinc set /etc/default/neutron NO_SECTION NEUTRON_plugin_path ${RET} + fi pkgos_write_new_conf neutron api-paste.ini pkgos_write_new_conf neutron neutron.conf pkgos_write_admin_creds ${N_CONF} keystone_authtoken neutron diff --git a/trusty/debian/neutron-common.postrm b/trusty/debian/neutron-common.postrm index 4c1d429ec..faec9fd74 100644 --- a/trusty/debian/neutron-common.postrm +++ b/trusty/debian/neutron-common.postrm @@ -3,6 +3,7 @@ set -e if [ "${1}" = "purge" ] ; then + rm -rf /etc/default/neutron rm -rf /etc/neutron/api-paste.ini /etc/neutron/neutron.conf [ -d /etc/neutron ] && rmdir --ignore-fail-on-non-empty /etc/neutron rm -rf /var/lib/neutron diff --git a/trusty/debian/neutron-common.templates b/trusty/debian/neutron-common.templates index 33534f65d..f08484417 100644 --- a/trusty/debian/neutron-common.templates +++ b/trusty/debian/neutron-common.templates @@ -30,3 +30,14 @@ Template: neutron/admin-password Type: password _Description: Authentication server password: Please specify the password to use with the authentication server. + +Template: neutron/plugin-select +Type: select +__Choices: brocade/brocade.ini, nicira/nvp.ini, openvswitch/ovs_neutron_plugin.ini, midonet/midonet.ini, nec/nec.ini, mlnx/mlnx_conf.ini, hyperv/hyperv_neutron_plugin.ini, ryu/ryu.ini, ml2/ml2_conf.ini, metaplugin/metaplugin.ini, bigswitch/restproxy.ini, linuxbridge/linuxbridge_conf.ini, cisco/cisco_plugins.ini, plumgrid/plumgrid.ini +Choices-C: brocade/brocade.ini, nicira/nvp.ini, openvswitch/ovs_neutron_plugin.ini, midonet/midonet.ini, nec/nec.ini, mlnx/mlnx_conf.ini, hyperv/hyperv_neutron_plugin.ini, ryu/ryu.ini, ml2/ml2_conf.ini, metaplugin/metaplugin.ini, bigswitch/restproxy.ini, linuxbridge/linuxbridge_conf.ini, cisco/cisco_plugins.ini, plumgrid/plumgrid.ini +Default: openvswitch/ovs_neutron_plugin.ini +_Description: Plugin configuration to load: + Neutron uses a plugin architecture to manage networking. When starting the + Neutron server daemon, the configuration file corresponding to the plugin you + wish to use needs to be loaded. Please select which plugin configuration file + should be given as parameter when starting the Neutron server daemon. diff --git a/trusty/debian/neutron-server.default b/trusty/debian/neutron-server.default deleted file mode 100644 index fa5030be0..000000000 --- a/trusty/debian/neutron-server.default +++ /dev/null @@ -1,9 +0,0 @@ -# You should choose one of this configuration file accord the installed backend - -# NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/nicira/nvp.ini" -# NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini" -# NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/nec/nec.ini" -# NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/ryu/ryu.ini" -# NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini" - -NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini" diff --git a/trusty/debian/neutron-server.init b/trusty/debian/neutron-server.init index 23b7cb273..516252b82 100644 --- a/trusty/debian/neutron-server.init +++ b/trusty/debian/neutron-server.init @@ -26,9 +26,10 @@ DAEMON_ARGS="--config-file=/etc/neutron/neutron.conf --log-file=$LOGFILE" . /lib/lsb/init-functions -if [ -r /etc/default/neutron-server ] ; then - . /etc/default/neutron-server - if [ -n "${NEUTRON_PLUGIN_CONFIG}" ] ; then +if [ -r /etc/default/neutron ] ; then + . /etc/default/neutron + if [ -n "${NEUTRON_plugin_path}" ] ; then + NEUTRON_PLUGIN_CONFIG=/etc/neutron/plugins/${NEUTRON_plugin_path} DAEMON_ARGS="${DAEMON_ARGS} --config-file=${NEUTRON_PLUGIN_CONFIG}" fi fi diff --git a/trusty/debian/neutron.mydefault b/trusty/debian/neutron.mydefault new file mode 100644 index 000000000..6b78bb7e6 --- /dev/null +++ b/trusty/debian/neutron.mydefault @@ -0,0 +1,33 @@ +# Default configuration file for Neutron. Currently only there to be able to +# select which plugin to use, and configure neutron-server accordingly. You +# can edit the file if you don't break its (shell script) syntax, or use: +# dpkg-reconfigure -plow neutron-server + +# Select the path to the configuration file for the plugin which you wish to +# use with Neutron. The path is what's after /etc/neutron/plugins. For example, +# for using /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini in the +# command line of the neutron-server, you should only set: +# openvswitch/ovs_neutron_plugin.ini +# +# Possible values are (currently): +# +# brocade/brocade.ini +# nicira/nvp.ini +# openvswitch/ovs_neutron_plugin.ini +# midonet/midonet.ini +# nec/nec.ini +# mlnx/mlnx_conf.ini +# hyperv/hyperv_neutron_plugin.ini +# ryu/ryu.ini +# ml2/ml2_conf.ini +# metaplugin/metaplugin.ini +# bigswitch/restproxy.ini +# linuxbridge/linuxbridge_conf.ini +# cisco/cisco_plugins.ini +# plumgrid/plumgrid.ini +# +# If more plugins were to come, then simply editing this file is not enough, +# the debconf template will need to be edited to add the new value, otherwise +# this will break on upgrades. + +NEUTRON_plugin_path=openvswitch/ovs_neutron_plugin.ini diff --git a/trusty/debian/rules b/trusty/debian/rules index 29686f039..fcff59196 100755 --- a/trusty/debian/rules +++ b/trusty/debian/rules @@ -29,6 +29,9 @@ override_dh_install: install -D -m 0640 etc/metadata_agent.ini $(CURDIR)/debian/neutron-metadata-agent/usr/share/neutron-metadata-agent/metadata_agent.ini sed -i -e 's|^# nova_metadata_ip = 127.0.0.1|nova_metadata_ip = 127.0.0.1|' $(CURDIR)/debian/neutron-metadata-agent/usr/share/neutron-metadata-agent/metadata_agent.ini + # Install the default file + install -D -m 0640 debian/neutron.mydefault $(CURDIR)/debian/neutron-common/usr/share/neutron-common/neutron-default + override_dh_auto_clean: dh_auto_clean rm -f neutron/vcsversion.py -- 2.45.2