Commit Graph

652 Commits

Author SHA1 Message Date
Zuul 7df6a7d1d6 Merge "Catch specific exception when validating time zone" 2024-03-15 07:58:37 +00:00
Stephen Finucane 947c7b4ffd db: Replace use of Engine.execute() method
Resolve the following RemovedIn20Warning warning:

  The Engine.execute() method is considered legacy as of the 1.x
  series of SQLAlchemy and will be removed in 2.0.

This also allows us to resolve the following RemovedIn20Warning warning:

  The current statement is being autocommitted using implicit
  autocommit, which will be removed in SQLAlchemy 2.0. Use the .begin()
  method of Engine or Connection in order to use an explicit transaction
  for DML and DDL statements.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I46f3277ea17e814e7b631750b2739f25e4395e22
2024-03-11 13:58:49 +00:00
Stephen Finucane 9a66301aef tests: Enable SQLAlchemy 2.0 deprecation warnings
Well, sort of. We enable them but immediately filter out the ones we're
actually seeing, the rationale being that we can address these in a
piecemeal fashion without the risk of introducing new issues.

There's a lot more to be done here. However, the work done in oslo.db
[1], nova [2], cinder [2] etc. should provide a guide for how to resolve
the outstanding issues.

We also take the opportunity to silence some rather annoying warnings
from webob and oslo_policy that are to be fixed later.

[1] https://review.opendev.org/q/topic:sqlalchemy-20+project:openstack/oslo.db
[2] https://review.opendev.org/q/topic:sqlalchemy-20+project:openstack/nova
[3] https://review.opendev.org/q/topic:sqlalchemy-20+project:openstack/cinder

