]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Moves OVS configuration to neutron-common.
authorThomas Goirand <thomas@goirand.fr>
Wed, 31 Jul 2013 18:41:42 +0000 (02:41 +0800)
committerThomas Goirand <thomas@goirand.fr>
Wed, 31 Jul 2013 18:41:42 +0000 (02:41 +0800)
Rewritten-From: 9ba987aeaeb7f1d3179463374899255c615c1a75

xenial/debian/neutron-common.README.Debian [moved from xenial/debian/neutron-plugin-openvswitch.README.Debian with 100% similarity]
xenial/debian/neutron-common.config.in
xenial/debian/neutron-common.postinst.in
xenial/debian/neutron-common.postrm
xenial/debian/neutron-common.prerm [moved from xenial/debian/neutron-plugin-openvswitch.prerm with 63% similarity]
xenial/debian/neutron-common.templates
xenial/debian/neutron-plugin-openvswitch.config.in [deleted file]
xenial/debian/neutron-plugin-openvswitch.postinst.in [deleted file]
xenial/debian/neutron-plugin-openvswitch.postrm [deleted file]
xenial/debian/neutron-plugin-openvswitch.templates [deleted file]
xenial/debian/rules

index 7402d89bcf6fd390aabf0eb7d28706f2b29f1f59..afb0ae7aff4ebd04f3514ef3346fbb32e557b364 100644 (file)
@@ -5,13 +5,37 @@ set -e
 . /usr/share/debconf/confmodule
 
 N_CONF=/etc/neutron/neutron.conf
+OVS_CONF=/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
 
 #PKGOS-INCLUDE#
 
 pkgos_var_user_group neutron
 chmod 755 /var/lib/neutron
+
+# Configure the SQL connection
+pkgos_dbc_read_conf -pkg neutron-common ${OVS_CONF} DATABASE sql_connection neutron $@
+
+# Configure the keystone_authtoken
 pkgos_read_admin_creds ${N_CONF} keystone_authtoken neutron
 
+# Select which plugin to use
 pkgos_read_config -p high /etc/default/neutron-server NO_SECTION NEUTRON_plugin_path neutron/plugin-select
 
+# OVS specific configurations (if that's the one selected)
+if [ "${RET}" = "openvswitch/ovs_neutron_plugin.ini" ] ;
+       # Various network config...
+       pkgos_read_config ${OVS_CONF} OVS tenant_network_type   neutron-plugin-openvswitch/tenant_network_type
+       pkgos_read_config ${OVS_CONF} OVS enable_tunneling      neutron-plugin-openvswitch/enable_tunneling
+       pkgos_read_config ${OVS_CONF} OVS tunnel_id_ranges      neutron-plugin-openvswitch/tunnel_id_ranges
+
+       # Guess values to put in the local_ip directive
+       IF=`LC_ALL=C route | grep default |awk -- '{ print $8 }'`
+       guessed_ip_addr=`LC_ALL=C ifconfig ${IF} | grep 'inet addr' | sed 's/.\+inet addr:\([0-9.]\+\).\+/\1/'`
+       if [ -z "${guessed_ip_addr}" ] ; then
+               guessed_ip_addr=`LC_ALL=C ifconfig ${IF} | grep 'inet adr' | sed 's/.\+inet adr:\([0-9.]\+\).\+/\1/'`
+       fi
+       db_set neutron-plugin-openvswitch/local_ip ${guessed_ip_addr}
+       pkgos_read_config ${OVS_CONF} OVS local_ip neutron-plugin-openvswitch/local_ip
+fi
+
 exit 0
index 52f797e9f491519c030ec40a21e8fddf342cb4ce..daee6f80bfd2c65751360d6688e5d56249b05f3f 100644 (file)
@@ -3,6 +3,7 @@
 set -e
 
 N_CONF=/etc/neutron/neutron.conf
+OVS_CONF=/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
 
 #PKGOS-INCLUDE#
 
@@ -16,12 +17,34 @@ if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then
                install -D -m 0664 /usr/share/neutron-common/neutron-default /etc/default/neutron
        fi
        db_get neutron/plugin-select
+       NEUTRON_plugin_path=${RET}
        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
