From 398462021bd4764145a69cf6e672194f8b9efea9 Mon Sep 17 00:00:00 2001 From: Ruby Loo Date: Wed, 14 Jun 2017 15:40:47 -0400 Subject: [PATCH] reloads mutable config values on SIGHUP This changes the ironic (ironic-api and ironic-conductor) services so that when a SIGHUP signal is issued, the service reloads (and uses) the values of mutable configuration options. The mutable configuration options (set by oslo.config Opts' mutable=True) are: - [DEFAULT]/pin_release_version - [DEFAULT]/debug - [DEFAULT]/log_config_append and are indicated as such in ironic's sample config (https://docs.openstack.org/ironic/latest/configuration/sample-config.html) by "# Note: This option can be changed without restarting.". Configuration options are mutable if their oslo.config Opt's mutable=True is set. This mutable setting is respected when the oslo method mutate_config_files is called instead of reload_config_files. Icec3e664f3fe72614e373b2938e8dee53cf8bc5e allows services to tell oslo.service they want mutate_config_files to be called by specifying the 'restart_method=mutate' parameter, which this patch does. Change-Id: I0df46bb21dda035b25daad17737dbfedb861e868 Closes-Bug: #1585595 --- ironic/cmd/conductor.py | 2 +- ironic/common/service.py | 2 +- ironic/conf/default.py | 2 +- ...ervice-reloads-configs-0e2462e3f064a2ff.yaml | 17 +++++++++++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/sighup-service-reloads-configs-0e2462e3f064a2ff.yaml diff --git a/ironic/cmd/conductor.py b/ironic/cmd/conductor.py index ecd1aa13ab..7d65d2514f 100644 --- a/ironic/cmd/conductor.py +++ b/ironic/cmd/conductor.py @@ -81,7 +81,7 @@ def main(): profiler.setup('ironic_conductor', CONF.host) - launcher = service.launch(CONF, mgr) + launcher = service.launch(CONF, mgr, restart_method='mutate') launcher.wait() diff --git a/ironic/common/service.py b/ironic/common/service.py index a077889bb4..e0a8f1852d 100644 --- a/ironic/common/service.py +++ b/ironic/common/service.py @@ -36,4 +36,4 @@ def prepare_service(argv=None): def process_launcher(): - return service.ProcessLauncher(CONF) + return service.ProcessLauncher(CONF, restart_method='mutate') diff --git a/ironic/conf/default.py b/ironic/conf/default.py index 6611b96889..e1c709d39b 100644 --- a/ironic/conf/default.py +++ b/ironic/conf/default.py @@ -282,7 +282,7 @@ service_opts = [ 'hostname, FQDN, or IP address.')), cfg.StrOpt('pin_release_version', choices=versions.RELEASE_VERSIONS, - # TODO(xek): mutable=True, + mutable=True, help=_('Used for rolling upgrades. Setting this option ' 'downgrades (or pins) the Bare Metal API, ' 'the internal ironic RPC communication, and ' diff --git a/releasenotes/notes/sighup-service-reloads-configs-0e2462e3f064a2ff.yaml b/releasenotes/notes/sighup-service-reloads-configs-0e2462e3f064a2ff.yaml new file mode 100644 index 0000000000..ac3058ccaa --- /dev/null +++ b/releasenotes/notes/sighup-service-reloads-configs-0e2462e3f064a2ff.yaml @@ -0,0 +1,17 @@ +--- +features: + - | + Issuing a SIGHUP (e.g. ``pkill -HUP ironic``) to an ironic-api or + ironic-conductor service will cause the service to reload and use any + changed values for *mutable* configuration options. The mutable + configuration options are: + + * [DEFAULT]/debug + * [DEFAULT]/log_config_append + * [DEFAULT]/pin_release_version + + Mutable configuration options are indicated as such in the `sample configuration + file `_ + by ``Note: This option can be changed without restarting``. + + A warning is logged for any changes to immutable configuration options.