From dcc049768bc30c093637705a81acae5eefbde833 Mon Sep 17 00:00:00 2001 From: Kaifeng Wang Date: Sat, 18 Apr 2020 14:35:21 +0800 Subject: [PATCH] Fixes unusable Guru meditation report GMR requires configuring a path for storing the report via [oslo_reports]log_dir, this is empty by default, and currently there is no means to specify this option, thus doesn't respond with SIGUSR2. Though gmr is optional, test requirement is still required so that we can generate proper configuration sample for it. Story: 2007570 Task: 39467 Change-Id: I0f03e9d01a3c4e42a4fc8bf2d8ceb2d1a587056c --- ironic/cmd/api.py | 2 ++ ironic/cmd/conductor.py | 4 +++- releasenotes/notes/fix-gmr-37332a12065c09dc.yaml | 6 ++++++ test-requirements.txt | 1 + tools/config/ironic-config-generator.conf | 1 + 5 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fix-gmr-37332a12065c09dc.yaml diff --git a/ironic/cmd/api.py b/ironic/cmd/api.py index 1e8dbcdf61..38ec7bd1fb 100644 --- a/ironic/cmd/api.py +++ b/ironic/cmd/api.py @@ -23,6 +23,7 @@ from oslo_config import cfg from oslo_log import log try: from oslo_reports import guru_meditation_report as gmr + from oslo_reports import opts as gmr_opts except ImportError: gmr = None @@ -41,6 +42,7 @@ def main(): ironic_service.prepare_service(sys.argv) if gmr is not None: + gmr_opts.set_defaults(CONF) gmr.TextGuruMeditation.setup_autorun(version) else: LOG.debug('Guru meditation reporting is disabled ' diff --git a/ironic/cmd/conductor.py b/ironic/cmd/conductor.py index d8fbcfec9c..1f79f01fb1 100644 --- a/ironic/cmd/conductor.py +++ b/ironic/cmd/conductor.py @@ -25,6 +25,7 @@ from oslo_config import cfg from oslo_log import log try: from oslo_reports import guru_meditation_report as gmr + from oslo_reports import opts as gmr_opts except ImportError: gmr = None from oslo_service import service @@ -87,7 +88,8 @@ def main(): ironic_service.prepare_service(sys.argv) if gmr is not None: - gmr.TextGuruMeditation.setup_autorun(version) + gmr_opts.set_defaults(CONF) + gmr.TextGuruMeditation.setup_autorun(version, conf=CONF) else: LOG.debug('Guru meditation reporting is disabled ' 'because oslo.reports is not installed') diff --git a/releasenotes/notes/fix-gmr-37332a12065c09dc.yaml b/releasenotes/notes/fix-gmr-37332a12065c09dc.yaml new file mode 100644 index 0000000000..4256fa4e03 --- /dev/null +++ b/releasenotes/notes/fix-gmr-37332a12065c09dc.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes state report via Guru Meditation Reports that did not work + previously because of empty ``log_dir`` and no way to configure + this configuration option. \ No newline at end of file diff --git a/test-requirements.txt b/test-requirements.txt index 26e52b3fce..d6c84f380d 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -10,6 +10,7 @@ mock>=3.0.0 # BSD Babel!=2.4.0,>=2.3.4 # BSD PyMySQL>=0.7.6 # MIT License iso8601>=0.1.11 # MIT +oslo.reports>=1.18.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0 stestr>=1.0.0 # Apache-2.0 psycopg2>=2.7.3 # LGPL/ZPL diff --git a/tools/config/ironic-config-generator.conf b/tools/config/ironic-config-generator.conf index def7f4f700..a14a0ec325 100644 --- a/tools/config/ironic-config-generator.conf +++ b/tools/config/ironic-config-generator.conf @@ -17,6 +17,7 @@ namespace = oslo.middleware.http_proxy_to_wsgi namespace = oslo.concurrency namespace = oslo.policy namespace = oslo.log +namespace = oslo.reports namespace = oslo.service.service namespace = oslo.service.periodic_task namespace = oslo.service.sslutils