From 34247ff1ab519335e76473c55c68d1516f011f0d Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 13 Oct 2024 12:21:15 +0900 Subject: [PATCH] Support file watcher to trigger GMR report Allow generating GMR report upon file trigger in addition to a signal. The feature has been available in oslo.reports since 1.11.0[1] but it can't be used in magnum without proper initialization. [1] d23e0a65b23dc77d0104075d2313de6ca22b5cae Change-Id: I8f2d9ff66e19680f701179c35826c8830228afd1 --- etc/magnum/magnum-config-generator.conf | 1 + magnum/cmd/api.py | 4 +++- magnum/cmd/conductor.py | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/etc/magnum/magnum-config-generator.conf b/etc/magnum/magnum-config-generator.conf index ffb8ef9af0..29a2e4c02c 100644 --- a/etc/magnum/magnum-config-generator.conf +++ b/etc/magnum/magnum-config-generator.conf @@ -9,6 +9,7 @@ namespace = oslo.log namespace = oslo.messaging namespace = oslo.middleware.cors namespace = oslo.policy +namespace = oslo.reports namespace = oslo.service.periodic_task namespace = oslo.service.service namespace = oslo.versionedobjects diff --git a/magnum/cmd/api.py b/magnum/cmd/api.py index 9c228a27d7..9d1223666f 100644 --- a/magnum/cmd/api.py +++ b/magnum/cmd/api.py @@ -20,6 +20,7 @@ import sys from oslo_concurrency import processutils from oslo_log import log as logging from oslo_reports import guru_meditation_report as gmr +from oslo_reports import opts as gmr_opts from werkzeug import serving from magnum.api import app as api_app @@ -56,7 +57,8 @@ def _get_ssl_configs(use_ssl): def main(): service.prepare_service(sys.argv) - gmr.TextGuruMeditation.setup_autorun(version) + gmr_opts.set_defaults(CONF) + gmr.TextGuruMeditation.setup_autorun(version, conf=CONF) # Enable object backporting via the conductor base.MagnumObject.indirection_api = base.MagnumObjectIndirectionAPI() diff --git a/magnum/cmd/conductor.py b/magnum/cmd/conductor.py index 81c8a783a2..039d3ad999 100644 --- a/magnum/cmd/conductor.py +++ b/magnum/cmd/conductor.py @@ -20,6 +20,7 @@ import sys from oslo_concurrency import processutils from oslo_log import log as logging from oslo_reports import guru_meditation_report as gmr +from oslo_reports import opts as gmr_opts from oslo_service import service from magnum.common import rpc_service @@ -41,7 +42,8 @@ LOG = logging.getLogger(__name__) def main(): magnum_service.prepare_service(sys.argv) - gmr.TextGuruMeditation.setup_autorun(version) + gmr_opts.set_defaults(CONF) + gmr.TextGuruMeditation.setup_autorun(version, conf=CONF) LOG.info('Starting server in PID %s', os.getpid()) LOG.debug("Configuration:")