upgrade openstack-aodh to CentOS 7.5 version

Story: 2003389
Task: 24484

Change-Id: Ib28868c38da6264ca3b05bef6aa5ad7d9b372cf5
Signed-off-by: Hayde Martinez <hayde.martinez.landa@intel.com>
This commit is contained in:
Hayde Martinez 2018-08-30 17:35:24 -05:00 committed by slin14
parent 57ae67d022
commit 748f79bce2
12 changed files with 96 additions and 385 deletions

View File

@ -1,25 +1,25 @@
From 7662bc5ed71f6704ffc90c7ad8ea040e6872e190 Mon Sep 17 00:00:00 2001
From a3e86bdcd7a9507b7271c70aba5f9ac67ee6cdb6 Mon Sep 17 00:00:00 2001
From: Scott Little <scott.little@windriver.com>
Date: Mon, 2 Oct 2017 14:28:46 -0400
Subject: [PATCH 1/5] WRS:
Subject: [PATCH 1/6] WRS:
0001-Modify-service-files-and-create-expirer-cron-script.patch
Conflicts:
SPECS/openstack-aodh.spec
---
SOURCES/aodh-expirer-active | 28 ++++++++++++++++++++++++++++
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 | 25 +++++++++++--------------
7 files changed, 49 insertions(+), 29 deletions(-)
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..373fa5d
index 0000000..796a694
--- /dev/null
+++ b/SOURCES/aodh-expirer-active
@@ -0,0 +1,61 @@
@ -85,7 +85,7 @@ index 0000000..373fa5d
+
+exit 0
diff --git a/SOURCES/openstack-aodh-api.service b/SOURCES/openstack-aodh-api.service
index 2224261..b8b2921 100644
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
@ -93,7 +93,7 @@ index 2224261..b8b2921 100644
[Service]
Type=simple
-User=aodh
-ExecStart=/usr/bin/aodh-api --logfile /var/log/aodh/api.log
-ExecStart=/usr/bin/aodh-api -- --logfile /var/log/aodh/api.log
-Restart=on-failure
+User=root
+ExecStart=/usr/bin/aodh-api
@ -165,10 +165,10 @@ index d6135d7..68a96dd 100644
[Install]
WantedBy=multi-user.target
diff --git a/SPECS/openstack-aodh.spec b/SPECS/openstack-aodh.spec
index 203f2f0..5d0dedd 100644
index 9fffb3c..cac691f 100644
--- a/SPECS/openstack-aodh.spec
+++ b/SPECS/openstack-aodh.spec
@@ -18,8 +18,13 @@ Source12: %{name}-notifier.service
@@ -18,6 +18,9 @@ Source12: %{name}-notifier.service
Source13: %{name}-expirer.service
Source14: %{name}-listener.service
@ -177,12 +177,8 @@ index 203f2f0..5d0dedd 100644
+
BuildArch: noarch
+
+
BuildRequires: python-setuptools
BuildRequires: python2-devel
BuildRequires: systemd
@@ -263,7 +268,7 @@ install -p -D -m 640 etc/aodh/api_paste.ini %{buildroot}%{_sysconfdir}/aodh/api_
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
@ -191,7 +187,7 @@ index 203f2f0..5d0dedd 100644
# Install logrotate
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
@@ -284,6 +289,9 @@ mv %{buildroot}%{python2_sitelib}/%{pypi_name}/locale %{buildroot}%{_datadir}/lo
@@ -283,6 +286,9 @@ mv %{buildroot}%{python2_sitelib}/%{pypi_name}/locale %{buildroot}%{_datadir}/lo
# Find language files
%find_lang %{pypi_name} --all-name
@ -201,22 +197,23 @@ index 203f2f0..5d0dedd 100644
# Remove unused files
rm -fr %{buildroot}/usr/etc
@@ -346,13 +354,13 @@ exit 0
%config(noreplace) %attr(-, root, aodh) %{_sysconfdir}/aodh/api_paste.ini
@@ -345,7 +351,6 @@ exit 0
%config(noreplace) %attr(-, root, aodh) %{_sysconfdir}/aodh/policy.json
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%dir %attr(0755, aodh, root) %{_localstatedir}/log/aodh
%dir %attr(0750, aodh, root) %{_localstatedir}/log/aodh
-%{_bindir}/aodh-dbsync
%{_bindir}/aodh-config-generator
%defattr(-, aodh, aodh, -)
%dir %{_sharedstatedir}/aodh
@@ -353,6 +358,7 @@ exit 0
%dir %{_sharedstatedir}/aodh/tmp
%files api
+%{_bindir}/aodh-dbsync
%{_bindir}/aodh-api
%{_bindir}/aodh-data-migration
%{_bindir}/aodh-combination-alarm-conversion
@@ -373,22 +381,11 @@ exit 0
%{_unitdir}/%{name}-api.service
@@ -371,6 +377,7 @@ exit 0
%files expirer
%{_bindir}/aodh-expirer
@ -224,22 +221,6 @@ index 203f2f0..5d0dedd 100644
%{_unitdir}/%{name}-expirer.service
%changelog
-* Mon Aug 28 2017 rdo-trunk <javier.pena@redhat.com> 3.0.4-1
-- Update to 3.0.4
-
-* Mon Jul 24 2017 Pradeep Kilambi <pkilambi@redhat.com> 3.0.3-2
-- Move aodh-dbsync to openstack-aodh-common
-
-* Thu Jul 13 2017 Mehdi Abaakouk <sileht@redhat.com> 3.0.3-1
-- Update to 3.0.3
-
-* Tue Feb 28 2017 Alfredo Moralejo <amoralej@redhat.com> 3.0.2-1
-- Update to 3.0.2
-
* Thu Oct 06 2016 Haikel Guemar <hguemar@fedoraproject.org> 3.0.0-1
- Update to 3.0.0
--
1.9.1
2.7.4