+
+        pkgos_dbc_postinst --suite neutron ${OVS_CONF} DATABASE sql_connection neutron $@
+
+       # Maintain the OVS config
+        if [ ! -e ${OVS_CONF} ] ; then
+                install -D -m 0640 -o neutron -g neutron /usr/share/neutron-common/ovs_neutron_plugin.ini ${OVS_CONF}
+        fi
+
+       if [ "${NEUTRON_plugin_path}" = "openvswitch/ovs_neutron_plugin.ini" ] ; then
+               db_get neutron-plugin-openvswitch/tenant_network_type
+               pkgos_inifile set ${OVS_CONF} OVS tenant_network_type "${RET}"
+
+               db_get neutron-plugin-openvswitch/enable_tunneling
+               pkgos_inifile set ${OVS_CONF} OVS enable_tunneling "${RET}"
+
+               db_get neutron-plugin-openvswitch/tunnel_id_ranges
+               pkgos_inifile set ${OVS_CONF} OVS tunnel_id_ranges "${RET}"
+
+               db_get neutron-plugin-openvswitch/local_ip
+               pkgos_inifile set ${OVS_CONF} OVS local_ip "${RET}"
+       fi
        db_stop
 
        chown -R neutron:adm /var/log/neutron/
index faec9fd74b101b073b64818295407a8321d527f4..0ab96f5913b2630f2d326963ea742abc6712b550 100644 (file)
@@ -3,6 +3,23 @@
 set -e
 
 if [ "${1}" = "purge" ] ; then
+       if [ -f /usr/share/debconf/confmodule ] ; then
+               . /usr/share/debconf/confmodule
+               db_get neutron/configure_db
+               if [ "$RET" = "true" ] ; then
+                       if [ -f /usr/share/dbconfig-common/dpkg/postrm ] ; then
+                               . /usr/share/dbconfig-common/dpkg/postrm
+                               dbc_go neutron-plugin-openvswitch $@
+                       else
+                               rm -f /etc/dbconfig-common/neutron-common.conf
+                               if which ucf >/dev/null 2>&1; then
+                                       ucf --purge /etc/dbconfig-common/neutron-common.conf
+                                       ucfr --purge neutron-common /etc/dbconfig-common/neutron-common.conf
+                               fi
+                       fi
+               fi
+       fi
+
        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
similarity index 63%
rename from xenial/debian/neutron-plugin-openvswitch.prerm
rename to xenial/debian/neutron-common.prerm
index 5562a458c92469729000b68aa8d9029a5e6d1700..97516608e93a3c7254d49d88ade85969dae387ff 100644 (file)
@@ -4,10 +4,10 @@ set -e
 
 . /usr/share/debconf/confmodule
 
-db_get neutron-plugin-openvswitch/configure_db
+db_get neutron/configure_db
 if [ "$RET" = "true" ]; then
        . /usr/share/dbconfig-common/dpkg/prerm
-       dbc_go neutron-plugin-openvswitch $@
+       dbc_go neutron-common $@
 fi
 
 #DEBHELPER#
index f08484417e275728b385ef8113d925ec4ae1f62a..80a385808f9e29048ccd838efe74c53a87ec97ac 100644 (file)
@@ -41,3 +41,61 @@ _Description: Plugin configuration to load:
  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.
