]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Added logic to configure the plugin type through debconf.
authorThomas Goirand <thomas@goirand.fr>
Wed, 31 Jul 2013 15:51:31 +0000 (23:51 +0800)
committerThomas Goirand <thomas@goirand.fr>
Wed, 31 Jul 2013 15:51:31 +0000 (23:51 +0800)
debian/neutron-common.config.in
debian/neutron-common.postinst.in
debian/neutron-common.postrm
debian/neutron-common.templates
debian/neutron-server.default [deleted file]
debian/neutron-server.init
debian/neutron.mydefault [new file with mode: 0644]
debian/rules

index 993a71f17019f20a5ee63649cd56f637835a57a8..7402d89bcf6fd390aabf0eb7d28706f2b29f1f59 100644 (file)
@@ -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
index f33ae38046657909a7f95127cde62b2688085b8f..52f797e9f491519c030ec40a21e8fddf342cb4ce 100644 (file)
@@ -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
index 4c1d429ecba5419bccb4e1683120beb5d50f0da4..faec9fd74b101b073b64818295407a8321d527f4 100644 (file)
@@ -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
index 33534f65dbdb6d9587a27e5c413ba804fbe71b07..f08484417e275728b385ef8113d925ec4ae1f62a 100644 (file)
@@ -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/debian/neutron-server.default b/debian/neutron-server.default
deleted file mode 100644 (file)
index fa5030b..0000000
+++ /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"
index 23b7cb273a437db9eec5d2c721640defa3302297..516252b820887369c5e3678738040bfc482dd9f6 100644 (file)
@@ -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/debian/neutron.mydefault b/debian/neutron.mydefault
new file mode 100644 (file)
index 0000000..6b78bb7
--- /dev/null
@@ -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
index 29686f0399eac60264866dc3db1524ff84b95a54..fcff59196a614496d36ba505cda669305f85f956 100755 (executable)
@@ -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