View File

@ -1,7 +1,7 @@
From 4639ba8ff40214558ac25394ff2a3f4aaebe437a Mon Sep 17 00:00:00 2001
From 21b64cda6c2cd29c287c08c85962609f8d93d18f Mon Sep 17 00:00:00 2001
From: Scott Little <scott.little@windriver.com>
Date: Mon, 2 Oct 2017 14:28:46 -0400
Subject: [PATCH 2/5] WRS: 0001-Update-package-versioning-for-TIS-format.patch
Subject: [PATCH 2/6] WRS: 0001-Update-package-versioning-for-TIS-format.patch
Conflicts:
SPECS/openstack-aodh.spec
@ -10,18 +10,18 @@ Conflicts:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/SPECS/openstack-aodh.spec b/SPECS/openstack-aodh.spec
index 5d0dedd..c844a28 100644
index cac691f..4e626d3 100644
--- a/SPECS/openstack-aodh.spec
+++ b/SPECS/openstack-aodh.spec
@@ -4,7 +4,7 @@
Name: openstack-aodh
Version: 3.0.4
Version: 5.1.0
-Release: 1%{?dist}
+Release: 1.el7%{?_tis_dist}.%{tis_patch_ver}
Summary: OpenStack Telemetry Alarming
License: ASL 2.0
URL: https://github.com/openstack/aodh.git
--
1.9.1
2.7.4

View File

