From cd4fd1d02c6cda99abb8edac499915a1b157e435 Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Wed, 19 Sep 2018 09:31:15 +0000 Subject: [PATCH 01/19] Add deletion of placement-policy.json in postrm --- debian/changelog | 8 ++++++++ debian/nova-common.postrm.in | 1 + 2 files changed, 9 insertions(+) diff --git a/debian/changelog b/debian/changelog index d0cf249f8c..4322eda3ab 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +nova (2:18.0.1-2) UNRELEASED; urgency=medium + + [ Michal Arbet ] + * d/nova-common.postrm.in: + - Add deletion of /etc/nova/placement-policy.json (Closes: #909115) + + -- Michal Arbet Tue, 18 Sep 2018 18:41:15 +0200 + nova (2:18.0.1-1) unstable; urgency=medium * New upstream release. diff --git a/debian/nova-common.postrm.in b/debian/nova-common.postrm.in index f05845d0a7..86444591e6 100755 --- a/debian/nova-common.postrm.in +++ b/debian/nova-common.postrm.in @@ -14,6 +14,7 @@ if [ "$1" = "purge" ] ; then rm -f /etc/default/nova-common rm -f /etc/nova/api-paste.ini rm -f /etc/nova/logging.conf + rm -f /etc/nova/placement-policy.json rmdir --ignore-fail-on-non-empty /etc/nova fi -- GitLab From 547b4e0b718a8f01169ce815c16e679e51fd1579 Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Wed, 19 Sep 2018 11:43:14 +0000 Subject: [PATCH 02/19] Fix nova-api not deleting database in postrm --- debian/nova-api.postrm.in | 14 ++++++++++++++ debian/nova-api.prerm | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 debian/nova-api.postrm.in create mode 100755 debian/nova-api.prerm diff --git a/debian/nova-api.postrm.in b/debian/nova-api.postrm.in new file mode 100755 index 0000000000..cfb589ef04 --- /dev/null +++ b/debian/nova-api.postrm.in @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +#PKGOS-INCLUDE# + +if [ "$1" = "purge" ] ; then + pkgos_dbc_postrm novaapi nova-api $@ + + rm -f /var/log/nova/nova-api.log* +fi + + +#DEBHELPER# diff --git a/debian/nova-api.prerm b/debian/nova-api.prerm new file mode 100755 index 0000000000..4e4792b3b1 --- /dev/null +++ b/debian/nova-api.prerm @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +if [ "${1}" = "remove" ] && [ -r /usr/share/debconf/confmodule ] && [ -r /usr/share/dbconfig-common/dpkg/prerm ] ; then + . /usr/share/debconf/confmodule + db_get novaapi/configure_db || true + if [ "$RET" = "true" ] ; then + . /usr/share/dbconfig-common/dpkg/prerm + dbc_go nova-api $@ + fi +fi + +#DEBHELPER# + +exit 0 -- GitLab From 9398520a15a0c24c32aa41bccc39717d49c800ca Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Wed, 19 Sep 2018 18:58:09 +0000 Subject: [PATCH 03/19] Some work done now --- debian/nova-api.postinst.in | 1 + debian/nova-common.postinst.in | 23 +++++++++++++++++++++-- debian/nova-common.triggers | 1 + 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 debian/nova-common.triggers diff --git a/debian/nova-api.postinst.in b/debian/nova-api.postinst.in index 9c2a24a251..f1452fb210 100755 --- a/debian/nova-api.postinst.in +++ b/debian/nova-api.postinst.in @@ -19,6 +19,7 @@ if [ "$1" = "configure" ] ; then pkgos_dbc_postinst --suite nova /etc/nova/nova.conf api_database connection novaapi $@ echo "nova-common: Now running \"nova-manage api_db sync\", this may take a while..." su nova -s /bin/sh -c "nova-manage api_db sync" || true + dpkg-trigger --no-await nova-common-db-sync fi db_stop diff --git a/debian/nova-common.postinst.in b/debian/nova-common.postinst.in index a3c4993075..94f72b2164 100755 --- a/debian/nova-common.postinst.in +++ b/debian/nova-common.postinst.in @@ -51,6 +51,21 @@ read_neutron_config () { pkgos_inifile set ${NOVA_CONF} neutron metadata_proxy_shared_secret ${RET} } +run_db_sync (){ + + API_DATABASE_CONFIG_AVAILABLE=None + + # We have to check if connection is set in [api_database] config + pkgos_inifile get ${NOVA_CONF} api_database connection + if echo ${RET} | egrep 'mysql(\+pymysql)?:.*:.*@.*\/.*' > /dev/null; then + echo "nova-common: Now running \"nova-manage db sync\", this may take a while..." + su nova -s /bin/sh -c "nova-manage db sync" || true + else + echo "nova-common: \"nova-manage db sync\" needs api_database.connection set. Sorry." + fi + +} + if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then . /usr/share/debconf/confmodule @@ -83,8 +98,7 @@ if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then db_get nova/configure_db if [ "$RET" = "true" ]; then pkgos_dbc_postinst /etc/nova/nova.conf database connection nova $@ - echo "nova-common: Now running \"nova-manage db sync\", this may take a while..." - su nova -s /bin/sh -c "nova-manage db sync" || true + run_db_sync fi db_stop @@ -94,6 +108,11 @@ if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then [ -f /etc/sudoers.d/nova_sudoers ] && rm -f /etc/sudoers.d/nova_sudoers # That's the old file that we get rid of fi +if [ "$1" = "triggered" ]; then + run_db_sync + +fi + #DEBHELPER# exit 0 diff --git a/debian/nova-common.triggers b/debian/nova-common.triggers new file mode 100644 index 0000000000..547126239f --- /dev/null +++ b/debian/nova-common.triggers @@ -0,0 +1 @@ +interest nova-common-db-sync -- GitLab From 5d5aa55bfc9ebd9927fa0de64be2b4a75a775728 Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Wed, 19 Sep 2018 19:43:09 +0000 Subject: [PATCH 04/19] Add database creation in debconf for nova-placement-api --- debian/nova-placement-api.config.in | 3 +++ debian/nova-placement-api.postinst.in | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/debian/nova-placement-api.config.in b/debian/nova-placement-api.config.in index 470a68b0a5..975f73eab2 100644 --- a/debian/nova-placement-api.config.in +++ b/debian/nova-placement-api.config.in @@ -4,8 +4,11 @@ set -e . /usr/share/debconf/confmodule +NOVA_CONF=/etc/nova/nova.conf + #PKGOS-INCLUDE# pkgos_register_endpoint_config nova-placement-api +pkgos_dbc_read_conf -pkg nova-placement-api ${NOVA_CONF} placement_database connection novaplacement $@ exit 0 diff --git a/debian/nova-placement-api.postinst.in b/debian/nova-placement-api.postinst.in index 1b1a56a5bb..3f1c099b3c 100755 --- a/debian/nova-placement-api.postinst.in +++ b/debian/nova-placement-api.postinst.in @@ -7,6 +7,14 @@ set -e if [ "$1" = "configure" ] ; then . /usr/share/debconf/confmodule pkgos_register_endpoint_postinst nova-placement-api placement placement "Placement API" 8778 "" + + db_get novaplacement/configure_db + if [ "$RET" = "true" ]; then + pkgos_dbc_postinst --suite nova /etc/nova/nova.conf placement_database connection novaplacement $@ + echo "nova-common: Now running \"nova-manage api_db sync\", this may take a while..." + su nova -s /bin/sh -c "nova-manage api_db sync" || true + fi + db_stop fi -- GitLab From eeb5e37af0c72d61fee1376f2e87949f5966ac42 Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Wed, 19 Sep 2018 19:59:21 +0000 Subject: [PATCH 05/19] Remove old nova-api.postrm --- debian/nova-api.postrm | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100755 debian/nova-api.postrm diff --git a/debian/nova-api.postrm b/debian/nova-api.postrm deleted file mode 100755 index 61000b9986..0000000000 --- a/debian/nova-api.postrm +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -set -e - -if [ "$1" = "purge" ] ; then - if [ -r /usr/share/debconf/confmodule ] ; then - . /usr/share/debconf/confmodule - db_get nova/configure_db || true - if [ "$RET" = "true" ] ; then - if [ -f /usr/share/dbconfig-common/dpkg/postrm ] ; then - . /usr/share/dbconfig-common/dpkg/postrm - dbc_go nova-api $@ - else - rm -f /etc/dbconfig-common/nova-api.conf - if which ucf >/dev/null 2>&1; then - ucf --purge /etc/dbconfig-common/nova-api.conf - ucfr --purge nova-api /etc/dbconfig-common/nova-api.conf - fi - fi - fi - fi - - rm -f /var/log/nova/nova-api.log* -fi - - -#DEBHELPER# -- GitLab From f38556bff72b15b42f2d40e0e57ce2eeb28c6b6d Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Wed, 19 Sep 2018 20:02:38 +0000 Subject: [PATCH 06/19] Fix nova-placement api, add debconf database creation --- debian/nova-placement-api.config.in | 2 +- debian/nova-placement-api.postinst.in | 5 +++-- debian/nova-placement-api.postrm.in | 12 ++++++++++++ debian/nova-placement-api.prerm | 16 ++++++++++++++++ debian/nova-placement-api.templates.in | 19 +++++++++++++++++++ 5 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 debian/nova-placement-api.postrm.in create mode 100644 debian/nova-placement-api.prerm create mode 100644 debian/nova-placement-api.templates.in diff --git a/debian/nova-placement-api.config.in b/debian/nova-placement-api.config.in index 975f73eab2..cf63e2c10c 100644 --- a/debian/nova-placement-api.config.in +++ b/debian/nova-placement-api.config.in @@ -9,6 +9,6 @@ NOVA_CONF=/etc/nova/nova.conf #PKGOS-INCLUDE# pkgos_register_endpoint_config nova-placement-api -pkgos_dbc_read_conf -pkg nova-placement-api ${NOVA_CONF} placement_database connection novaplacement $@ +pkgos_dbc_read_conf -pkg nova-placement-api ${NOVA_CONF} placement_database connection novaplacementapi $@ exit 0 diff --git a/debian/nova-placement-api.postinst.in b/debian/nova-placement-api.postinst.in index 3f1c099b3c..c3c586e903 100755 --- a/debian/nova-placement-api.postinst.in +++ b/debian/nova-placement-api.postinst.in @@ -8,11 +8,12 @@ if [ "$1" = "configure" ] ; then . /usr/share/debconf/confmodule pkgos_register_endpoint_postinst nova-placement-api placement placement "Placement API" 8778 "" - db_get novaplacement/configure_db + db_get novaplacementapi/configure_db if [ "$RET" = "true" ]; then - pkgos_dbc_postinst --suite nova /etc/nova/nova.conf placement_database connection novaplacement $@ + pkgos_dbc_postinst --suite nova /etc/nova/nova.conf placement_database connection novaplacementapi $@ echo "nova-common: Now running \"nova-manage api_db sync\", this may take a while..." su nova -s /bin/sh -c "nova-manage api_db sync" || true + dpkg-trigger --no-await nova-common-db-sync fi db_stop diff --git a/debian/nova-placement-api.postrm.in b/debian/nova-placement-api.postrm.in new file mode 100644 index 0000000000..00b28655d9 --- /dev/null +++ b/debian/nova-placement-api.postrm.in @@ -0,0 +1,12 @@ +#!/bin/sh + +set -e + +#PKGOS-INCLUDE# + +if [ "$1" = "purge" ] ; then + pkgos_dbc_postrm novaplacementapi nova-placement-api $@ +fi + + +#DEBHELPER# diff --git a/debian/nova-placement-api.prerm b/debian/nova-placement-api.prerm new file mode 100644 index 0000000000..19d658f0b3 --- /dev/null +++ b/debian/nova-placement-api.prerm @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +if [ "${1}" = "remove" ] && [ -r /usr/share/debconf/confmodule ] && [ -r /usr/share/dbconfig-common/dpkg/prerm ] ; then + . /usr/share/debconf/confmodule + db_get novaplacementapi/configure_db || true + if [ "$RET" = "true" ] ; then + . /usr/share/dbconfig-common/dpkg/prerm + dbc_go nova-placement-api $@ + fi +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/nova-placement-api.templates.in b/debian/nova-placement-api.templates.in new file mode 100644 index 0000000000..5bf0e4a8f5 --- /dev/null +++ b/debian/nova-placement-api.templates.in @@ -0,0 +1,19 @@ +Template: novaplacementapi/configure_db +Type: boolean +Default: false +_Description: Set up a database for Nova Placement API? + No database has been set up for Nova Placement to use. If you want + to set one up now, please make sure you have all needed + information: + . + * the host name of the database server (which must allow TCP + connections from this machine); + * a username and password to access the database; + * the type of database management software you want to use. + . + If you don't choose this option, no database will be set up and Nova + will use regular SQLite support. + . + You can change this setting later on by running "dpkg-reconfigure + -plow nova-placement-api". + -- GitLab From ba0d936aefba372f541409e74c22fddc920fcbdd Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Sat, 22 Sep 2018 09:01:57 +0000 Subject: [PATCH 07/19] Add 2 > /dev/null in d/nova-placement-api.postinst.in --- debian/nova-placement-api.postinst.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/nova-placement-api.postinst.in b/debian/nova-placement-api.postinst.in index c3c586e903..675dbcd455 100755 --- a/debian/nova-placement-api.postinst.in +++ b/debian/nova-placement-api.postinst.in @@ -12,7 +12,7 @@ if [ "$1" = "configure" ] ; then if [ "$RET" = "true" ]; then pkgos_dbc_postinst --suite nova /etc/nova/nova.conf placement_database connection novaplacementapi $@ echo "nova-common: Now running \"nova-manage api_db sync\", this may take a while..." - su nova -s /bin/sh -c "nova-manage api_db sync" || true + su nova -s /bin/sh -c "nova-manage api_db sync 2>/dev/null" || true dpkg-trigger --no-await nova-common-db-sync fi -- GitLab From 3ee7268f0cc85c373735ac742af96e22657279e8 Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Sat, 22 Sep 2018 09:12:36 +0000 Subject: [PATCH 08/19] Add cells creation to nova-placement --- debian/nova-placement-api.config.in | 2 +- debian/nova-placement-api.postinst.in | 8 ++++++-- debian/nova-placement-api.postrm.in | 2 +- debian/nova-placement-api.prerm | 2 +- debian/nova-placement-api.templates.in | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/debian/nova-placement-api.config.in b/debian/nova-placement-api.config.in index cf63e2c10c..d9e42dbd45 100644 --- a/debian/nova-placement-api.config.in +++ b/debian/nova-placement-api.config.in @@ -9,6 +9,6 @@ NOVA_CONF=/etc/nova/nova.conf #PKGOS-INCLUDE# pkgos_register_endpoint_config nova-placement-api -pkgos_dbc_read_conf -pkg nova-placement-api ${NOVA_CONF} placement_database connection novaplacementapi $@ +pkgos_dbc_read_conf -pkg nova-placement-api ${NOVA_CONF} placement_database connection placement $@ exit 0 diff --git a/debian/nova-placement-api.postinst.in b/debian/nova-placement-api.postinst.in index 675dbcd455..574d4831ab 100755 --- a/debian/nova-placement-api.postinst.in +++ b/debian/nova-placement-api.postinst.in @@ -8,11 +8,15 @@ if [ "$1" = "configure" ] ; then . /usr/share/debconf/confmodule pkgos_register_endpoint_postinst nova-placement-api placement placement "Placement API" 8778 "" - db_get novaplacementapi/configure_db + db_get placement/configure_db if [ "$RET" = "true" ]; then - pkgos_dbc_postinst --suite nova /etc/nova/nova.conf placement_database connection novaplacementapi $@ + pkgos_dbc_postinst --suite nova /etc/nova/nova.conf placement_database connection placement $@ echo "nova-common: Now running \"nova-manage api_db sync\", this may take a while..." su nova -s /bin/sh -c "nova-manage api_db sync 2>/dev/null" || true + echo "nova-common: Registering nova cell0 database" + su nova -s /bin/sh -c "nova-manage cell_v2 map_cell0 2>/dev/null" || true + echo "nova-common: Creating nova cell1 database" + su nova -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose 2>/dev/null" || true dpkg-trigger --no-await nova-common-db-sync fi diff --git a/debian/nova-placement-api.postrm.in b/debian/nova-placement-api.postrm.in index 00b28655d9..31614a6b03 100644 --- a/debian/nova-placement-api.postrm.in +++ b/debian/nova-placement-api.postrm.in @@ -5,7 +5,7 @@ set -e #PKGOS-INCLUDE# if [ "$1" = "purge" ] ; then - pkgos_dbc_postrm novaplacementapi nova-placement-api $@ + pkgos_dbc_postrm placement nova-placement-api $@ fi diff --git a/debian/nova-placement-api.prerm b/debian/nova-placement-api.prerm index 19d658f0b3..d0dbf7ccc6 100644 --- a/debian/nova-placement-api.prerm +++ b/debian/nova-placement-api.prerm @@ -4,7 +4,7 @@ set -e if [ "${1}" = "remove" ] && [ -r /usr/share/debconf/confmodule ] && [ -r /usr/share/dbconfig-common/dpkg/prerm ] ; then . /usr/share/debconf/confmodule - db_get novaplacementapi/configure_db || true + db_get placement/configure_db || true if [ "$RET" = "true" ] ; then . /usr/share/dbconfig-common/dpkg/prerm dbc_go nova-placement-api $@ diff --git a/debian/nova-placement-api.templates.in b/debian/nova-placement-api.templates.in index 5bf0e4a8f5..d3d9d3860a 100644 --- a/debian/nova-placement-api.templates.in +++ b/debian/nova-placement-api.templates.in @@ -1,4 +1,4 @@ -Template: novaplacementapi/configure_db +Template: placement/configure_db Type: boolean Default: false _Description: Set up a database for Nova Placement API? -- GitLab From e53bc08e0aa3e8f5ba9dfb6da5fa778b5416bd08 Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Sat, 22 Sep 2018 09:55:10 +0000 Subject: [PATCH 09/19] Move cell creation to nova-api , api_database connection needed --- debian/nova-api.postinst.in | 4 ++++ debian/nova-placement-api.postinst.in | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/debian/nova-api.postinst.in b/debian/nova-api.postinst.in index f1452fb210..6a03dbfb99 100755 --- a/debian/nova-api.postinst.in +++ b/debian/nova-api.postinst.in @@ -19,6 +19,10 @@ if [ "$1" = "configure" ] ; then pkgos_dbc_postinst --suite nova /etc/nova/nova.conf api_database connection novaapi $@ echo "nova-common: Now running \"nova-manage api_db sync\", this may take a while..." su nova -s /bin/sh -c "nova-manage api_db sync" || true + echo "nova-common: Registering nova cell0 database" + su nova -s /bin/sh -c "nova-manage cell_v2 map_cell0 2>/dev/null" || true + echo "nova-common: Creating nova cell1 database" + su nova -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose 2>/dev/null" || true dpkg-trigger --no-await nova-common-db-sync fi diff --git a/debian/nova-placement-api.postinst.in b/debian/nova-placement-api.postinst.in index 574d4831ab..80e9f5892c 100755 --- a/debian/nova-placement-api.postinst.in +++ b/debian/nova-placement-api.postinst.in @@ -13,10 +13,6 @@ if [ "$1" = "configure" ] ; then pkgos_dbc_postinst --suite nova /etc/nova/nova.conf placement_database connection placement $@ echo "nova-common: Now running \"nova-manage api_db sync\", this may take a while..." su nova -s /bin/sh -c "nova-manage api_db sync 2>/dev/null" || true - echo "nova-common: Registering nova cell0 database" - su nova -s /bin/sh -c "nova-manage cell_v2 map_cell0 2>/dev/null" || true - echo "nova-common: Creating nova cell1 database" - su nova -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose 2>/dev/null" || true dpkg-trigger --no-await nova-common-db-sync fi -- GitLab From 997d6267a1557b99c4560b0705a8f95d77c04eea Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Sat, 22 Sep 2018 12:38:26 +0000 Subject: [PATCH 10/19] Some placement-api stuff Some nova-commmon stuff --- debian/nova-common.postinst.in | 45 ++++++++++++++++++++++++- debian/nova-common.prerm | 48 +++++++++++++++++++++++++++ debian/nova-placement-api.postinst.in | 3 +- 3 files changed, 94 insertions(+), 2 deletions(-) diff --git a/debian/nova-common.postinst.in b/debian/nova-common.postinst.in index 94f72b2164..e16873e8de 100755 --- a/debian/nova-common.postinst.in +++ b/debian/nova-common.postinst.in @@ -66,6 +66,49 @@ run_db_sync (){ } +create_cell0_database (){ + db_get nova-common/dbconfig-install + if [ "$RET" = "true" ]; then + db_get nova-common/database-type + if [ "$RET" = "mysql" ]; then + # We need to know admin connection details + db_get nova-common/remote/host + mysql_host=$RET + db_get nova-common/mysql/admin-user + mysql_admin_user=$RET + db_get nova-common/mysql/admin-pass + mysql_admin_pass=$RET + db_get nova-common/db/dbname + mysql_nova_db_name=$RET + # We need to know mysql user which have grants to nova db + db_get nova-common/db/app-user + mysql_app_user_complete=$RET + if echo $mysql_app_user_complete | egrep @ > /dev/null; then + mysql_app_username=$(echo $mysql_app_user_complete | cut -d@ -f1) + mysql_app_user_domain=$(echo $mysql_app_user_complete | cut -d@ -f2) + mysql_app_user=$(echo "'$mysql_app_username'@'$mysql_app_user_domain'") + else + mysql_app_user=$(echo $mysql_app_user_complete) + fi + # Create nova_cell0 database + echo "===> nova-common: Creating ${mysql_nova_db_name}_cell0 database:" + echo "CREATE DATABASE IF NOT EXISTS ${mysql_nova_db_name}_cell0 CHARACTER SET utf8 COLLATE utf8_unicode_ci;" | mysql -h $mysql_host -u $mysql_admin_user -p$mysql_admin_pass + echo "===> nova-common: Granting permissions on ${mysql_nova_db_name}_cell0.* to ${mysql_app_user}" + echo "GRANT ALL PRIVILEGES ON ${mysql_nova_db_name}_cell0.* TO ${mysql_app_user};" | mysql -h $mysql_host -u $mysql_admin_user -p$mysql_admin_pass + elif [ "$RET" = "sqlite3" ]; then + # We need to know path of sqlite3 file + db_get nova-common/db/basepath + sqlite3_base_path=$RET + db_get nova-common/db/dbname + sqlite3_db_name=${RET}_cell0 + sqlite3_file_path=$(echo "$sqlite3_base_path/$sqlite3_db_name") + echo "===> nova-common: Creation of database $sqlite3_db_name in sqlite3 is not currently supported. Please create $sqlite3_db_name manually." + else + echo "Database configuration available only mysql currently." + fi + fi +} + if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then . /usr/share/debconf/confmodule @@ -98,6 +141,7 @@ if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then db_get nova/configure_db if [ "$RET" = "true" ]; then pkgos_dbc_postinst /etc/nova/nova.conf database connection nova $@ + create_cell0_database run_db_sync fi @@ -110,7 +154,6 @@ fi if [ "$1" = "triggered" ]; then run_db_sync - fi #DEBHELPER# diff --git a/debian/nova-common.prerm b/debian/nova-common.prerm index e194cbac10..b8d5941f57 100755 --- a/debian/nova-common.prerm +++ b/debian/nova-common.prerm @@ -2,12 +2,60 @@ set -e +remove_cell0_database (){ + dump_timestamp=$(date +"%Y-%m-%d-%H-%M-%S") + db_get nova-common/database-type + nova_database_type=$RET + if [ "$nova_database_type" = "mysql" ]; then + # We need to know admin connection details + db_get nova-common/remote/host + mysql_host=$RET + db_get nova-common/mysql/admin-user + mysql_admin_user=$RET + db_get nova-common/mysql/admin-pass + mysql_admin_pass=$RET + db_get nova-common/db/dbname + mysql_nova_db_name=$RET + # We need to know mysql user which have grants to nova db + db_get nova-common/db/app-user + mysql_app_user_complete=$RET + if echo $mysql_app_user_complete | egrep @ > /dev/null; then + mysql_app_username=$(echo $mysql_app_user_complete | cut -d@ -f1) + mysql_app_user_domain=$(echo $mysql_app_user_complete | cut -d@ -f2) + mysql_app_user=$(echo "'$mysql_app_username'@'$mysql_app_user_domain'") + else + mysql_app_user=$(echo $mysql_app_user_complete) + fi + # Drop nova_cell0 database + echo "===> nova-common: Dumping ${mysql_nova_db_name}_cell0 database:" + mysqldump -h $mysql_host -u $mysql_admin_user -p$mysql_admin_pass ${mysql_nova_db_name}_cell0 > /var/tmp/${mysql_nova_db_name}_cell0.${dump_timestamp}.mysql + echo "===> nova-common: Revoking all privileges from ${mysql_app_user} for ${mysql_nova_db_name}_cell0" + echo "REVOKE ALL PRIVILEGES ON ${mysql_nova_db_name}_cell0.* FROM ${mysql_app_user};" | mysql -h $mysql_host -u $mysql_admin_user -p$mysql_admin_pass + echo "===> nova-common: Droping database ${mysql_nova_db_name}_cell0" + echo "DROP DATABASE ${mysql_nova_db_name}_cell0" | mysql -h $mysql_host -u $mysql_admin_user -p$mysql_admin_pass + elif [ "$nova_database_type" = "sqlite3" ]; then + # We need to know path of sqlite3 file + db_get nova-common/db/basepath + sqlite3_base_path=$RET + db_get nova-common/db/dbname + sqlite3_db_name=${RET}_cell0 + sqlite3_file_path=$(echo "$sqlite3_base_path/$sqlite3_db_name") + echo "===> nova-common: Creation of database $sqlite3_db_name in sqlite3 is not currently supported. If you've created manually, delete also manyally." + else + echo "Database configuration available only for mysql currently." + fi +} + if [ "${1}" = "remove" ] && [ -r /usr/share/debconf/confmodule ] && [ -r /usr/share/dbconfig-common/dpkg/prerm ] ; then . /usr/share/debconf/confmodule db_get nova/configure_db || true if [ "$RET" = "true" ] ; then . /usr/share/dbconfig-common/dpkg/prerm dbc_go nova-common $@ + db_get nova-common/dbconfig-remove + if [ "$RET" = "true" ]; then + remove_cell0_database + fi fi fi diff --git a/debian/nova-placement-api.postinst.in b/debian/nova-placement-api.postinst.in index 80e9f5892c..663cf7d13c 100755 --- a/debian/nova-placement-api.postinst.in +++ b/debian/nova-placement-api.postinst.in @@ -12,8 +12,9 @@ if [ "$1" = "configure" ] ; then if [ "$RET" = "true" ]; then pkgos_dbc_postinst --suite nova /etc/nova/nova.conf placement_database connection placement $@ echo "nova-common: Now running \"nova-manage api_db sync\", this may take a while..." + # This command is failing when api_database not filled, but it is false positive + # If we have nova api db populated , it is OK , placement db is not required still in rocky su nova -s /bin/sh -c "nova-manage api_db sync 2>/dev/null" || true - dpkg-trigger --no-await nova-common-db-sync fi db_stop -- GitLab From 5cc5a20a9a9f3374420884ac32e55e6531d843f2 Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Tue, 25 Sep 2018 07:26:59 +0000 Subject: [PATCH 11/19] Update print messages in packages --- debian/nova-api.postinst.in | 6 +++--- debian/nova-common.postinst.in | 6 +++--- debian/nova-common.prerm | 2 +- debian/nova-placement-api.postinst.in | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/debian/nova-api.postinst.in b/debian/nova-api.postinst.in index 6a03dbfb99..aa057926ea 100755 --- a/debian/nova-api.postinst.in +++ b/debian/nova-api.postinst.in @@ -17,11 +17,11 @@ if [ "$1" = "configure" ] ; then db_get novaapi/configure_db if [ "$RET" = "true" ]; then pkgos_dbc_postinst --suite nova /etc/nova/nova.conf api_database connection novaapi $@ - echo "nova-common: Now running \"nova-manage api_db sync\", this may take a while..." + echo "===> nova-common: Now running \"nova-manage api_db sync\", this may take a while..." su nova -s /bin/sh -c "nova-manage api_db sync" || true - echo "nova-common: Registering nova cell0 database" + echo "===> nova-common: Registering nova cell0 database" su nova -s /bin/sh -c "nova-manage cell_v2 map_cell0 2>/dev/null" || true - echo "nova-common: Creating nova cell1 database" + echo "===> nova-common: Creating nova cell1 database" su nova -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose 2>/dev/null" || true dpkg-trigger --no-await nova-common-db-sync fi diff --git a/debian/nova-common.postinst.in b/debian/nova-common.postinst.in index e16873e8de..8838bbb84d 100755 --- a/debian/nova-common.postinst.in +++ b/debian/nova-common.postinst.in @@ -58,10 +58,10 @@ run_db_sync (){ # We have to check if connection is set in [api_database] config pkgos_inifile get ${NOVA_CONF} api_database connection if echo ${RET} | egrep 'mysql(\+pymysql)?:.*:.*@.*\/.*' > /dev/null; then - echo "nova-common: Now running \"nova-manage db sync\", this may take a while..." + echo "===> nova-common: Now running \"nova-manage db sync\", this may take a while..." su nova -s /bin/sh -c "nova-manage db sync" || true else - echo "nova-common: \"nova-manage db sync\" needs api_database.connection set. Sorry." + echo "===> nova-common: \"nova-manage db sync\" needs api_database.connection set. Sorry." fi } @@ -104,7 +104,7 @@ create_cell0_database (){ sqlite3_file_path=$(echo "$sqlite3_base_path/$sqlite3_db_name") echo "===> nova-common: Creation of database $sqlite3_db_name in sqlite3 is not currently supported. Please create $sqlite3_db_name manually." else - echo "Database configuration available only mysql currently." + echo "===> nova-common: Database configuration available only mysql currently." fi fi } diff --git a/debian/nova-common.prerm b/debian/nova-common.prerm index b8d5941f57..50a644bb5b 100755 --- a/debian/nova-common.prerm +++ b/debian/nova-common.prerm @@ -42,7 +42,7 @@ remove_cell0_database (){ sqlite3_file_path=$(echo "$sqlite3_base_path/$sqlite3_db_name") echo "===> nova-common: Creation of database $sqlite3_db_name in sqlite3 is not currently supported. If you've created manually, delete also manyally." else - echo "Database configuration available only for mysql currently." + echo "===> nova-common: Database configuration available only for mysql currently." fi } diff --git a/debian/nova-placement-api.postinst.in b/debian/nova-placement-api.postinst.in index 663cf7d13c..a291025bb7 100755 --- a/debian/nova-placement-api.postinst.in +++ b/debian/nova-placement-api.postinst.in @@ -11,7 +11,7 @@ if [ "$1" = "configure" ] ; then db_get placement/configure_db if [ "$RET" = "true" ]; then pkgos_dbc_postinst --suite nova /etc/nova/nova.conf placement_database connection placement $@ - echo "nova-common: Now running \"nova-manage api_db sync\", this may take a while..." + echo "===> nova-common: Now running \"nova-manage api_db sync\", this may take a while..." # This command is failing when api_database not filled, but it is false positive # If we have nova api db populated , it is OK , placement db is not required still in rocky su nova -s /bin/sh -c "nova-manage api_db sync 2>/dev/null" || true -- GitLab From d9d061e26a2144d51f398445add42e2453d7bc09 Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Tue, 25 Sep 2018 07:34:10 +0000 Subject: [PATCH 12/19] Add deletion of pychache in dh_clean --- debian/rules | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/rules b/debian/rules index 6ddda0a8a9..1cf7af4a7a 100755 --- a/debian/rules +++ b/debian/rules @@ -20,6 +20,7 @@ override_dh_auto_clean: rm -rf .testrepository subunit.log instances keys rm -rf debian/bla rm -f debian/nova-api.templates debian/nova-common.templates + find . -type d -name __pycache__ -exec rm -r {} \+ override_dh_auto_build: /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func nova-common.config -- GitLab From 0a3e658ec81c6e276eee333f24ab65fbc23b1870 Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Tue, 25 Sep 2018 12:36:17 +0000 Subject: [PATCH 13/19] Add db to pkgos-merge-templates --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index 1cf7af4a7a..ad7b0998b1 100755 --- a/debian/rules +++ b/debian/rules @@ -32,7 +32,7 @@ override_dh_auto_build: /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_postrm nova-common.postrm pkgos-merge-templates nova-api nova endpoint pkgos-merge-templates nova-common nova db rabbit ksat - pkgos-merge-templates nova-placement-api nova-placement-api endpoint + pkgos-merge-templates nova-placement-api nova-placement-api endpoint db override_dh_sphinxdoc: ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS))) -- GitLab From 4e3586bc51e2aa94fd9f33215429145b6a680936 Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Tue, 25 Sep 2018 12:36:39 +0000 Subject: [PATCH 14/19] Remove d/nova-placement-api.templates.in --- debian/nova-placement-api.templates.in | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 debian/nova-placement-api.templates.in diff --git a/debian/nova-placement-api.templates.in b/debian/nova-placement-api.templates.in deleted file mode 100644 index d3d9d3860a..0000000000 --- a/debian/nova-placement-api.templates.in +++ /dev/null @@ -1,19 +0,0 @@ -Template: placement/configure_db -Type: boolean -Default: false -_Description: Set up a database for Nova Placement API? - No database has been set up for Nova Placement to use. If you want - to set one up now, please make sure you have all needed - information: - . - * the host name of the database server (which must allow TCP - connections from this machine); - * a username and password to access the database; - * the type of database management software you want to use. - . - If you don't choose this option, no database will be set up and Nova - will use regular SQLite support. - . - You can change this setting later on by running "dpkg-reconfigure - -plow nova-placement-api". - -- GitLab From 13b0bcfac276bf8355e29e33feffbaaa894fe77b Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Tue, 25 Sep 2018 13:47:11 +0000 Subject: [PATCH 15/19] Edit print info in prerm --- debian/nova-common.prerm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/nova-common.prerm b/debian/nova-common.prerm index 50a644bb5b..13ca07cce4 100755 --- a/debian/nova-common.prerm +++ b/debian/nova-common.prerm @@ -27,7 +27,7 @@ remove_cell0_database (){ mysql_app_user=$(echo $mysql_app_user_complete) fi # Drop nova_cell0 database - echo "===> nova-common: Dumping ${mysql_nova_db_name}_cell0 database:" + echo "===> nova-common: Dumping ${mysql_nova_db_name}_cell0 database to /var/tmp/${mysql_nova_db_name}_cell0.${dump_timestamp}.mysql" mysqldump -h $mysql_host -u $mysql_admin_user -p$mysql_admin_pass ${mysql_nova_db_name}_cell0 > /var/tmp/${mysql_nova_db_name}_cell0.${dump_timestamp}.mysql echo "===> nova-common: Revoking all privileges from ${mysql_app_user} for ${mysql_nova_db_name}_cell0" echo "REVOKE ALL PRIVILEGES ON ${mysql_nova_db_name}_cell0.* FROM ${mysql_app_user};" | mysql -h $mysql_host -u $mysql_admin_user -p$mysql_admin_pass -- GitLab From 86918108d2dc18ae289005c26b8c8a39a9b8ddec Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Tue, 25 Sep 2018 13:48:59 +0000 Subject: [PATCH 16/19] Edit path where dumping --- debian/nova-common.prerm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/nova-common.prerm b/debian/nova-common.prerm index 13ca07cce4..09c921e480 100755 --- a/debian/nova-common.prerm +++ b/debian/nova-common.prerm @@ -27,8 +27,8 @@ remove_cell0_database (){ mysql_app_user=$(echo $mysql_app_user_complete) fi # Drop nova_cell0 database - echo "===> nova-common: Dumping ${mysql_nova_db_name}_cell0 database to /var/tmp/${mysql_nova_db_name}_cell0.${dump_timestamp}.mysql" - mysqldump -h $mysql_host -u $mysql_admin_user -p$mysql_admin_pass ${mysql_nova_db_name}_cell0 > /var/tmp/${mysql_nova_db_name}_cell0.${dump_timestamp}.mysql + echo "===> nova-common: Dumping ${mysql_nova_db_name}_cell0 database to /var/tmp/nova-common.${mysql_nova_db_name}_cell0.${dump_timestamp}.mysql" + mysqldump -h $mysql_host -u $mysql_admin_user -p$mysql_admin_pass ${mysql_nova_db_name}_cell0 > /var/tmp/nova-common.${mysql_nova_db_name}_cell0.${dump_timestamp}.mysql echo "===> nova-common: Revoking all privileges from ${mysql_app_user} for ${mysql_nova_db_name}_cell0" echo "REVOKE ALL PRIVILEGES ON ${mysql_nova_db_name}_cell0.* FROM ${mysql_app_user};" | mysql -h $mysql_host -u $mysql_admin_user -p$mysql_admin_pass echo "===> nova-common: Droping database ${mysql_nova_db_name}_cell0" -- GitLab From c572893b76b48ed1e6e72a079bf6cb057560efde Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Wed, 26 Sep 2018 12:49:14 +0000 Subject: [PATCH 17/19] Rewrite variables to use dbc_ variables --- debian/nova-common.postinst.in | 39 +++++----------------------- debian/nova-common.prerm | 46 +++++++--------------------------- 2 files changed, 15 insertions(+), 70 deletions(-) diff --git a/debian/nova-common.postinst.in b/debian/nova-common.postinst.in index 8838bbb84d..ddd86e8518 100755 --- a/debian/nova-common.postinst.in +++ b/debian/nova-common.postinst.in @@ -67,41 +67,14 @@ run_db_sync (){ } create_cell0_database (){ - db_get nova-common/dbconfig-install - if [ "$RET" = "true" ]; then - db_get nova-common/database-type - if [ "$RET" = "mysql" ]; then - # We need to know admin connection details - db_get nova-common/remote/host - mysql_host=$RET - db_get nova-common/mysql/admin-user - mysql_admin_user=$RET - db_get nova-common/mysql/admin-pass - mysql_admin_pass=$RET - db_get nova-common/db/dbname - mysql_nova_db_name=$RET - # We need to know mysql user which have grants to nova db - db_get nova-common/db/app-user - mysql_app_user_complete=$RET - if echo $mysql_app_user_complete | egrep @ > /dev/null; then - mysql_app_username=$(echo $mysql_app_user_complete | cut -d@ -f1) - mysql_app_user_domain=$(echo $mysql_app_user_complete | cut -d@ -f2) - mysql_app_user=$(echo "'$mysql_app_username'@'$mysql_app_user_domain'") - else - mysql_app_user=$(echo $mysql_app_user_complete) - fi + if [ "${dbc_install}" = "true" ] ; then + if [ "${dbc_dbtype}" = "mysql" ]; then # Create nova_cell0 database - echo "===> nova-common: Creating ${mysql_nova_db_name}_cell0 database:" - echo "CREATE DATABASE IF NOT EXISTS ${mysql_nova_db_name}_cell0 CHARACTER SET utf8 COLLATE utf8_unicode_ci;" | mysql -h $mysql_host -u $mysql_admin_user -p$mysql_admin_pass - echo "===> nova-common: Granting permissions on ${mysql_nova_db_name}_cell0.* to ${mysql_app_user}" - echo "GRANT ALL PRIVILEGES ON ${mysql_nova_db_name}_cell0.* TO ${mysql_app_user};" | mysql -h $mysql_host -u $mysql_admin_user -p$mysql_admin_pass + echo "===> nova-common: Creating ${dbc_dbname}_cell0 database:" + echo "CREATE DATABASE IF NOT EXISTS ${dbc_dbname}_cell0 CHARACTER SET utf8 COLLATE utf8_unicode_ci;" | mysql -h ${dbc_dbserver} -u ${dbc_dbadmin} -p${dbc_dbadmpass} + echo "===> nova-common: Granting permissions on ${dbc_dbname}_cell0.* to '${dbc_dbuser}'@'${dbc_dballow}'" + echo "GRANT ALL PRIVILEGES ON ${dbc_dbname}_cell0.* TO '${dbc_dbuser}'@'${dbc_dballow}';" | mysql -h ${dbc_dbserver} -u ${dbc_dbadmin} -p${dbc_dbadmpass} elif [ "$RET" = "sqlite3" ]; then - # We need to know path of sqlite3 file - db_get nova-common/db/basepath - sqlite3_base_path=$RET - db_get nova-common/db/dbname - sqlite3_db_name=${RET}_cell0 - sqlite3_file_path=$(echo "$sqlite3_base_path/$sqlite3_db_name") echo "===> nova-common: Creation of database $sqlite3_db_name in sqlite3 is not currently supported. Please create $sqlite3_db_name manually." else echo "===> nova-common: Database configuration available only mysql currently." diff --git a/debian/nova-common.prerm b/debian/nova-common.prerm index 09c921e480..9bfbbcb829 100755 --- a/debian/nova-common.prerm +++ b/debian/nova-common.prerm @@ -4,43 +4,16 @@ set -e remove_cell0_database (){ dump_timestamp=$(date +"%Y-%m-%d-%H-%M-%S") - db_get nova-common/database-type - nova_database_type=$RET - if [ "$nova_database_type" = "mysql" ]; then - # We need to know admin connection details - db_get nova-common/remote/host - mysql_host=$RET - db_get nova-common/mysql/admin-user - mysql_admin_user=$RET - db_get nova-common/mysql/admin-pass - mysql_admin_pass=$RET - db_get nova-common/db/dbname - mysql_nova_db_name=$RET - # We need to know mysql user which have grants to nova db - db_get nova-common/db/app-user - mysql_app_user_complete=$RET - if echo $mysql_app_user_complete | egrep @ > /dev/null; then - mysql_app_username=$(echo $mysql_app_user_complete | cut -d@ -f1) - mysql_app_user_domain=$(echo $mysql_app_user_complete | cut -d@ -f2) - mysql_app_user=$(echo "'$mysql_app_username'@'$mysql_app_user_domain'") - else - mysql_app_user=$(echo $mysql_app_user_complete) - fi + if [ "${dbc_dbtype}" = "mysql" ]; then # Drop nova_cell0 database - echo "===> nova-common: Dumping ${mysql_nova_db_name}_cell0 database to /var/tmp/nova-common.${mysql_nova_db_name}_cell0.${dump_timestamp}.mysql" - mysqldump -h $mysql_host -u $mysql_admin_user -p$mysql_admin_pass ${mysql_nova_db_name}_cell0 > /var/tmp/nova-common.${mysql_nova_db_name}_cell0.${dump_timestamp}.mysql - echo "===> nova-common: Revoking all privileges from ${mysql_app_user} for ${mysql_nova_db_name}_cell0" - echo "REVOKE ALL PRIVILEGES ON ${mysql_nova_db_name}_cell0.* FROM ${mysql_app_user};" | mysql -h $mysql_host -u $mysql_admin_user -p$mysql_admin_pass - echo "===> nova-common: Droping database ${mysql_nova_db_name}_cell0" - echo "DROP DATABASE ${mysql_nova_db_name}_cell0" | mysql -h $mysql_host -u $mysql_admin_user -p$mysql_admin_pass + echo "===> nova-common: Dumping ${dbc_dbname}_cell0 database to /var/tmp/nova-common.${dbc_dbname}_cell0.${dump_timestamp}.mysql" + mysqldump -h ${dbc_dbserver} -u ${dbc_dbadmin} -p${dbc_dbadmpass} ${dbc_dbname}_cell0 > /var/tmp/nova-common.${dbc_dbname}_cell0.${dump_timestamp}.mysql + echo "===> nova-common: Revoking all privileges from '${dbc_dbuser}'@'${dbc_dballow}' for ${dbc_dbname}_cell0" + echo "REVOKE ALL PRIVILEGES ON ${dbc_dbname}_cell0.* FROM ${dbc_dbuser};" | mysql -h ${dbc_dbserver} -u ${dbc_dbadmin} -p${dbc_dbadmpass} + echo "===> nova-common: Droping database ${dbc_dbname}_cell0" + echo "DROP DATABASE ${dbc_dbname}_cell0" | mysql -h ${dbc_dbserver} -u ${dbc_dbadmin} -p${dbc_dbadmpass} elif [ "$nova_database_type" = "sqlite3" ]; then - # We need to know path of sqlite3 file - db_get nova-common/db/basepath - sqlite3_base_path=$RET - db_get nova-common/db/dbname - sqlite3_db_name=${RET}_cell0 - sqlite3_file_path=$(echo "$sqlite3_base_path/$sqlite3_db_name") - echo "===> nova-common: Creation of database $sqlite3_db_name in sqlite3 is not currently supported. If you've created manually, delete also manyally." + echo "===> nova-common: Creation of database $sqlite3_db_name in sqlite3 is not currently supported. If you've created manually, delete also manually." else echo "===> nova-common: Database configuration available only for mysql currently." fi @@ -52,8 +25,7 @@ if [ "${1}" = "remove" ] && [ -r /usr/share/debconf/confmodule ] && [ -r /usr/sh if [ "$RET" = "true" ] ; then . /usr/share/dbconfig-common/dpkg/prerm dbc_go nova-common $@ - db_get nova-common/dbconfig-remove - if [ "$RET" = "true" ]; then + if [ "$dbc_remove" = "true" ]; then remove_cell0_database fi fi -- GitLab From 3a534763de72c2c493e044a82a5877f2d9da2ace Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Wed, 26 Sep 2018 13:15:10 +0000 Subject: [PATCH 18/19] Fix revoke privileges --- debian/nova-common.postinst.in | 4 ++-- debian/nova-common.prerm | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/debian/nova-common.postinst.in b/debian/nova-common.postinst.in index ddd86e8518..e2bff9030e 100755 --- a/debian/nova-common.postinst.in +++ b/debian/nova-common.postinst.in @@ -75,9 +75,9 @@ create_cell0_database (){ echo "===> nova-common: Granting permissions on ${dbc_dbname}_cell0.* to '${dbc_dbuser}'@'${dbc_dballow}'" echo "GRANT ALL PRIVILEGES ON ${dbc_dbname}_cell0.* TO '${dbc_dbuser}'@'${dbc_dballow}';" | mysql -h ${dbc_dbserver} -u ${dbc_dbadmin} -p${dbc_dbadmpass} elif [ "$RET" = "sqlite3" ]; then - echo "===> nova-common: Creation of database $sqlite3_db_name in sqlite3 is not currently supported. Please create $sqlite3_db_name manually." + echo "===> nova-common: Creation of database $sqlite3_db_name in sqlite3 is not currently supported. Please create database manually." else - echo "===> nova-common: Database configuration available only mysql currently." + echo "===> nova-common: Database configuration available only mysql currently. Please, create database manually." fi fi } diff --git a/debian/nova-common.prerm b/debian/nova-common.prerm index 9bfbbcb829..fa946271c0 100755 --- a/debian/nova-common.prerm +++ b/debian/nova-common.prerm @@ -9,13 +9,13 @@ remove_cell0_database (){ echo "===> nova-common: Dumping ${dbc_dbname}_cell0 database to /var/tmp/nova-common.${dbc_dbname}_cell0.${dump_timestamp}.mysql" mysqldump -h ${dbc_dbserver} -u ${dbc_dbadmin} -p${dbc_dbadmpass} ${dbc_dbname}_cell0 > /var/tmp/nova-common.${dbc_dbname}_cell0.${dump_timestamp}.mysql echo "===> nova-common: Revoking all privileges from '${dbc_dbuser}'@'${dbc_dballow}' for ${dbc_dbname}_cell0" - echo "REVOKE ALL PRIVILEGES ON ${dbc_dbname}_cell0.* FROM ${dbc_dbuser};" | mysql -h ${dbc_dbserver} -u ${dbc_dbadmin} -p${dbc_dbadmpass} + echo "REVOKE ALL PRIVILEGES ON ${dbc_dbname}_cell0.* FROM '${dbc_dbuser}'@'${dbc_dballow}';" | mysql -h ${dbc_dbserver} -u ${dbc_dbadmin} -p${dbc_dbadmpass} echo "===> nova-common: Droping database ${dbc_dbname}_cell0" echo "DROP DATABASE ${dbc_dbname}_cell0" | mysql -h ${dbc_dbserver} -u ${dbc_dbadmin} -p${dbc_dbadmpass} elif [ "$nova_database_type" = "sqlite3" ]; then - echo "===> nova-common: Creation of database $sqlite3_db_name in sqlite3 is not currently supported. If you've created manually, delete also manually." + echo "===> nova-common: Creation of database in sqlite3 is not currently supported. If you've created manually, delete also manually." else - echo "===> nova-common: Database configuration available only for mysql currently." + echo "===> nova-common: Database configuration available only for mysql currently. If you've created database manually, delete also manually." fi } -- GitLab From 86a7609f297043563f31f424474afca16d413e47 Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Wed, 26 Sep 2018 14:00:33 +0000 Subject: [PATCH 19/19] Releasing to unstable --- debian/changelog | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4322eda3ab..0f270c9574 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,38 @@ -nova (2:18.0.1-2) UNRELEASED; urgency=medium +nova (2:18.0.1-2) unstable; urgency=medium [ Michal Arbet ] + * d/nova-api-postinst.in: + - Add calling nova-common's trigger nova-common-db-sync + * - Add calling "nova-manage cell_v2 map_cell0" + * - Add calling "nova-manage cell_v2 create_cell --name=cell1" + * d/nova-api.postrm: + - Redesigned to nova-api.postrm.in + * d/nova-api.prerm: + - Add deletion of nova_api database + * d/nova-common.postinst.in + - Add function run_db_sync + - Add function create_cell0_database if configured + via dbconfig-common + - Changed postinst to call create_cell0_database + and after that run_db_sync + - Add if clause triggered which calls nova-common-db-sync * d/nova-common.postrm.in: - Add deletion of /etc/nova/placement-policy.json (Closes: #909115) - - -- Michal Arbet Tue, 18 Sep 2018 18:41:15 +0200 + - Add deletion of nova_cell0 database if configured + * d/nova-common.triggers: + - Add nova-common-db-sync trigger + * d/nova-placement-api.config.in + - Add creation of placement db which is currently not required + in rocky, but now it is possible to do it with dbconfig-common + * d/nova-placement-api.postrm.in + - Add purging dbc config + * d/nova-placement-api.prerm + - Add deletion of placement database + * d/rules: + - Add deletion of __pychache__ in dh_clean + - Add pkgos-merge-templates of nova-placement-api + + -- Michal Arbet Wed, 26 Sep 2018 15:59:53 +0200 nova (2:18.0.1-1) unstable; urgency=medium -- GitLab