+
+Template: neutron/configure_db
+Type: boolean 
+Default: true
+_Description: Set up a database for neutron-plugin-openvswitch?
+ No database has been set up for neutron-plugin-openvswitch to use. Before
+ continuing, you should make sure you have the following information:
+ .
+  * the type of database that you want to use;
+  * the database server hostname (that server must allow TCP connections from this
+    machine);
+  * a username and password to access the database.
+ .
+ If some of these requirements are missing, do not choose this option and run with
+ regular SQLite support.
+ .
+ You can change this setting later on by running "dpkg-reconfigure -plow
+ neutron-plugin-openvswitch".
+
+Template: neutron-plugin-openvswitch/tenant_network_type
+Type: select
+__Choices: local, gre, vlan, none
+Choices-C: local, gre, vlan, none
+Default: gre
+# Translators: a "tenant" in OpenStack world is
+# an entity that contains one or more username/password couples. 
+# It's typically the tenant that will be used for billing. Having more than one
+# username/password is very helpful in larger organization.
+# You're advised to either keep "tenant" without translating it
+# or keep it parenthezised. Example for French:
+# locataire ("tenant")
+_Description: Type of network to allocate for tenant networks:
+ The value "local" is useful only for single-box testing. In order for
+ tenant networks to provide connectivity between hosts, it is necessary
+ to either choose "vlan" and then configure "network_vlan_ranges" or to
+ choose "gre" and then configure "tunnel_id_ranges". Choose "none" to
+ disable creation of tenant networks.
+
+Template: neutron-plugin-openvswitch/enable_tunneling
+Type: boolean
+Default: true
+_Description: Enable tunneling?
+ Please choose whether support should be activated for GRE networks on the
+ server and agents. This requires kernel support for OVS patch ports and
+ GRE tunneling.
+
+Template: neutron-plugin-openvswitch/tunnel_id_ranges
+Type: string
+Default: 1:1000
+_Description: Tunnel id ranges:
+ Please enter a comma-separated list of <tun_min>:<tun_max> tuples enumerating
+ ranges of GRE tunnel IDs that are available for tenant network allocation
+ if tenant_network_type is "gre".
+
+Template: neutron-plugin-openvswitch/local_ip
+Type: string
+_Description: Local IP address of this hypervisor:
+ Please enter the local IP address for this hypervisor.
diff --git a/xenial/debian/neutron-plugin-openvswitch.config.in b/xenial/debian/neutron-plugin-openvswitch.config.in
deleted file mode 100644 (file)
index d6d41b1..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-set -e
-
-. /usr/share/debconf/confmodule
-
-OVS_CONF=/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
-
-#PKGOS-INCLUDE#
-
-# Various network config...
-pkgos_read_config ${OVS_CONF} OVS tenant_network_type  neutron-plugin-openvswitch/tenant_network_type
-pkgos_read_config ${OVS_CONF} OVS enable_tunneling     neutron-plugin-openvswitch/enable_tunneling
-pkgos_read_config ${OVS_CONF} OVS tunnel_id_ranges     neutron-plugin-openvswitch/tunnel_id_ranges
-
-# Guess values to put in the local_ip directive
-IF=`LC_ALL=C route | grep default |awk -- '{ print $8 }'`
-guessed_ip_addr=`LC_ALL=C ifconfig ${IF} | grep 'inet addr' | sed 's/.\+inet addr:\([0-9.]\+\).\+/\1/'`
-if [ -z "${guessed_ip_addr}" ] ; then
-       guessed_ip_addr=`LC_ALL=C ifconfig ${IF} | grep 'inet adr' | sed 's/.\+inet adr:\([0-9.]\+\).\+/\1/'`
-fi
-db_set neutron-plugin-openvswitch/local_ip ${guessed_ip_addr}
-pkgos_read_config ${OVS_CONF} OVS local_ip neutron-plugin-openvswitch/local_ip
-
-# Configure the SQL connection
-pkgos_dbc_read_conf -pkg neutron-plugin-openvswitch ${OVS_CONF} DATABASE sql_connection neutron-plugin-openvswitch $@
-
-exit 0
diff --git a/xenial/debian/neutron-plugin-openvswitch.postinst.in b/xenial/debian/neutron-plugin-openvswitch.postinst.in
deleted file mode 100644 (file)
index d21a572..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-
-set -e
-
-OVS_CONF=/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
-
-#PKGOS-INCLUDE#
-
-if [ "$1" = "configure" ] ; then
-       . /usr/share/debconf/confmodule
-       . /usr/share/dbconfig-common/dpkg/postinst
-
-       pkgos_var_user_group neutron
-       chmod 755 /var/lib/neutron
-
-       if [ ! -e ${OVS_CONF} ] ; then
-               install -D -m 0640 -o neutron -g neutron /usr/share/neutron-plugin-openvswitch/ovs_neutron_plugin.ini ${OVS_CONF}
-       fi
-       pkgos_dbc_postinst --suite neutron ${OVS_CONF} DATABASE sql_connection neutron-plugin-openvswitch $@
-
-       db_get neutron-plugin-openvswitch/tenant_network_type
-       pkgos_inifile set ${OVS_CONF} OVS tenant_network_type "${RET}"
-       db_get neutron-plugin-openvswitch/enable_tunneling
-       pkgos_inifile set ${OVS_CONF} OVS enable_tunneling "${RET}"
-       db_get neutron-plugin-openvswitch/tunnel_id_ranges
-       pkgos_inifile set ${OVS_CONF} OVS tunnel_id_ranges "${RET}"
-       db_get neutron-plugin-openvswitch/local_ip
-       pkgos_inifile set ${OVS_CONF} OVS local_ip "${RET}"
-
-       db_stop
-fi
-
-#DEBHELPER#
-
-exit 0
diff --git a/xenial/debian/neutron-plugin-openvswitch.postrm b/xenial/debian/neutron-plugin-openvswitch.postrm
deleted file mode 100644 (file)
index b206631..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-
-set -e
-
-if [ "${1}" = "purge" ] ; then
-       if [ -f /usr/share/debconf/confmodule ]; then
-               . /usr/share/debconf/confmodule
-               db_get neutron-plugin-openvswitch/configure_db
-               if [ "$RET" = "true" ]; then
-                       if [ -f /usr/share/dbconfig-common/dpkg/postrm ] ; then
-                               . /usr/share/dbconfig-common/dpkg/postrm
-                               dbc_go neutron-plugin-openvswitch $@
-                       else
-                               rm -f /etc/dbconfig-common/neutron-plugin-openvswitch.conf
-                               if which ucf >/dev/null 2>&1; then
-                                       ucf --purge /etc/dbconfig-common/neutron-plugin-openvswitch.conf
-                                       ucfr --purge neutron-plugin-openvswitch /etc/dbconfig-common/neutron-plugin-openvswitch.conf
-                               fi
-                       fi
-               fi
-       fi
-       [ -w /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini ] && rm -f /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
-       [ -d /etc/neutron/plugins/openvswitch ] && rmdir --ignore-fail-on-non-empty /etc/neutron/plugins/openvswitch
-       [ -d /etc/neutron/plugins ] && rmdir --ignore-fail-on-non-empty /etc/neutron/plugins
-       [ -d /etc/neutron ] && rmdir --ignore-fail-on-non-empty /etc/neutron
-       rm -rf /var/lib/neutron-plugin-openvswitch
-fi
-
-#DEBHELPER#
-
-exit 0
diff --git a/xenial/debian/neutron-plugin-openvswitch.templates b/xenial/debian/neutron-plugin-openvswitch.templates
deleted file mode 100644 (file)
index 21848d4..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-# These templates have been reviewed by the debian-l10n-english
-# team
-#
-# If modifications/additions/rewording are needed, please ask
-# debian-l10n-english@lists.debian.org for advice.
-#
-# Even minor modifications require translation updates and such
-# changes should be coordinated with translators and reviewers.
-
-Template: neutron-plugin-openvswitch/configure_db
-Type: boolean 
-Default: true
-_Description: Set up a database for neutron-plugin-openvswitch?
- No database has been set up for neutron-plugin-openvswitch to use. Before
- continuing, you should make sure you have the following information:
- .
-  * the type of database that you want to use;
-  * the database server hostname (that server must allow TCP connections from this
-    machine);
-  * a username and password to access the database.
- .
- If some of these requirements are missing, do not choose this option and run with
- regular SQLite support.
- .
- You can change this setting later on by running "dpkg-reconfigure -plow
- neutron-plugin-openvswitch".
-
-Template: neutron-plugin-openvswitch/tenant_network_type
-Type: select
-__Choices: local, gre, vlan, none
-Choices-C: local, gre, vlan, none
-Default: gre
-# Translators: a "tenant" in OpenStack world is
-# an entity that contains one or more username/password couples. 
-# It's typically the tenant that will be used for billing. Having more than one
-# username/password is very helpful in larger organization.
-# You're advised to either keep "tenant" without translating it
-# or keep it parenthezised. Example for French:
-# locataire ("tenant")
-_Description: Type of network to allocate for tenant networks:
- The value "local" is useful only for single-box testing. In order for
- tenant networks to provide connectivity between hosts, it is necessary
- to either choose "vlan" and then configure "network_vlan_ranges" or to
- choose "gre" and then configure "tunnel_id_ranges". Choose "none" to
- disable creation of tenant networks.
-
-Template: neutron-plugin-openvswitch/enable_tunneling
-Type: boolean
-Default: true
-_Description: Enable tunneling?
- Please choose whether support should be activated for GRE networks on the
- server and agents. This requires kernel support for OVS patch ports and
- GRE tunneling.
-
-Template: neutron-plugin-openvswitch/tunnel_id_ranges
-Type: string
-Default: 1:1000
-_Description: Tunnel id ranges:
- Please enter a comma-separated list of <tun_min>:<tun_max> tuples enumerating
- ranges of GRE tunnel IDs that are available for tenant network allocation
- if tenant_network_type is "gre".
-
-Template: neutron-plugin-openvswitch/local_ip
-Type: string
-_Description: Local IP address of this hypervisor:
- Please enter the local IP address for this hypervisor.
-
index fcff59196a614496d36ba505cda669305f85f956..4c4fe693b8499731403705a805e95cb5c58eb2ce 100755 (executable)
@@ -32,6 +32,10 @@ override_dh_install:
        # Install the default file
        install -D -m 0640 debian/neutron.mydefault $(CURDIR)/debian/neutron-common/usr/share/neutron-common/neutron-default
 
+       # Move the OVS config file, since we use debconf for it
+       rm $(CURDIR)/debian/neutron-common/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
+       install -D -m 0640 etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini $(CURDIR)/debian/neutron-common/usr/share/neutron-common/ovs_neutron_plugin.ini
+
 override_dh_auto_clean:
        dh_auto_clean
        rm -f neutron/vcsversion.py