@ -1,14 +1,14 @@
From c4f387dbc34568caedd13e6c782a601cbdfcf707 Mon Sep 17 00:00:00 2001
From 8620101244ea5be1ff0cc0e127fa57dca4be468a Mon Sep 17 00:00:00 2001
From: Scott Little <scott.little@windriver.com>
Date: Mon, 2 Oct 2017 14:28:46 -0400
Subject: [PATCH 4/5] WRS: 0001-meta-modify-aodh-api.patch
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 | 11 +++++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
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
@ -24,23 +24,20 @@ index b8b2921..06bcd12 100644
[Install]
WantedBy=multi-user.target
diff --git a/SPECS/openstack-aodh.spec b/SPECS/openstack-aodh.spec
index b52931c..217dd14 100644
index 8c5722a..4acf6a0 100644
--- a/SPECS/openstack-aodh.spec
+++ b/SPECS/openstack-aodh.spec
@@ -20,9 +20,10 @@ Source14: %{name}-listener.service
@@ -20,6 +20,9 @@ Source14: %{name}-listener.service
#WRS
Source20: aodh-expirer-active
-BuildArch: noarch
-
+#WRS: Include patches here:
+#WRS: Include patches here:
+Patch1: 0001-modify-aodh-api.patch
+
BuildArch: noarch
+BuildArch: noarch
BuildRequires: python-setuptools
BuildRequires: python2-devel
@@ -221,6 +222,9 @@ This package contains the Aodh test files.
BuildRequires: openstack-macros
@@ -214,6 +217,9 @@ This package contains the Aodh test files.
%prep
%setup -q -n %{pypi_name}-%{upstream_version}
@ -50,16 +47,16 @@ index b52931c..217dd14 100644
find . \( -name .gitignore -o -name .placeholder \) -delete
find aodh -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} +
@@ -263,6 +267,8 @@ install -p -D -m 640 %{SOURCE1} %{buildroot}%{_datadir}/aodh/aodh-dist.conf
install -p -D -m 640 etc/aodh/aodh.conf %{buildroot}%{_sysconfdir}/aodh/aodh.conf
install -p -D -m 640 etc/aodh/policy.json %{buildroot}%{_sysconfdir}/aodh/policy.json
install -p -D -m 640 etc/aodh/api_paste.ini %{buildroot}%{_sysconfdir}/aodh/api_paste.ini
@@ -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
@@ -344,6 +350,7 @@ exit 0
@@ -342,6 +350,7 @@ exit 0
%files common -f %{pypi_name}.lang
%doc README.rst
%dir %{_sysconfdir}/aodh
@ -68,5 +65,5 @@ index b52931c..217dd14 100644
%config(noreplace) %attr(-, root, aodh) %{_sysconfdir}/aodh/aodh.conf
%config(noreplace) %attr(-, root, aodh) %{_sysconfdir}/aodh/policy.json
--
1.9.1
2.7.4

View File

@ -1,7 +1,7 @@
From 98503ae07f4a3b6753c9c1dfc1cf7ed6573ca8e8 Mon Sep 17 00:00:00 2001
From 197df524a7d1dfd278e466257b2e4d6edf0191d1 Mon Sep 17 00:00:00 2001
From: Scott Little <scott.little@windriver.com>
Date: Mon, 2 Oct 2017 14:28:46 -0400
Subject: [PATCH 5/5] WRS: 0001-meta-pass-aodh-api-config.patch
Subject: [PATCH 5/6] WRS: 0001-meta-pass-aodh-api-config.patch
---
SOURCES/openstack-aodh-api.service | 2 +-
@ -21,5 +21,5 @@ index 06bcd12..a78eb32 100644
[Install]
WantedBy=multi-user.target
--
1.9.1
2.7.4

View File

@ -1,25 +1,25 @@
From 0563ba710bf274a50ee16df75017dd0092cd2d31 Mon Sep 17 00:00:00 2001
From 4231d626e3b6fccc3535941baa1a5529a1cac192 Mon Sep 17 00:00:00 2001
From: Al Bailey <Al.Bailey@windriver.com>
Date: Thu, 21 Dec 2017 14:15:48 -0600
Subject: [PATCH] add drivername for postgresql
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 217dd14..2fa77d0 100644
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:
#WRS: Include patches here:
Patch1: 0001-modify-aodh-api.patch
+Patch2: 0002-Add-drivername-support-for-postgresql-connection-set.patch
BuildArch: noarch
@@ -224,6 +225,7 @@ This package contains the Aodh test files.
@@ -219,6 +220,7 @@ This package contains the Aodh test files.
#WRS: Apply patches here
%patch1 -p1
@ -28,5 +28,5 @@ index 217dd14..2fa77d0 100644
find . \( -name .gitignore -o -name .placeholder \) -delete
--
1.8.3.1
2.7.4

View File

@ -1,32 +0,0 @@
From fe727c7baf89dab7e67244ba9c84c71d609c0389 Mon Sep 17 00:00:00 2001
From: Angie Wang <angie.Wang@windriver.com>
Date: Thu, 28 Jun 2018 12:30:19 -0400
Subject: [PATCH 1/1] meta support new gnocchiclient interface
---
SPECS/openstack-aodh.spec | 2 ++
1 file changed, 2 insertions(+)
diff --git a/SPECS/openstack-aodh.spec b/SPECS/openstack-aodh.spec
index 2fa77d0..a10e9e0 100644
--- a/SPECS/openstack-aodh.spec
+++ b/SPECS/openstack-aodh.spec
@@ -23,6 +23,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
+Patch3: 0003-support-new-gnocchiclient-interface.patch
BuildArch: noarch
@@ -226,6 +227,7 @@ This package contains the Aodh test files.
#WRS: Apply patches here
%patch1 -p1
%patch2 -p1
+%patch3 -p1
find . \( -name .gitignore -o -name .placeholder \) -delete
--
1.8.3.1