Change-Id: I666cddbd2aef13c55118ea523b5e40bb924faf15
2024-03-11 13:58:41 +00:00
Stephen Finucane 90076472ac Configure 'cache_ok' for TypeDecorator implementation
Both the JSONEncodedDict and TimestampUTC can be safely used in a cache
key. Set 'cache_ok' to indicate this. This resolves the following
warnings:

  SAWarning: TypeDecorator TimestampUTC() will not produce a cache key
  because the ``cache_ok`` attribute is not set to True.  This can have
  significant performance implications including some performance
  degradations in comparison to prior SQLAlchemy versions.  Set this
  attribute to True if this type object's state is safe to use in a
  cache key, or False to disable this warning. (Background on this error
  at: https://sqlalche.me/e/14/cprf)

  SAWarning: TypeDecorator JSONEncodedDict() will not produce a cache
  key because the ``cache_ok`` attribute is not set to True.  This can
  have significant performance implications including some performance
  degradations in comparison to prior SQLAlchemy versions.  Set this
  attribute to True if this type object's state is safe to use in a
  cache ke y, or False to disable this warning. (Background on this
  error at: https://sqlalche.me/e/14/cprf)

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I589a0e378e155dcb181e6b1a9cca7aae4cad5349
2024-03-11 13:58:36 +00:00
Stephen Finucane 3bd47b2b50 db: Don't pass strings to 'Connection.execute'
Resolve the following RemovedIn20Warning warning:

  Passing a string to Connection.execute() is deprecated and will be
  removed in version 2.0.  Use the text() construct, or the
  Connection.exec_driver_sql() method to invoke a driver-level SQL
  string.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Ic4518ca1a5aea94a72c9dc3e4393eb970b55c3dd
2024-03-11 13:58:30 +00:00
Stephen Finucane 45e0eaaa61 db: Remove use of autocommit
This is no longer necessary.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: If34b4511dbbd95598f4370eb7b28585d153cf118
2024-03-11 13:58:24 +00:00
Stephen Finucane b710d3fdad db: Replace use of LegacyEngineFacade
We aren't passing context objects around, hence this looks more like
ironic's use of oslo.db than e.g. nova or cinder. Nothing complicated
though.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Ia0368cc128d495011776e80a27af04776e876fa9
2024-03-11 13:31:06 +00:00
Zuul 64e0f7c895 Merge "Bump hacking" 2024-02-21 07:40:04 +00:00
Takashi Kajinami fd87af8719 Replace md5 with oslo version
This follows what was already done in the other projects like [1].

In FIPS mode, md5 is allowed only in non-security contexts. This
change disables the security context in the md5 call to determine
the hash for workload partitioning, because this usage does not
involve any security risks.

[1] 8027d907109b6b3c96623f9793aff752cec8ed12

Change-Id: I7d622a6e7d324a765760819c024295b57990f95c
2024-01-31 08:01:46 +00:00
Takashi Kajinami d8b3f58c0c Bump hacking
hacking 3.0.x is too old.

Change-Id: I2bbe8b45596f4530284e1ba5946fc3fa238649a7
2024-01-27 22:22:47 +09:00
Takashi Kajinami d2c2e1b671 Catch specific exception when validating time zone
... instead of the generic Exception to avoid hiding unexpected errors.

Change-Id: I5200e097bec2e0bd43f25a3c457391b10f913930
2024-01-27 20:21:16 +09:00
Zuul a61215e5be Merge "Dump loaded options during start up" 2024-01-09 06:46:34 +00:00
Takashi Kajinami ac365555f4 Dump loaded options during start up
... so that operators can review effective values (except for secret
information such as password) from the log.

Change-Id: Ic094df537b5f7333be38c249cdec59a10d2e2660
2023-11-28 13:26:26 +00:00
Erno Kuvaja 59a43ef35a Move functional tests to tempest_plugin
Remove pifpaf and dependencies to gnocchi for tox test runs.

Remove redundant gabbi tests.

Move wsme & query unit tests from fuctional to unit test folder where
they belong.

Remove integration tests which has been covered in the new tempest
cases in the depends on patch.

Remove run-tests.sh in favour of just calling stestr.

Depends-On: https://review.opendev.org/c/openstack/telemetry-tempest-plugin/+/901838
Change-Id: I5b33cba27dfcb2bbdf12c9bc6b28ecff9aa18d93
2023-11-28 08:57:16 +00:00
Stephen Finucane 4008f65a1c tests: Remove duplicate fixture config
This is already done in the 'aodh.tests.functional.db.TestBase' base
class.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I33e40cdb00620dc67e214f181068d4a024aa1447
2023-11-16 14:52:35 +00:00
Zuul 197440c3c8 Merge "Add Prometheus evaluator" 2023-11-07 16:02:59 +00:00
Martin Mágr f932265290 Add Prometheus evaluator
This patch adds threshold evaluator for Prometheus metrics.
Alarms are based on Prometheus query only. The library
python-observabilityclient is used for querying Prometheus.

Co-authored-by: Jaromír Wysoglad <jwysogla@redhat.com>
Depends-On: Ie7477e0b11479449f7f13c7a784737ac70059964
Change-Id: I72e124cca4398b78f7ed12e1db3f66bdbfcb196e
2023-11-07 06:22:28 +00:00
Takashi Kajinami 0ca1452bed Remove python2 shebang from some files
... because these are not actually necessary.

Change-Id: I11622a2a2dbf8ff7b5a32bfa3bea380be12bb1d0
2023-11-04 15:18:54 +00:00
Takashi Kajinami 1eb2a7ac86 [coordination] backend_url should be secret
The backend_url option can sometimes contain secrets.

For example when redis coordination backend is used and authentication
is enabled in redis, the plain redis password is put as an URL element.

[coordination]
backend_url=redis://:password@127.0.0.1:6379

Closes-Bug: #2012246
Change-Id: Ib918532d82c4633add7fad9c8441868cfd84001b
2023-03-20 18:36:37 +09:00
Pavlo Shchelokovskyy 9d9840023e Add oslo.policy.enforcer entry point
this will allow various oslo.policy scripts like
oslopolicy-policy-generator to work with Aodh.

Change-Id: I5941fe03277368f789a0e07d823ececdf86ed37e
Story: 2010559
Task: 47247
2023-02-02 15:55:14 +00:00
Emma Foley 9da6647623 Complete the revert of "Support Ceilometer API"
This partly reverts commit d32ca24453.
The rest of the revert is in 9b50734bf7.

This partial revert is because the changes to
aodh/api/controllers/v2/alarm_rules/composite.py were omitted in the
original revert.

Change-Id: I181380747bd9f613239de87fa931f75e7d97ff7d
2023-01-17 17:05:12 +00:00
Stephen Finucane 45e8c6ae0c Fix compatibility with oslo.db 12.1.0
oslo.db 12.1.0 has changed the default value for the 'autocommit'
parameter of 'LegacyEngineFacade' from 'True' to 'False'. This is a
necessary step to ensure compatibility with SQLAlchemy 2.0. However,
Aodh is currently relying on the autocommit behavior and needs changes
to explicitly manage sessions. Until that happens, we need to override
the default.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I129b54b06e1a5c3fafd2a03f295cc1cfd9c9e33c
2022-09-05 17:04:21 +01:00
Takashi Kajinami 6b8bd206fb Remove [coordination] check_watchers
This parameter has had no effect for several cycles and was officially
deprecated during Xena cycle[1].

[1] 082d67f596

Related-Bug: #1929178
Change-Id: Ifeda4499b46129bf81f10286f38fff409c93f907
2022-06-26 07:48:40 +09:00
Zuul d880ff2cb2 Merge "Migrate evaluation_interval to [evaluator]" 2022-06-13 07:55:53 +00:00
Zuul 9ff005697f Merge "Deprecate unused [DEFAULT] http_timeout" 2022-06-13 07:35:42 +00:00
Takashi Kajinami 214be56b38 Ignore Gnocchi API error when the metric is not yet created
Change 74eadfbd58 replaced usage of
metric aggregate API by Dynamic aggregate API.

However the Dynamic aggregate API returns a different response code
(not 404, but 400) in Gnocchi <= 4.4 and this is causing the direct API
error when the metric associated with the aggregation does not exist.

This change adds 400 to the ignored response codes so that Aodh api
does not return error even when the associated metric is not yet
created in Gnocchi.

Closes-Bug: #1974682
Change-Id: Ief75ccdc0fe5c6a197fc05bc481a5be096447558
2022-06-08 14:47:50 +00:00
Hervé Beraud ddf12d559d Remove unnecessary unicode prefixes
Change-Id: I4b6815bad979e19bda2d59ac37c51f592dc385e8
2022-04-20 12:29:28 +02:00
Takashi Kajinami 9ff2b4e8f4 Migrate evaluation_interval to [evaluator]
... because this parameter is specific to aodh-evaluator and not used
by the other services.

Change-Id: I6a78a749c2b2f03195dae3390c54663632cc8069
2022-04-14 21:51:03 +09:00
Takashi Kajinami 12ee78cdef Deprecate unused [DEFAULT] http_timeout
This parameter has never been used by any logic since Aodh was splitted
out from Ceilometer.

Change-Id: I667ed60cbf751b1668b86bf7be0b946fe6d84f60
2022-04-14 21:45:33 +09:00
James Page 74eadfbd58 gnocchi: Use Dynamic Aggregates API
Switch to using the Dynamic Aggregates API as the Metric Aggregation
API is deprecated.

When using the Dynamic Aggregates API, any aggregation using rates
can use the underlying base measures for the aggregation rather than
the rate, for example:

    (aggregation rate:mean (metric cpu mean))

The tuple of data for each record returned via this API is encapsulated
with information about the aggregation used so adapt the sanitization
function to deal with this and the formatting of the metrics measures
API as well.

Change-Id: I4f631d224404460138f4050b1b981d577b592544
Closes-Bug: 1946793
2022-02-18 12:40:39 +00:00
Takashi Kajinami 8ac7c65cff Load api-paste.ini from configuration directories first
The api-paste.ini file defines WSGI definition of API. This file is
regarded as one configuration file and sometimes users need to modify
the file, for example to enable an additional middleware.

However currently aodh-api by default expects the file is located in
the aodh source directory and users should set the [api] paste_config
parameter in addition to copy and modify the file.

This change makes the aodh-api process search the api-paste.ini file
from configuration directories automatically, so that users can more
easily customize the file by putting the modified file in /etc/aodh
(or any other config directories).

If the paste_config parameter is defined as a full path then aodh-api
directly loads the file from the specified path. If the file is not
found then the default file in the aodh source directory is used.

Change-Id: I4a6194fbf6a5317a523d75e3fb6bd2fd055f5100
2021-12-01 10:50:31 +09:00
Zuul 6bbf61a67b Merge "Rename [coordination] heartbeat to hearbeat_interval" 2021-10-19 21:18:30 +00:00
Takashi Kajinami 1948461d95 Rename [coordination] heartbeat to hearbeat_interval
... so that users can more easily understnad the parameter defines
interval. This makes the parameter name consistent with other services
like designate or mistral, which provides the similar functionality
using the same tooz library.

Change-Id: I53cf905d7f643a3dc41f1121404abe3c9f0e61ac
2021-10-14 15:13:52 +09:00
Zuul 9fa5ad045b Merge "Introduce Guru Meditation Reports into Aodh" 2021-09-29 07:57:26 +00:00
OpenStack Proposal Bot 59b06e06a1 Imported Translations from Zanata
For more information about this automatic import see:
https://docs.openstack.org/i18n/latest/reviewing-translation-import.html

Change-Id: I81c4a068812e9a169b2c8d6f8a87ff52f0100405
2021-09-19 06:27:34 +00:00
Zuul 85882a3fc2 Merge "Revert "Support Ceilometer API"" 2021-08-26 10:20:15 +00:00
Takashi Kajinami 0416ccec8c Introduce Guru Meditation Reports into Aodh
This change introduces support for Guru Meditation Report(GMR) into
Aodh, using oslo.reportis library.
With this change, each service prints GMR to stderr or file when
the service receives SIGUSR1.

The same was introduced into Cilometer a long ago[1], and this change
is based on the change made in Ceilometer.
 [1] https://review.opendev.org/c/openstack/ceilometer/+/196369

Change-Id: I7f67acd98c2089bb248d3249159719a3979d27e7
2021-08-15 03:23:23 +09:00
Zuul 10383f4d5b Merge "Fix oslo policy DeprecatedRule warnings" 2021-07-14 07:34:12 +00:00
Zuul 3c0e8410a6 Merge "Suppress policy default change warnings" 2021-07-14 07:25:29 +00:00
Zuul 71c5171488 Merge "Merge notifier opts" 2021-07-09 16:28:45 +00:00
Matthias Runge 7a166e05f7 Replace oslo_utils.fnmatch with fnmatch
The oslo_utils.fnmatch module was added to solve an issue in py2.7 but
it is no longer required because py2.7 is no longer supported.
The module was deprecated since oslo.utils 4.9.1[1] and the stdlib's
fnmatch module should be used instead.

SQLAlchemy url is now immutable
Use URL.set to update

Co-authored by: Takashi Kajinami
[1] 4c893c92f551c9dd2a7cfbe7ae8171ad8139df0b

Change-Id: I59c4d93a5914b8e14f7ef93bcaff8d1caaf5e75a
2021-07-09 12:47:17 +02:00
Ghanshyam Mann 082f6cf0ae Fix oslo policy DeprecatedRule warnings
Since 3.7.0, oslo policy started the DeprecationWarning[1] if
deprecated_reason and deprecated_since param are not passed
in DeprecatedRule or they are passed in RuleDefault object.

These warnings are logged for every test which increase the
log size and sometime can full the log buffer and fail the
job.

[1] https://github.com/openstack/oslo.policy/blob/3.7.0/oslo_policy/policy.py#L1538

Change-Id: I8b9f0611364f6857b86fc800c89fe403672af975
2021-07-06 16:52:33 +00:00
Ghanshyam Mann f975f56fdc Suppress policy default change warnings
As part of the new policy, all of the defaults for
policies were changed and warnings about it are being emitted
constantly in the logs. We can suppress these for now until we are
enforcing new defaults [1].

[1]https://docs.openstack.org/nova/latest/configuration/config.html#oslo_policy.enforce_new_defaults

Change-Id: Ie6e33d80469b3f32459f10c59b32cad4b548cb86
2021-07-06 11:51:55 -05:00
Zuul 71f4d02715 Merge "Deprecate unused [coordination] check_watchers" 2021-06-02 17:11:53 +00:00
Takashi Kajinami 082d67f596 Deprecate unused [coordination] check_watchers
The [coordination] check_watchers is no longer used in any
implementation. This change deprecates the parameter so that we can
remove it in a future release.

Closes-Bug: #1929178
Change-Id: I973eb15433e66c75366666940a841e5a579bf0e8
2021-05-21 19:51:34 +09:00
Takashi Kajinami 02179e0c32 Limit number of records deleted by aodh-expirer
This patch introduces the same functionality as is implemented in panko
recently[1], and allows us to limit the number of alarm histories
deleted in a single iteration, to avoid the query takes a long time and
if there are many expired records.

[1] Icf83ffe089301b3782273923f18efd4d209131c2

Change-Id: Ie1d1bbb911cf56a56f712291f61ffaabfa97422f
2021-05-06 21:02:35 +09:00
Takashi Kajinami 0b01d7b728 Merge notifier opts
The notifier group are duplicated when defining options. This is not
affecting functionality but make the code less readable. Let's merge
these tow using itertools as is done for other groups.

Change-Id: Icd8389c771363235062807c31a866d2960726ec6
2021-04-23 22:50:56 +09:00
Matthias Runge 9b50734bf7 Revert "Support Ceilometer API"
ceilometerclient is deprecated and not supported since 2017.

This reverts commit d32ca24453.

Change-Id: Id5bac2f317deceefe625d91f0dc91b071a6f8037
2021-03-01 18:21:09 +01:00
Zuul a584056c0e Merge "Implement secure RBAC for alarms and quota policies" 2021-01-18 17:23:24 +00:00
OpenStack Proposal Bot 6635dc0ca6 Imported Translations from Zanata
For more information about this automatic import see:
https://docs.openstack.org/i18n/latest/reviewing-translation-import.html

Change-Id: I60919c81031f4680bce93333d584a84587662c7e
2021-01-14 06:12:01 +00:00