From 4035508b7714436385fc4545c82d5cadb29e51d9 Mon Sep 17 00:00:00 2001 From: zhipengl Date: Wed, 28 Nov 2018 01:41:21 +0800 Subject: [PATCH] Refactor patches for openstack-aodh package Use openstack-aodh-config package to package service and script files for openstack-aodh package. Deployment test pass and service/script file check pass. Story: 2003768 Task: 28044 Depends-on: https://review.openstack.org/#/c/620258/ Change-Id: I6cc7fd555fad2dc9278d15646fbd6811ba614d00 Signed-off-by: zhipengl --- centos_iso_image.inc | 1 + centos_pkg_dirs | 1 + .../centos/build_srpm.data | 2 + .../centos/openstack-aodh-config.spec | 51 ++++ .../files/aodh-expirer-active | 61 +++++ .../files/openstack-aodh-api.service | 11 + .../files/openstack-aodh-evaluator.service | 11 + .../files/openstack-aodh-expirer.service | 11 + .../files/openstack-aodh-listener.service | 11 + .../files/openstack-aodh-notifier.service | 11 + .../openstack-aodh/centos/build_srpm.data | 2 +- ...files-and-create-expirer-cron-script.patch | 226 ------------------ ...te-package-versioning-for-TIS-format.patch | 11 +- .../0001-meta-modify-aodh-api.patch | 69 ------ .../0001-meta-pass-aodh-api-config.patch | 25 -- .../0006-add-drivername-for-postgresql.patch | 32 --- .../centos/meta_patches/PATCH_ORDER | 6 +- .../meta-remove-default-logrotate.patch | 42 ---- .../spec-include-TiS-patches.patch | 75 ++++++ 19 files changed, 253 insertions(+), 406 deletions(-) create mode 100644 openstack/openstack-aodh-config/centos/build_srpm.data create mode 100644 openstack/openstack-aodh-config/centos/openstack-aodh-config.spec create mode 100644 openstack/openstack-aodh-config/files/aodh-expirer-active create mode 100644 openstack/openstack-aodh-config/files/openstack-aodh-api.service create mode 100644 openstack/openstack-aodh-config/files/openstack-aodh-evaluator.service create mode 100644 openstack/openstack-aodh-config/files/openstack-aodh-expirer.service create mode 100644 openstack/openstack-aodh-config/files/openstack-aodh-listener.service create mode 100644 openstack/openstack-aodh-config/files/openstack-aodh-notifier.service delete mode 100644 openstack/openstack-aodh/centos/meta_patches/0001-Modify-service-files-and-create-expirer-cron-script.patch delete mode 100644 openstack/openstack-aodh/centos/meta_patches/0001-meta-modify-aodh-api.patch delete mode 100644 openstack/openstack-aodh/centos/meta_patches/0001-meta-pass-aodh-api-config.patch delete mode 100644 openstack/openstack-aodh/centos/meta_patches/0006-add-drivername-for-postgresql.patch delete mode 100644 openstack/openstack-aodh/centos/meta_patches/meta-remove-default-logrotate.patch create mode 100644 openstack/openstack-aodh/centos/meta_patches/spec-include-TiS-patches.patch diff --git a/centos_iso_image.inc b/centos_iso_image.inc index fb3b9c9c..91662d64 100644 --- a/centos_iso_image.inc +++ b/centos_iso_image.inc @@ -154,6 +154,7 @@ openstack-aodh-evaluator openstack-aodh-notifier openstack-aodh-listener openstack-aodh-expirer +openstack-aodh-config # openstack-panko python-panko diff --git a/centos_pkg_dirs b/centos_pkg_dirs index 55b5bd18..ca0003ea 100644 --- a/centos_pkg_dirs +++ b/centos_pkg_dirs @@ -1,4 +1,5 @@ openstack/openstack-aodh +openstack/openstack-aodh-config openstack/openstack-murano openstack/python-muranoclient openstack/openstack-murano-ui diff --git a/openstack/openstack-aodh-config/centos/build_srpm.data b/openstack/openstack-aodh-config/centos/build_srpm.data new file mode 100644 index 00000000..da1e20bd --- /dev/null +++ b/openstack/openstack-aodh-config/centos/build_srpm.data @@ -0,0 +1,2 @@ +SRC_DIR="files" +TIS_PATCH_VER=0 diff --git a/openstack/openstack-aodh-config/centos/openstack-aodh-config.spec b/openstack/openstack-aodh-config/centos/openstack-aodh-config.spec new file mode 100644 index 00000000..d1d0f9e7 --- /dev/null +++ b/openstack/openstack-aodh-config/centos/openstack-aodh-config.spec @@ -0,0 +1,51 @@ +Summary: openstack-aodh-config +Name: openstack-aodh-config +Version: 1.0 +Release: %{tis_patch_ver}%{?_tis_dist} +License: Apache-2.0 +Group: openstack +Packager: StarlingX +URL: unknown +BuildArch: noarch +Source: %name-%version.tar.gz + +Requires: openstack-aodh-common +Requires: openstack-aodh-api +Requires: openstack-aodh-evaluator +Requires: openstack-aodh-notifier +Requires: openstack-aodh-expirer +Requires: openstack-aodh-listener + +Summary: package StarlingX configuration files of openstack-aodh to system folder. + +%description +package StarlingX configuration files of openstack-aodh to system folder. + +%prep +%setup + +%build + +%install +%{__install} -d %{buildroot}%{_sysconfdir}/systemd/system +%{__install} -d %{buildroot}%{_bindir} + +%{__install} -m 0644 openstack-aodh-api.service %{buildroot}%{_sysconfdir}/systemd/system/openstack-aodh-api.service +%{__install} -m 0644 openstack-aodh-evaluator.service %{buildroot}%{_sysconfdir}/systemd/system/openstack-aodh-evaluator.service +%{__install} -m 0644 openstack-aodh-expirer.service %{buildroot}%{_sysconfdir}/systemd/system/openstack-aodh-expirer.service +%{__install} -m 0644 openstack-aodh-listener.service %{buildroot}%{_sysconfdir}/systemd/system/openstack-aodh-listener.service +%{__install} -m 0644 openstack-aodh-notifier.service %{buildroot}%{_sysconfdir}/systemd/system/openstack-aodh-notifier.service +%{__install} -m 0750 aodh-expirer-active %{buildroot}%{_bindir}/aodh-expirer-active + +%post +if test -s %{_sysconfdir}/logrotate.d/openstack-aodh ; then + echo '#See /etc/logrotate.d/syslog for aodh rules' > %{_sysconfdir}/logrotate.d/openstack-aodh +fi + +%files +%{_sysconfdir}/systemd/system/openstack-aodh-api.service +%{_sysconfdir}/systemd/system/openstack-aodh-evaluator.service +%{_sysconfdir}/systemd/system/openstack-aodh-expirer.service +%{_sysconfdir}/systemd/system/openstack-aodh-listener.service +%{_sysconfdir}/systemd/system/openstack-aodh-notifier.service +%{_bindir}/aodh-expirer-active diff --git a/openstack/openstack-aodh-config/files/aodh-expirer-active b/openstack/openstack-aodh-config/files/aodh-expirer-active new file mode 100644 index 00000000..796a6944 --- /dev/null +++ b/openstack/openstack-aodh-config/files/aodh-expirer-active @@ -0,0 +1,61 @@ +#!/bin/bash + +# +# Wrapper script to run aodh-expirer when on active controller only +# +AODH_EXPIRER_INFO="/var/run/aodh-expirer.info" +AODH_EXPIRER_CMD="/usr/bin/nice -n 2 /usr/bin/aodh-expirer" + +function is_active_pgserver() +{ + # Determine whether we're running on the same controller as the service. + local service=postgres + local enabledactive=$(/usr/bin/sm-query service $service| grep enabled-active) + if [ "x$enabledactive" == "x" ] + then + # enabled-active not found for that service on this controller + return 1 + else + # enabled-active found for that resource + return 0 + fi +} + +if is_active_pgserver +then + if [ ! -f ${AODH_EXPIRER_INFO} ] + then + echo delay_count=0 > ${AODH_EXPIRER_INFO} + fi + + source ${AODH_EXPIRER_INFO} + sudo -u postgres psql -d sysinv -c "SELECT alarm_id, entity_instance_id from i_alarm;" | grep -P "^(?=.*100.101)(?=.*${HOSTNAME})" &>/dev/null + if [ $? -eq 0 ] + then + source /etc/platform/platform.conf + if [ "${system_type}" = "All-in-one" ] + then + source /etc/init.d/task_affinity_functions.sh + idle_core=$(get_most_idle_core) + if [ "$idle_core" -ne "0" ] + then + sh -c "exec taskset -c $idle_core ${AODH_EXPIRER_CMD}" + sed -i "/delay_count/s/=.*/=0/" ${AODH_EXPIRER_INFO} + exit 0 + fi + fi + + if [ "$delay_count" -lt "3" ] + then + newval=$(($delay_count+1)) + sed -i "/delay_count/s/=.*/=$newval/" ${AODH_EXPIRER_INFO} + (sleep 3600; /usr/bin/aodh-expirer-active) & + exit 0 + fi + fi + + eval ${AODH_EXPIRER_CMD} + sed -i "/delay_count/s/=.*/=0/" ${AODH_EXPIRER_INFO} +fi + +exit 0 diff --git a/openstack/openstack-aodh-config/files/openstack-aodh-api.service b/openstack/openstack-aodh-config/files/openstack-aodh-api.service new file mode 100644 index 00000000..d75ccc01 --- /dev/null +++ b/openstack/openstack-aodh-config/files/openstack-aodh-api.service @@ -0,0 +1,11 @@ +[Unit] +Description=OpenStack Alarm API service +After=syslog.target network.target + +[Service] +Type=simple +User=root +ExecStart=/bin/python /usr/bin/gunicorn --config /usr/share/aodh/aodh-api.conf --pythonpath /usr/share/aodh aodh-api + +[Install] +WantedBy=multi-user.target diff --git a/openstack/openstack-aodh-config/files/openstack-aodh-evaluator.service b/openstack/openstack-aodh-config/files/openstack-aodh-evaluator.service new file mode 100644 index 00000000..2f88561a --- /dev/null +++ b/openstack/openstack-aodh-config/files/openstack-aodh-evaluator.service @@ -0,0 +1,11 @@ +[Unit] +Description=OpenStack Alarm evaluator service +After=syslog.target network.target + +[Service] +Type=simple +User=root +ExecStart=/usr/bin/aodh-evaluator + +[Install] +WantedBy=multi-user.target diff --git a/openstack/openstack-aodh-config/files/openstack-aodh-expirer.service b/openstack/openstack-aodh-config/files/openstack-aodh-expirer.service new file mode 100644 index 00000000..735f3b64 --- /dev/null +++ b/openstack/openstack-aodh-config/files/openstack-aodh-expirer.service @@ -0,0 +1,11 @@ +[Unit] +Description=OpenStack Alarm expirer service +After=syslog.target network.target + +[Service] +Type=simple +User=root +ExecStart=/usr/bin/aodh-expirer + +[Install] +WantedBy=multi-user.target diff --git a/openstack/openstack-aodh-config/files/openstack-aodh-listener.service b/openstack/openstack-aodh-config/files/openstack-aodh-listener.service new file mode 100644 index 00000000..dd51d42f --- /dev/null +++ b/openstack/openstack-aodh-config/files/openstack-aodh-listener.service @@ -0,0 +1,11 @@ +[Unit] +Description=OpenStack Alarm listener service +After=syslog.target network.target + +[Service] +Type=simple +User=root +ExecStart=/usr/bin/aodh-listener + +[Install] +WantedBy=multi-user.target diff --git a/openstack/openstack-aodh-config/files/openstack-aodh-notifier.service b/openstack/openstack-aodh-config/files/openstack-aodh-notifier.service new file mode 100644 index 00000000..5c4691fc --- /dev/null +++ b/openstack/openstack-aodh-config/files/openstack-aodh-notifier.service @@ -0,0 +1,11 @@ +[Unit] +Description=OpenStack Alarm notifier service +After=syslog.target network.target + +[Service] +Type=simple +User=root +ExecStart=/usr/bin/aodh-notifier + +[Install] +WantedBy=multi-user.target diff --git a/openstack/openstack-aodh/centos/build_srpm.data b/openstack/openstack-aodh/centos/build_srpm.data index 8429863c..c66bf348 100644 --- a/openstack/openstack-aodh/centos/build_srpm.data +++ b/openstack/openstack-aodh/centos/build_srpm.data @@ -1 +1 @@ -TIS_PATCH_VER=6 +TIS_PATCH_VER=7 diff --git a/openstack/openstack-aodh/centos/meta_patches/0001-Modify-service-files-and-create-expirer-cron-script.patch b/openstack/openstack-aodh/centos/meta_patches/0001-Modify-service-files-and-create-expirer-cron-script.patch deleted file mode 100644 index 05482cfb..00000000 --- a/openstack/openstack-aodh/centos/meta_patches/0001-Modify-service-files-and-create-expirer-cron-script.patch +++ /dev/null @@ -1,226 +0,0 @@ -From a3e86bdcd7a9507b7271c70aba5f9ac67ee6cdb6 Mon Sep 17 00:00:00 2001 -From: Scott Little -Date: Mon, 2 Oct 2017 14:28:46 -0400 -Subject: [PATCH 1/6] WRS: - 0001-Modify-service-files-and-create-expirer-cron-script.patch - -Conflicts: - SPECS/openstack-aodh.spec ---- - SOURCES/aodh-expirer-active | 61 ++++++++++++++++++++++++++++++++ - SOURCES/openstack-aodh-api.service | 5 ++- - SOURCES/openstack-aodh-evaluator.service | 5 ++- - SOURCES/openstack-aodh-expirer.service | 5 ++- - SOURCES/openstack-aodh-listener.service | 5 ++- - SOURCES/openstack-aodh-notifier.service | 5 ++- - SPECS/openstack-aodh.spec | 11 ++++-- - 7 files changed, 80 insertions(+), 17 deletions(-) - create mode 100644 SOURCES/aodh-expirer-active - -diff --git a/SOURCES/aodh-expirer-active b/SOURCES/aodh-expirer-active -new file mode 100644 -index 0000000..796a694 ---- /dev/null -+++ b/SOURCES/aodh-expirer-active -@@ -0,0 +1,61 @@ -+#!/bin/bash -+ -+# -+# Wrapper script to run aodh-expirer when on active controller only -+# -+AODH_EXPIRER_INFO="/var/run/aodh-expirer.info" -+AODH_EXPIRER_CMD="/usr/bin/nice -n 2 /usr/bin/aodh-expirer" -+ -+function is_active_pgserver() -+{ -+ # Determine whether we're running on the same controller as the service. -+ local service=postgres -+ local enabledactive=$(/usr/bin/sm-query service $service| grep enabled-active) -+ if [ "x$enabledactive" == "x" ] -+ then -+ # enabled-active not found for that service on this controller -+ return 1 -+ else -+ # enabled-active found for that resource -+ return 0 -+ fi -+} -+ -+if is_active_pgserver -+then -+ if [ ! -f ${AODH_EXPIRER_INFO} ] -+ then -+ echo delay_count=0 > ${AODH_EXPIRER_INFO} -+ fi -+ -+ source ${AODH_EXPIRER_INFO} -+ sudo -u postgres psql -d sysinv -c "SELECT alarm_id, entity_instance_id from i_alarm;" | grep -P "^(?=.*100.101)(?=.*${HOSTNAME})" &>/dev/null -+ if [ $? -eq 0 ] -+ then -+ source /etc/platform/platform.conf -+ if [ "${system_type}" = "All-in-one" ] -+ then -+ source /etc/init.d/task_affinity_functions.sh -+ idle_core=$(get_most_idle_core) -+ if [ "$idle_core" -ne "0" ] -+ then -+ sh -c "exec taskset -c $idle_core ${AODH_EXPIRER_CMD}" -+ sed -i "/delay_count/s/=.*/=0/" ${AODH_EXPIRER_INFO} -+ exit 0 -+ fi -+ fi -+ -+ if [ "$delay_count" -lt "3" ] -+ then -+ newval=$(($delay_count+1)) -+ sed -i "/delay_count/s/=.*/=$newval/" ${AODH_EXPIRER_INFO} -+ (sleep 3600; /usr/bin/aodh-expirer-active) & -+ exit 0 -+ fi -+ fi -+ -+ eval ${AODH_EXPIRER_CMD} -+ sed -i "/delay_count/s/=.*/=0/" ${AODH_EXPIRER_INFO} -+fi -+ -+exit 0 -diff --git a/SOURCES/openstack-aodh-api.service b/SOURCES/openstack-aodh-api.service -index 29db382..b8b2921 100644 ---- a/SOURCES/openstack-aodh-api.service -+++ b/SOURCES/openstack-aodh-api.service -@@ -4,9 +4,8 @@ After=syslog.target network.target - - [Service] - Type=simple --User=aodh --ExecStart=/usr/bin/aodh-api -- --logfile /var/log/aodh/api.log --Restart=on-failure -+User=root -+ExecStart=/usr/bin/aodh-api - - [Install] - WantedBy=multi-user.target -diff --git a/SOURCES/openstack-aodh-evaluator.service b/SOURCES/openstack-aodh-evaluator.service -index 4f70431..795ef0c 100644 ---- a/SOURCES/openstack-aodh-evaluator.service -+++ b/SOURCES/openstack-aodh-evaluator.service -@@ -4,9 +4,8 @@ After=syslog.target network.target - - [Service] - Type=simple --User=aodh --ExecStart=/usr/bin/aodh-evaluator --logfile /var/log/aodh/evaluator.log --Restart=on-failure -+User=root -+ExecStart=/usr/bin/aodh-evaluator - - [Install] - WantedBy=multi-user.target -diff --git a/SOURCES/openstack-aodh-expirer.service b/SOURCES/openstack-aodh-expirer.service -index cc68b1b..0185d63 100644 ---- a/SOURCES/openstack-aodh-expirer.service -+++ b/SOURCES/openstack-aodh-expirer.service -@@ -4,9 +4,8 @@ After=syslog.target network.target - - [Service] - Type=simple --User=aodh --ExecStart=/usr/bin/aodh-expirer --logfile /var/log/aodh/expirer.log --Restart=on-failure -+User=root -+ExecStart=/usr/bin/aodh-expirer - - [Install] - WantedBy=multi-user.target -diff --git a/SOURCES/openstack-aodh-listener.service b/SOURCES/openstack-aodh-listener.service -index a024fe3..40e20d2 100644 ---- a/SOURCES/openstack-aodh-listener.service -+++ b/SOURCES/openstack-aodh-listener.service -@@ -4,9 +4,8 @@ After=syslog.target network.target - - [Service] - Type=simple --User=aodh --ExecStart=/usr/bin/aodh-listener --logfile /var/log/aodh/listener.log --Restart=on-failure -+User=root -+ExecStart=/usr/bin/aodh-listener - - [Install] - WantedBy=multi-user.target -diff --git a/SOURCES/openstack-aodh-notifier.service b/SOURCES/openstack-aodh-notifier.service -index d6135d7..68a96dd 100644 ---- a/SOURCES/openstack-aodh-notifier.service -+++ b/SOURCES/openstack-aodh-notifier.service -@@ -4,9 +4,8 @@ After=syslog.target network.target - - [Service] - Type=simple --User=aodh --ExecStart=/usr/bin/aodh-notifier --logfile /var/log/aodh/notifier.log --Restart=on-failure -+User=root -+ExecStart=/usr/bin/aodh-notifier - - [Install] - WantedBy=multi-user.target -diff --git a/SPECS/openstack-aodh.spec b/SPECS/openstack-aodh.spec -index 9fffb3c..cac691f 100644 ---- a/SPECS/openstack-aodh.spec -+++ b/SPECS/openstack-aodh.spec -@@ -18,6 +18,9 @@ Source12: %{name}-notifier.service - Source13: %{name}-expirer.service - Source14: %{name}-listener.service - -+#WRS -+Source20: aodh-expirer-active -+ - BuildArch: noarch - - BuildRequires: openstack-macros -@@ -262,7 +265,7 @@ install -p -D -m 640 aodh/api/policy.json %{buildroot}%{_sysconfdir}/aodh/policy - # Setup directories - install -d -m 755 %{buildroot}%{_sharedstatedir}/aodh - install -d -m 755 %{buildroot}%{_sharedstatedir}/aodh/tmp --install -d -m 750 %{buildroot}%{_localstatedir}/log/aodh -+install -d -m 755 %{buildroot}%{_localstatedir}/log/aodh - - # Install logrotate - install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} -@@ -283,6 +286,9 @@ mv %{buildroot}%{python2_sitelib}/%{pypi_name}/locale %{buildroot}%{_datadir}/lo - # Find language files - %find_lang %{pypi_name} --all-name - -+# WRS -+install -p -D -m 750 %{SOURCE20} %{buildroot}%{_bindir}/aodh-expirer-active -+ - # Remove unused files - rm -fr %{buildroot}/usr/etc - -@@ -345,7 +351,6 @@ exit 0 - %config(noreplace) %attr(-, root, aodh) %{_sysconfdir}/aodh/policy.json - %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} - %dir %attr(0750, aodh, root) %{_localstatedir}/log/aodh --%{_bindir}/aodh-dbsync - %{_bindir}/aodh-config-generator - - %defattr(-, aodh, aodh, -) -@@ -353,6 +358,7 @@ exit 0 - %dir %{_sharedstatedir}/aodh/tmp - - %files api -+%{_bindir}/aodh-dbsync - %{_bindir}/aodh-api - %{_unitdir}/%{name}-api.service - -@@ -371,6 +377,7 @@ exit 0 - - %files expirer - %{_bindir}/aodh-expirer -+%{_bindir}/aodh-expirer-active - %{_unitdir}/%{name}-expirer.service - - --- -2.7.4 - diff --git a/openstack/openstack-aodh/centos/meta_patches/0001-Update-package-versioning-for-TIS-format.patch b/openstack/openstack-aodh/centos/meta_patches/0001-Update-package-versioning-for-TIS-format.patch index 9a49df38..501aadc3 100644 --- a/openstack/openstack-aodh/centos/meta_patches/0001-Update-package-versioning-for-TIS-format.patch +++ b/openstack/openstack-aodh/centos/meta_patches/0001-Update-package-versioning-for-TIS-format.patch @@ -3,18 +3,17 @@ From: Scott Little Date: Mon, 2 Oct 2017 14:28:46 -0400 Subject: [PATCH 2/6] WRS: 0001-Update-package-versioning-for-TIS-format.patch -Conflicts: - SPECS/openstack-aodh.spec +Signed-off-by: zhipengl --- SPECS/openstack-aodh.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPECS/openstack-aodh.spec b/SPECS/openstack-aodh.spec -index cac691f..4e626d3 100644 +index 9fffb3c..01615e7 100644 --- a/SPECS/openstack-aodh.spec +++ b/SPECS/openstack-aodh.spec @@ -4,7 +4,7 @@ - + Name: openstack-aodh Version: 5.1.0 -Release: 1%{?dist} @@ -22,6 +21,6 @@ index cac691f..4e626d3 100644 Summary: OpenStack Telemetry Alarming License: ASL 2.0 URL: https://github.com/openstack/aodh.git --- -2.7.4 +-- +1.8.3.1 diff --git a/openstack/openstack-aodh/centos/meta_patches/0001-meta-modify-aodh-api.patch b/openstack/openstack-aodh/centos/meta_patches/0001-meta-modify-aodh-api.patch deleted file mode 100644 index e674fba8..00000000 --- a/openstack/openstack-aodh/centos/meta_patches/0001-meta-modify-aodh-api.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 8620101244ea5be1ff0cc0e127fa57dca4be468a Mon Sep 17 00:00:00 2001 -From: Scott Little -Date: Mon, 2 Oct 2017 14:28:46 -0400 -Subject: [PATCH 4/6] WRS: 0001-meta-modify-aodh-api.patch - -Conflicts: - SPECS/openstack-aodh.spec ---- - SOURCES/openstack-aodh-api.service | 2 +- - SPECS/openstack-aodh.spec | 9 +++++++++ - 2 files changed, 10 insertions(+), 1 deletion(-) - -diff --git a/SOURCES/openstack-aodh-api.service b/SOURCES/openstack-aodh-api.service -index b8b2921..06bcd12 100644 ---- a/SOURCES/openstack-aodh-api.service -+++ b/SOURCES/openstack-aodh-api.service -@@ -5,7 +5,7 @@ After=syslog.target network.target - [Service] - Type=simple - User=root --ExecStart=/usr/bin/aodh-api -+ExecStart=/bin/python /usr/bin/gunicorn --bind 192.168.204.2:8042 --pythonpath /usr/share/aodh aodh-api - - [Install] - WantedBy=multi-user.target -diff --git a/SPECS/openstack-aodh.spec b/SPECS/openstack-aodh.spec -index 8c5722a..4acf6a0 100644 ---- a/SPECS/openstack-aodh.spec -+++ b/SPECS/openstack-aodh.spec -@@ -20,6 +20,9 @@ Source14: %{name}-listener.service - #WRS - Source20: aodh-expirer-active - -+#WRS: Include patches here: -+Patch1: 0001-modify-aodh-api.patch -+ - BuildArch: noarch - - BuildRequires: openstack-macros -@@ -214,6 +217,9 @@ This package contains the Aodh test files. - %prep - %setup -q -n %{pypi_name}-%{upstream_version} - -+#WRS: Apply patches here -+%patch1 -p1 -+ - find . \( -name .gitignore -o -name .placeholder \) -delete - - find aodh -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} + -@@ -260,6 +266,8 @@ install -d -m 755 %{buildroot}%{_sysconfdir}/aodh - install -p -D -m 640 %{SOURCE1} %{buildroot}%{_datadir}/aodh/aodh-dist.conf - install -p -D -m 640 aodh/aodh.conf %{buildroot}%{_sysconfdir}/aodh/aodh.conf - install -p -D -m 640 aodh/api/policy.json %{buildroot}%{_sysconfdir}/aodh/policy.json -+#WRS -+install -p -D -m 640 aodh/api/aodh-api.py %{buildroot}%{_datadir}/aodh/aodh-api.py - - # Setup directories - install -d -m 755 %{buildroot}%{_sharedstatedir}/aodh -@@ -342,6 +350,7 @@ exit 0 - %files common -f %{pypi_name}.lang - %doc README.rst - %dir %{_sysconfdir}/aodh -+%{_datadir}/aodh/aodh-api.* - %attr(-, root, aodh) %{_datadir}/aodh/aodh-dist.conf - %config(noreplace) %attr(-, root, aodh) %{_sysconfdir}/aodh/aodh.conf - %config(noreplace) %attr(-, root, aodh) %{_sysconfdir}/aodh/policy.json --- -2.7.4 - diff --git a/openstack/openstack-aodh/centos/meta_patches/0001-meta-pass-aodh-api-config.patch b/openstack/openstack-aodh/centos/meta_patches/0001-meta-pass-aodh-api-config.patch deleted file mode 100644 index 63e6f388..00000000 --- a/openstack/openstack-aodh/centos/meta_patches/0001-meta-pass-aodh-api-config.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 197df524a7d1dfd278e466257b2e4d6edf0191d1 Mon Sep 17 00:00:00 2001 -From: Scott Little -Date: Mon, 2 Oct 2017 14:28:46 -0400 -Subject: [PATCH 5/6] WRS: 0001-meta-pass-aodh-api-config.patch - ---- - SOURCES/openstack-aodh-api.service | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/SOURCES/openstack-aodh-api.service b/SOURCES/openstack-aodh-api.service -index 06bcd12..a78eb32 100644 ---- a/SOURCES/openstack-aodh-api.service -+++ b/SOURCES/openstack-aodh-api.service -@@ -5,7 +5,7 @@ After=syslog.target network.target - [Service] - Type=simple - User=root --ExecStart=/bin/python /usr/bin/gunicorn --bind 192.168.204.2:8042 --pythonpath /usr/share/aodh aodh-api -+ExecStart=/bin/python /usr/bin/gunicorn --config /usr/share/aodh/aodh-api.conf --pythonpath /usr/share/aodh aodh-api - - [Install] - WantedBy=multi-user.target --- -2.7.4 - diff --git a/openstack/openstack-aodh/centos/meta_patches/0006-add-drivername-for-postgresql.patch b/openstack/openstack-aodh/centos/meta_patches/0006-add-drivername-for-postgresql.patch deleted file mode 100644 index fcf70932..00000000 --- a/openstack/openstack-aodh/centos/meta_patches/0006-add-drivername-for-postgresql.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 4231d626e3b6fccc3535941baa1a5529a1cac192 Mon Sep 17 00:00:00 2001 -From: Al Bailey -Date: Thu, 21 Dec 2017 14:15:48 -0600 -Subject: [PATCH 6/6] add drivername for postgresql - ---- - SPECS/openstack-aodh.spec | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/SPECS/openstack-aodh.spec b/SPECS/openstack-aodh.spec -index 4acf6a0..e258fd3 100644 ---- a/SPECS/openstack-aodh.spec -+++ b/SPECS/openstack-aodh.spec -@@ -22,6 +22,7 @@ Source20: aodh-expirer-active - - #WRS: Include patches here: - Patch1: 0001-modify-aodh-api.patch -+Patch2: 0002-Add-drivername-support-for-postgresql-connection-set.patch - - BuildArch: noarch - -@@ -219,6 +220,7 @@ This package contains the Aodh test files. - - #WRS: Apply patches here - %patch1 -p1 -+%patch2 -p1 - - find . \( -name .gitignore -o -name .placeholder \) -delete - --- -2.7.4 - diff --git a/openstack/openstack-aodh/centos/meta_patches/PATCH_ORDER b/openstack/openstack-aodh/centos/meta_patches/PATCH_ORDER index 020c68d3..6b6d3c42 100644 --- a/openstack/openstack-aodh/centos/meta_patches/PATCH_ORDER +++ b/openstack/openstack-aodh/centos/meta_patches/PATCH_ORDER @@ -1,6 +1,2 @@ -0001-Modify-service-files-and-create-expirer-cron-script.patch 0001-Update-package-versioning-for-TIS-format.patch -meta-remove-default-logrotate.patch -0001-meta-modify-aodh-api.patch -0001-meta-pass-aodh-api-config.patch -0006-add-drivername-for-postgresql.patch +spec-include-TiS-patches.patch diff --git a/openstack/openstack-aodh/centos/meta_patches/meta-remove-default-logrotate.patch b/openstack/openstack-aodh/centos/meta_patches/meta-remove-default-logrotate.patch deleted file mode 100644 index 886bd113..00000000 --- a/openstack/openstack-aodh/centos/meta_patches/meta-remove-default-logrotate.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 760b1b7d60d709d20d54d911b992f0e542088f2a Mon Sep 17 00:00:00 2001 -From: Scott Little -Date: Mon, 2 Oct 2017 14:28:46 -0400 -Subject: [PATCH 3/6] WRS: meta-remove-default-logrotate.patch - ---- - SPECS/openstack-aodh.spec | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/SPECS/openstack-aodh.spec b/SPECS/openstack-aodh.spec -index 4e626d3..8c5722a 100644 ---- a/SPECS/openstack-aodh.spec -+++ b/SPECS/openstack-aodh.spec -@@ -11,7 +11,6 @@ URL: https://github.com/openstack/aodh.git - Source0: https://tarballs.openstack.org/%{pypi_name}/%{pypi_name}-%{upstream_version}.tar.gz - - Source1: %{pypi_name}-dist.conf --Source2: %{pypi_name}.logrotate - Source10: %{name}-api.service - Source11: %{name}-evaluator.service - Source12: %{name}-notifier.service -@@ -267,9 +266,6 @@ install -d -m 755 %{buildroot}%{_sharedstatedir}/aodh - install -d -m 755 %{buildroot}%{_sharedstatedir}/aodh/tmp - install -d -m 755 %{buildroot}%{_localstatedir}/log/aodh - --# Install logrotate --install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} -- - # Install systemd unit services - install -p -D -m 644 %{SOURCE10} %{buildroot}%{_unitdir}/%{name}-api.service - install -p -D -m 644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-evaluator.service -@@ -349,7 +345,6 @@ exit 0 - %attr(-, root, aodh) %{_datadir}/aodh/aodh-dist.conf - %config(noreplace) %attr(-, root, aodh) %{_sysconfdir}/aodh/aodh.conf - %config(noreplace) %attr(-, root, aodh) %{_sysconfdir}/aodh/policy.json --%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} - %dir %attr(0750, aodh, root) %{_localstatedir}/log/aodh - %{_bindir}/aodh-config-generator - --- -2.7.4 - diff --git a/openstack/openstack-aodh/centos/meta_patches/spec-include-TiS-patches.patch b/openstack/openstack-aodh/centos/meta_patches/spec-include-TiS-patches.patch new file mode 100644 index 00000000..2b307a03 --- /dev/null +++ b/openstack/openstack-aodh/centos/meta_patches/spec-include-TiS-patches.patch @@ -0,0 +1,75 @@ +From 8620101244ea5be1ff0cc0e127fa57dca4be468a Mon Sep 17 00:00:00 2001 +From: Scott Little +Date: Mon, 2 Oct 2017 14:28:46 -0400 +Subject: [PATCH] WRS: spec-include-TiS-patches.patch + +Signed-off-by: zhipengl +--- + SPECS/openstack-aodh.spec | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +diff --git a/SPECS/openstack-aodh.spec b/SPECS/openstack-aodh.spec +index 01615e7..f840861 100644 +--- a/SPECS/openstack-aodh.spec ++++ b/SPECS/openstack-aodh.spec +@@ -18,6 +18,9 @@ Source12: %{name}-notifier.service + Source13: %{name}-expirer.service + Source14: %{name}-listener.service + ++#WRS: Include patches here: ++Patch1: 0001-modify-aodh-api.patch ++Patch2: 0002-Add-drivername-support-for-postgresql-connection-set.patch + BuildArch: noarch + + BuildRequires: openstack-macros +@@ -212,6 +215,10 @@ This package contains the Aodh test files. + %prep + %setup -q -n %{pypi_name}-%{upstream_version} + ++#WRS: Apply patches here ++%patch1 -p1 ++%patch2 -p1 ++ + find . \( -name .gitignore -o -name .placeholder \) -delete + + find aodh -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} + +@@ -259,10 +266,12 @@ install -p -D -m 640 %{SOURCE1} %{buildroot}%{_datadir}/aodh/aodh-dist.conf + install -p -D -m 640 aodh/aodh.conf %{buildroot}%{_sysconfdir}/aodh/aodh.conf + install -p -D -m 640 aodh/api/policy.json %{buildroot}%{_sysconfdir}/aodh/policy.json + ++#WRS ++install -p -D -m 640 aodh/api/aodh-api.py %{buildroot}%{_datadir}/aodh/aodh-api.py + # Setup directories + install -d -m 755 %{buildroot}%{_sharedstatedir}/aodh + install -d -m 755 %{buildroot}%{_sharedstatedir}/aodh/tmp +-install -d -m 750 %{buildroot}%{_localstatedir}/log/aodh ++install -d -m 755 %{buildroot}%{_localstatedir}/log/aodh + + # Install logrotate + install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} +@@ -340,12 +349,12 @@ exit 0 + %files common -f %{pypi_name}.lang + %doc README.rst + %dir %{_sysconfdir}/aodh ++%{_datadir}/aodh/aodh-api.* + %attr(-, root, aodh) %{_datadir}/aodh/aodh-dist.conf + %config(noreplace) %attr(-, root, aodh) %{_sysconfdir}/aodh/aodh.conf + %config(noreplace) %attr(-, root, aodh) %{_sysconfdir}/aodh/policy.json + %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +-%dir %attr(0750, aodh, root) %{_localstatedir}/log/aodh +-%{_bindir}/aodh-dbsync ++%dir %attr(0755, aodh, root) %{_localstatedir}/log/aodh + %{_bindir}/aodh-config-generator + + %defattr(-, aodh, aodh, -) +@@ -353,6 +362,7 @@ exit 0 + %dir %{_sharedstatedir}/aodh/tmp + + %files api ++%{_bindir}/aodh-dbsync + %{_bindir}/aodh-api + %{_unitdir}/%{name}-api.service + +-- +2.7.4 +