View File

@ -4,4 +4,3 @@ meta-remove-default-logrotate.patch
0001-meta-modify-aodh-api.patch
0001-meta-pass-aodh-api-config.patch
0006-add-drivername-for-postgresql.patch
0007-meta-support-new-gnocchiclient-interface.patch

View File

@ -1,14 +1,14 @@
From bc92f8743ede901522e6b19af208a4e5d038fa2f Mon Sep 17 00:00:00 2001
From 760b1b7d60d709d20d54d911b992f0e542088f2a Mon Sep 17 00:00:00 2001
From: Scott Little <scott.little@windriver.com>
Date: Mon, 2 Oct 2017 14:28:46 -0400
Subject: [PATCH 3/5] WRS: meta-remove-default-logrotate.patch
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 c844a28..b52931c 100644
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
@ -19,7 +19,7 @@ index c844a28..b52931c 100644
Source10: %{name}-api.service
Source11: %{name}-evaluator.service
Source12: %{name}-notifier.service
@@ -270,9 +269,6 @@ install -d -m 755 %{buildroot}%{_sharedstatedir}/aodh
@@ -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
@ -29,14 +29,14 @@ index c844a28..b52931c 100644
# 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
@@ -352,7 +348,6 @@ exit 0
@@ -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) %attr(-, root, aodh) %{_sysconfdir}/aodh/api_paste.ini
-%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%dir %attr(0755, aodh, root) %{_localstatedir}/log/aodh
%dir %attr(0750, aodh, root) %{_localstatedir}/log/aodh
%{_bindir}/aodh-config-generator
%defattr(-, aodh, aodh, -)
--
1.9.1
2.7.4

View File

@ -1,12 +1,12 @@
From ea7f6013ffd1eb525943f4d7ae1bfdef6ecf6c22 Mon Sep 17 00:00:00 2001
From 4307eaa7d2cf3dbcf1eb25c7b2636aeaef13b6c7 Mon Sep 17 00:00:00 2001
From: Angie Wang <angie.Wang@windriver.com>
Date: Wed, 15 Feb 2017 15:59:26 -0500
Subject: [PATCH 1/1] modify-aodh-api
Subject: [PATCH 1/2] modify-aodh-api
---
aodh/api/aodh-api.py | 7 +++++++
aodh/api/app.py | 14 ++++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
aodh/api/app.py | 12 +++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
create mode 100644 aodh/api/aodh-api.py
diff --git a/aodh/api/aodh-api.py b/aodh/api/aodh-api.py
@ -23,43 +23,39 @@ index 0000000..565f2e3
+application = build_wsgi_app.build_wsgi_app(None, args)
+
diff --git a/aodh/api/app.py b/aodh/api/app.py
index 5cecb83..652856e 100644
index b7c0900..ba0a438 100644
--- a/aodh/api/app.py
+++ b/aodh/api/app.py
@@ -60,7 +60,7 @@ def setup_app(pecan_config=PECAN_CONFIG, conf=None):
return app
@@ -53,7 +53,7 @@ def setup_app(root, conf):
)
-def load_app(conf):
+def load_app(conf, args):
global APPCONFIGS
# Build the WSGI app
cfg_file = None
cfg_path = conf.api.paste_config
@@ -68,15 +68,21 @@ def load_app(conf):
cfg_file = conf.find_file(cfg_path)
elif os.path.exists(cfg_path):
cfg_file = cfg_path
-
if not cfg_file:
@@ -64,6 +64,12 @@ def load_app(conf):
if cfg_path is None or not os.path.exists(cfg_path):
raise cfg.ConfigFilesNotFoundError([conf.api.paste_config])
+
+ config = dict([(key, value) for key, value in args.iteritems()
+ if key in conf and value is not None])
+ for key, value in config.iteritems():
+ if key == 'config_file':
+ conf.config_file = value
+
LOG.info(_LI("Full WSGI config used: %s"), cfg_file)
return deploy.loadapp("config:" + cfg_file)
config = dict(conf=conf)
configkey = str(uuid.uuid4())
APPCONFIGS[configkey] = config
@@ -83,5 +89,5 @@ def app_factory(global_config, **local_conf):
return setup_app(root=local_conf.get('root'), **appconfig)
-def build_wsgi_app(argv=None):
- return load_app(service.prepare_service(argv=argv))
+def build_wsgi_app(argv=None, args=None):
+ return load_app(service.prepare_service(argv=argv), args)
def _app():
--
1.8.3.1
2.7.4

