From: Thomas Goirand Date: Thu, 1 Nov 2012 16:41:11 +0000 (+0000) Subject: Now auto-detects and prompts for a volume group using debconf. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=d72454056628b831c113cec69b7d16b39e0d20ac;p=openstack-build%2Fcinder-build.git Now auto-detects and prompts for a volume group using debconf. --- diff --git a/debian/changelog b/debian/changelog index 9b9c0e68b..9efc2ad2f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,8 @@ cinder (2012.2-1) experimental; urgency=low * Pre-Depends: dpkg (>= 1.15.6~) because we use xz compression. * Asks for admin tenant, user and password with debconf, patches api-paste.ini so it is syntaxicaly correct. + * Auto-detects a valide volume group name, and prompt the user with debconf + about it. -- Mehdi Abaakouk Sat, 29 Sep 2012 09:23:22 +0200 diff --git a/debian/cinder-common.config.in b/debian/cinder-common.config.in index 43c31f7d2..03e462684 100644 --- a/debian/cinder-common.config.in +++ b/debian/cinder-common.config.in @@ -26,7 +26,23 @@ CINDER_ENABLE=${CINDER_ENABLE}" >${CINDER_COM_DEF} pkgos_var_user_group cinder manage_cinder_enable pkgos_dbc_read_conf ${CINDER_CONF} cinder DEFAULT sql_connection $@ -set -x pkgos_read_admin_creds ${CINDER_API} cinder filter:authtoken +pkgos_get_config ${CINDER_CONF} volume_group DEFAULT +if [ -n "${RET}" ] ; then + db_set cinder/volume_group "${RET}" +else + db_get cinder/volume_group + if [ -z "${RET}" ] && [ -x /sbin/vgdisplay ] ; then + # Since we have no prior value, try to guess it from vgdisplay + VGDISP=`vgdisplay -c | head -n 1` + if [ -n "${VGDISP}" ] ; then + VGNAME=`echo ${VGDISP} | cut -d: -f1` + db_set cinder/volume_group ${VGNAME} + fi + fi +fi +db_input high cinder/volume_group || true +db_go + exit 0 diff --git a/debian/cinder-common.postinst.in b/debian/cinder-common.postinst.in index 6dacd4a5c..4be0710fb 100644 --- a/debian/cinder-common.postinst.in +++ b/debian/cinder-common.postinst.in @@ -16,6 +16,12 @@ if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then pkgos_write_new_conf cinder api-paste.ini pkgos_dbc_postinst ${CINDER_CONF} cinder DEFAULT sql_connection $@ pkgos_write_admin_creds ${CINDER_API} cinder filter:authtoken + db_get cinder/volume_group + if [ -n "${RET}" ] ; then + pkgos_edit_config volume_group ${RET} ${CINDER_CONF} DEFAULT + fi + + db_stop chmod 0440 /etc/sudoers.d/cinder-common echo "Now calling cinder-manage db sync: this may take a while..." diff --git a/debian/cinder-common.postrm b/debian/cinder-common.postrm index aabb325ed..3dea78bd8 100644 --- a/debian/cinder-common.postrm +++ b/debian/cinder-common.postrm @@ -6,7 +6,7 @@ if [ "$1" = "purge" ] && [ -f /usr/share/debconf/confmodule ] ; then if [ -f /usr/share/debconf/confmodule ] ; then . /usr/share/debconf/confmodule - db_get cinder/configure_db + db_get cinder/configure_db || true if [ "$RET" = "true" ]; then if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then . /usr/share/dbconfig-common/dpkg/postrm diff --git a/debian/cinder-common.prerm b/debian/cinder-common.prerm index 8e6f542b8..ecda68a06 100644 --- a/debian/cinder-common.prerm +++ b/debian/cinder-common.prerm @@ -4,7 +4,7 @@ set -e . /usr/share/debconf/confmodule -db_get cinder/configure_db +db_get cinder/configure_db || true if [ "$RET" = "true" ]; then . /usr/share/dbconfig-common/dpkg/prerm dbc_go cinder-common $@ diff --git a/debian/cinder-common.templates b/debian/cinder-common.templates index c98741f87..1508e552e 100644 --- a/debian/cinder-common.templates +++ b/debian/cinder-common.templates @@ -44,3 +44,9 @@ _Description: Auth server username: Template: cinder/admin-password Type: password _Description: Auth server password: + +Template: cinder/volume_group +Type: string +_Description: Cinder volume group: + Please specify the name of the LVM volume group (vg) on which Cinder + will create partitions. diff --git a/debian/po/templates.pot b/debian/po/templates.pot index be7069f31..cdab8393d 100644 --- a/debian/po/templates.pot +++ b/debian/po/templates.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: cinder\n" "Report-Msgid-Bugs-To: cinder@packages.debian.org\n" -"POT-Creation-Date: 2012-09-17 09:47+0200\n" +"POT-Creation-Date: 2012-11-01 16:43+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -70,3 +70,49 @@ msgid "" "You can change this setting later on by running \"dpkg-reconfigure -plow " "cinder-common\"." msgstr "" + +#. Type: string +#. Description +#: ../cinder-common.templates:3001 +msgid "Auth server hostname:" +msgstr "" + +#. Type: string +#. Description +#: ../cinder-common.templates:3001 +msgid "" +"Please specify the URL of your Cinder authentication server. Typically this " +"is also the URL of your OpenStack Identity Service (Keystone)." +msgstr "" + +#. Type: string +#. Description +#: ../cinder-common.templates:4001 +msgid "Auth server tenant name:" +msgstr "" + +#. Type: string +#. Description +#: ../cinder-common.templates:5001 +msgid "Auth server username:" +msgstr "" + +#. Type: password +#. Description +#: ../cinder-common.templates:6001 +msgid "Auth server password:" +msgstr "" + +#. Type: string +#. Description +#: ../cinder-common.templates:7001 +msgid "Cinder volume group:" +msgstr "" + +#. Type: string +#. Description +#: ../cinder-common.templates:7001 +msgid "" +"Please specify the name of the LVM volume group (vg) on which Cinder will " +"create partitions." +msgstr ""