From cbdf1579045d018909e32c35bdde26669efd00b5 Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Thu, 1 Aug 2013 02:41:42 +0800 Subject: [PATCH] Moves OVS configuration to neutron-common. Rewritten-From: 9ba987aeaeb7f1d3179463374899255c615c1a75 --- ...ME.Debian => neutron-common.README.Debian} | 0 xenial/debian/neutron-common.config.in | 24 +++++++ xenial/debian/neutron-common.postinst.in | 23 +++++++ xenial/debian/neutron-common.postrm | 17 +++++ ...openvswitch.prerm => neutron-common.prerm} | 4 +- xenial/debian/neutron-common.templates | 58 ++++++++++++++++ .../neutron-plugin-openvswitch.config.in | 28 -------- .../neutron-plugin-openvswitch.postinst.in | 35 ---------- .../debian/neutron-plugin-openvswitch.postrm | 31 --------- .../neutron-plugin-openvswitch.templates | 67 ------------------- xenial/debian/rules | 4 ++ 11 files changed, 128 insertions(+), 163 deletions(-) rename xenial/debian/{neutron-plugin-openvswitch.README.Debian => neutron-common.README.Debian} (100%) rename xenial/debian/{neutron-plugin-openvswitch.prerm => neutron-common.prerm} (63%) delete mode 100644 xenial/debian/neutron-plugin-openvswitch.config.in delete mode 100644 xenial/debian/neutron-plugin-openvswitch.postinst.in delete mode 100644 xenial/debian/neutron-plugin-openvswitch.postrm delete mode 100644 xenial/debian/neutron-plugin-openvswitch.templates diff --git a/xenial/debian/neutron-plugin-openvswitch.README.Debian b/xenial/debian/neutron-common.README.Debian similarity index 100% rename from xenial/debian/neutron-plugin-openvswitch.README.Debian rename to xenial/debian/neutron-common.README.Debian diff --git a/xenial/debian/neutron-common.config.in b/xenial/debian/neutron-common.config.in index 7402d89bc..afb0ae7af 100644 --- a/xenial/debian/neutron-common.config.in +++ b/xenial/debian/neutron-common.config.in @@ -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 diff --git a/xenial/debian/neutron-common.postinst.in b/xenial/debian/neutron-common.postinst.in index 52f797e9f..daee6f80b 100644 --- a/xenial/debian/neutron-common.postinst.in +++ b/xenial/debian/neutron-common.postinst.in @@ -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/ diff --git a/xenial/debian/neutron-common.postrm b/xenial/debian/neutron-common.postrm index faec9fd74..0ab96f591 100644 --- a/xenial/debian/neutron-common.postrm +++ b/xenial/debian/neutron-common.postrm @@ -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 diff --git a/xenial/debian/neutron-plugin-openvswitch.prerm b/xenial/debian/neutron-common.prerm similarity index 63% rename from xenial/debian/neutron-plugin-openvswitch.prerm rename to xenial/debian/neutron-common.prerm index 5562a458c..97516608e 100644 --- a/xenial/debian/neutron-plugin-openvswitch.prerm +++ b/xenial/debian/neutron-common.prerm @@ -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# diff --git a/xenial/debian/neutron-common.templates b/xenial/debian/neutron-common.templates index f08484417..80a385808 100644 --- a/xenial/debian/neutron-common.templates +++ b/xenial/debian/neutron-common.templates @@ -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 : 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 index d6d41b104..000000000 --- a/xenial/debian/neutron-plugin-openvswitch.config.in +++ /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 index d21a5722d..000000000 --- a/xenial/debian/neutron-plugin-openvswitch.postinst.in +++ /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 index b206631f0..000000000 --- a/xenial/debian/neutron-plugin-openvswitch.postrm +++ /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 index 21848d423..000000000 --- a/xenial/debian/neutron-plugin-openvswitch.templates +++ /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 : 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/rules b/xenial/debian/rules index fcff59196..4c4fe693b 100755 --- a/xenial/debian/rules +++ b/xenial/debian/rules @@ -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 -- 2.45.2