View File

@ -1,14 +1,12 @@
From c8afec630be24345ccae50db739949f964e9c580 Mon Sep 17 00:00:00 2001
From c322e9795933ff8665d7590f082672bd839df431 Mon Sep 17 00:00:00 2001
From: Al Bailey <Al.Bailey@windriver.com>
Date: Thu, 21 Dec 2017 13:38:09 -0600
Subject: [PATCH] Add drivername support for postgresql connection settings
Subject: [PATCH 2/2] Add drivername support for postgresql connection settings
---
aodh/api/aodh-api.py | 3 +--
aodh/cmd/data_migration.py | 2 +-
aodh/storage/__init__.py | 2 +-
setup.cfg | 1 +
4 files changed, 4 insertions(+), 4 deletions(-)
aodh/api/aodh-api.py | 3 +--
setup.cfg | 1 +
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/aodh/api/aodh-api.py b/aodh/api/aodh-api.py
index 565f2e3..7c413d6 100644
@ -22,44 +20,18 @@ index 565f2e3..7c413d6 100644
+args = {'config_file': 'etc/aodh/aodh.conf', }
application = build_wsgi_app.build_wsgi_app(None, args)
-
diff --git a/aodh/cmd/data_migration.py b/aodh/cmd/data_migration.py
index 6a9ea49..1a8df28 100644
--- a/aodh/cmd/data_migration.py
+++ b/aodh/cmd/data_migration.py
@@ -94,7 +94,7 @@ def _validate_conn_options(args):
), nosql_scheme)
sys.exit(1)
if sql_scheme not in ('mysql', 'mysql+pymysql', 'postgresql',
- 'sqlite'):
+ 'postgresql+psycopg2', 'sqlite'):
root_logger.error(_LE('Invalid destination DB type %s, the destination'
' database connection should be one of: '
'[mysql, postgresql, sqlite]'), sql_scheme)
diff --git a/aodh/storage/__init__.py b/aodh/storage/__init__.py
index e1d1048..d8fcd54 100644
--- a/aodh/storage/__init__.py
+++ b/aodh/storage/__init__.py
@@ -59,7 +59,7 @@ def get_connection_from_config(conf):
url = conf.database.connection
connection_scheme = urlparse.urlparse(url).scheme
if connection_scheme not in ('mysql', 'mysql+pymysql', 'postgresql',
- 'sqlite'):
+ 'postgresql+psycopg2', 'sqlite'):
msg = ('Storage backend %s is deprecated, and all the NoSQL backends '
'will be removed in Aodh 4.0, please use SQL backend.' %
connection_scheme)
diff --git a/setup.cfg b/setup.cfg
index 76f5362..ca67a16 100644
index 5bfc817..8f8db57 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -80,6 +80,7 @@ aodh.storage =
@@ -64,6 +64,7 @@ aodh.storage =
mysql = aodh.storage.impl_sqlalchemy:Connection
mysql+pymysql = aodh.storage.impl_sqlalchemy:Connection
postgresql = aodh.storage.impl_sqlalchemy:Connection
+ postgresql+psycopg2 = aodh.storage.impl_sqlalchemy:Connection
sqlite = aodh.storage.impl_sqlalchemy:Connection
hbase = aodh.storage.impl_hbase:Connection
aodh.alarm.rule =
threshold = aodh.api.controllers.v2.alarm_rules.threshold:AlarmThresholdRule
--
1.8.3.1
2.7.4

View File

@ -1,202 +0,0 @@
From 25f0c1ab7cc1d9d22df01f1cd2d6c4fb2fe8b0f2 Mon Sep 17 00:00:00 2001
From: Angie Wang <angie.Wang@windriver.com>
Date: Thu, 28 Jun 2018 12:26:52 -0400
Subject: [PATCH 1/1] support new gnocchiclient interface
---
aodh/api/controllers/v2/alarm_rules/gnocchi.py | 37 +++++++---------------
aodh/evaluator/gnocchi.py | 22 ++++++++++---
.../functional/api/v2/test_alarm_scenarios.py | 5 ---
aodh/tests/unit/evaluator/test_gnocchi.py | 3 ++
4 files changed, 32 insertions(+), 35 deletions(-)
diff --git a/aodh/api/controllers/v2/alarm_rules/gnocchi.py b/aodh/api/controllers/v2/alarm_rules/gnocchi.py
index 6e2e64d..419b6b0 100644
--- a/aodh/api/controllers/v2/alarm_rules/gnocchi.py
+++ b/aodh/api/controllers/v2/alarm_rules/gnocchi.py
@@ -74,9 +74,9 @@ class AlarmGnocchiThresholdRule(base.AlarmRule):
conf = pecan.request.cfg
gnocchi_client = client.Client(
'1', keystone_client.get_session(conf),
- interface=conf.service_credentials.interface,
- region_name=conf.service_credentials.region_name)
-
+ adapter_options={
+ 'interface': conf.service_credentials.interface,
+ 'region_name': conf.service_credentials.region_name})
try:
return gnocchi_client.capabilities.list().get(
'aggregation_methods', [])
@@ -105,26 +105,6 @@ class MetricOfResourceRule(AlarmGnocchiThresholdRule):
'resource_type'])
return rule
- @classmethod
- def validate_alarm(cls, alarm):
- super(MetricOfResourceRule,
- cls).validate_alarm(alarm)
-
- conf = pecan.request.cfg
- gnocchi_client = client.Client(
- '1', keystone_client.get_session(conf),
- interface=conf.service_credentials.interface,
- region_name=conf.service_credentials.region_name)
-
- rule = alarm.gnocchi_resources_threshold_rule
- try:
- gnocchi_client.resource.get(rule.resource_type,
- rule.resource_id)
- except exceptions.ClientException as e:
- raise base.ClientSideError(e.message, status_code=e.code)
- except Exception as e:
- raise GnocchiUnavailable(e)
-
class AggregationMetricByResourcesLookupRule(AlarmGnocchiThresholdRule):
metric = wsme.wsattr(wtypes.text, mandatory=True)
@@ -200,9 +180,9 @@ class AggregationMetricByResourcesLookupRule(AlarmGnocchiThresholdRule):
gnocchi_client = client.Client(
'1', keystone_client.get_session(conf),
- interface=conf.service_credentials.interface,
- region_name=conf.service_credentials.region_name)
-
+ adapter_options={
+ 'interface': conf.service_credentials.interface,
+ 'region_name': conf.service_credentials.region_name})
try:
gnocchi_client.metric.aggregation(
metrics=rule.metric,
@@ -211,6 +191,11 @@ class AggregationMetricByResourcesLookupRule(AlarmGnocchiThresholdRule):
needed_overlap=0,
resource_type=rule.resource_type)
except exceptions.ClientException as e:
+ if e.code == 404:
+ # NOTE(sileht): We are fine here, we just want to ensure the
+ # 'query' payload is valid for Gnocchi If the metric
+ # doesn't exists yet, it doesn't matter
+ return
raise base.ClientSideError(e.message, status_code=e.code)
except Exception as e:
raise GnocchiUnavailable(e)
diff --git a/aodh/evaluator/gnocchi.py b/aodh/evaluator/gnocchi.py
index 524b662..3632597 100644
--- a/aodh/evaluator/gnocchi.py
+++ b/aodh/evaluator/gnocchi.py
@@ -14,6 +14,7 @@
# under the License.
from gnocchiclient import client
+from gnocchiclient import exceptions
from oslo_log import log
from oslo_serialization import jsonutils
@@ -34,8 +35,9 @@ class GnocchiBase(threshold.ThresholdEvaluator):
super(GnocchiBase, self).__init__(conf)
self._gnocchi_client = client.Client(
'1', keystone_client.get_session(conf),
- interface=conf.service_credentials.interface,
- region_name=conf.service_credentials.region_name)
+ adapter_options={
+ 'interface': conf.service_credentials.interface,
+ 'region_name': conf.service_credentials.region_name})
@staticmethod
def _sanitize(rule, statistics):
@@ -58,12 +60,16 @@ class GnocchiResourceThresholdEvaluator(GnocchiBase):
try:
return self._gnocchi_client.metric.get_measures(
metric=rule['metric'],
+ granularity=rule['granularity'],
start=start, stop=end,
resource_id=rule['resource_id'],
aggregation=rule['aggregation_method'])
+ except exceptions.NotFound:
+ LOG.debug('metric %s or resource %s does not exists',
+ rule['metric'], rule['resource_id'])
+ return []
except Exception as e:
- LOG.warning(_LW('alarm stats retrieval failed: %s'),
- e)
+ LOG.warning(_LW('alarm stats retrieval failed: %s'), e)
return []
@@ -80,9 +86,13 @@ class GnocchiAggregationMetricsThresholdEvaluator(GnocchiBase):
# https://bugs.launchpad.net/gnocchi/+bug/1479429
return self._gnocchi_client.metric.aggregation(
metrics=rule['metrics'],
+ granularity=rule['granularity'],
start=start, stop=end,
aggregation=rule['aggregation_method'],
needed_overlap=0)
+ except exceptions.NotFound:
+ LOG.debug('metrics %s does not exists', rule['metrics'])
+ return []
except Exception as e:
LOG.warning(_LW('alarm stats retrieval failed: %s'), e)
return []
@@ -101,12 +111,16 @@ class GnocchiAggregationResourcesThresholdEvaluator(GnocchiBase):
try:
return self._gnocchi_client.metric.aggregation(
metrics=rule['metric'],
+ granularity=rule['granularity'],
query=jsonutils.loads(rule['query']),
resource_type=rule["resource_type"],
start=start, stop=end,
aggregation=rule['aggregation_method'],
needed_overlap=0,
)
+ except exceptions.NotFound:
+ LOG.debug('metric %s does not exists', rule['metric'])
+ return []
except Exception as e:
LOG.warning(_LW('alarm stats retrieval failed: %s'), e)
return []
diff --git a/aodh/tests/functional/api/v2/test_alarm_scenarios.py b/aodh/tests/functional/api/v2/test_alarm_scenarios.py
index 8e3288a..5d30caa 100644
--- a/aodh/tests/functional/api/v2/test_alarm_scenarios.py
+++ b/aodh/tests/functional/api/v2/test_alarm_scenarios.py
@@ -2966,11 +2966,6 @@ class TestAlarmsRuleGnocchi(TestAlarmsBase):
c.capabilities.list.return_value = {
'aggregation_methods': ['count']}
self.post_json('/alarms', params=json, headers=self.auth_headers)
- expected = [mock.call.capabilities.list(),
- mock.call.resource.get(
- "instance",
- "209ef69c-c10c-4efb-90ff-46f4b2d90d2e")]
- self.assertEqual(expected, c.mock_calls)
alarms = list(self.alarm_conn.get_alarms(enabled=False))
self.assertEqual(1, len(alarms))
diff --git a/aodh/tests/unit/evaluator/test_gnocchi.py b/aodh/tests/unit/evaluator/test_gnocchi.py
index 6d00f4f..e4740e4 100644
--- a/aodh/tests/unit/evaluator/test_gnocchi.py
+++ b/aodh/tests/unit/evaluator/test_gnocchi.py
@@ -186,6 +186,7 @@ class TestGnocchiResourceThresholdEvaluate(TestGnocchiEvaluatorBase):
self.assertEqual(
[mock.call.get_measures(aggregation='mean', metric='cpu_util',
+ granularity=60,
resource_id='my_instance',
start=start_alarm, stop=end)],
self.client.metric.mock_calls)
@@ -326,6 +327,7 @@ class TestGnocchiAggregationMetricsThresholdEvaluate(TestGnocchiEvaluatorBase):
metrics=[
'0bb1604d-1193-4c0a-b4b8-74b170e35e83',
'9ddc209f-42f8-41e1-b8f1-8804f59c4053'],
+ granularity=300,
needed_overlap=0,
start=start_alarm, stop=end)],
self.client.metric.mock_calls)
@@ -443,6 +445,7 @@ class TestGnocchiAggregationResourcesThresholdEvaluate(
end = "2015-01-26T12:57:00"
self.assertEqual(
[mock.call.aggregation(aggregation='mean', metrics='cpu_util',
+ granularity=50,
needed_overlap=0,
query={"=": {"server_group":
"my_autoscaling_group"}},
--
1.8.3.1

View File

@ -1 +1 @@
mirror:Source/openstack-aodh-3.0.4-1.el7.src.rpm
mirror:Source/openstack-aodh-5.1.0-1.el7.src.rpm