ironic/ironic/common/service.py
Ruby Loo 398462021b 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
2018-02-28 23:46:30 +00:00

40 lines
1.3 KiB
Python

# -*- encoding: utf-8 -*-
#
# Copyright © 2012 eNovance <licensing@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_log import log
from oslo_service import service
from ironic.common import config
from ironic.conf import CONF
from ironic.conf import opts
from ironic import objects
def prepare_service(argv=None):
argv = [] if argv is None else argv
log.register_options(CONF)
opts.update_opt_defaults()
config.parse_args(argv)
# NOTE(vdrok): We need to setup logging after argv was parsed, otherwise
# it does not properly parse the options from config file and uses defaults
# from oslo_log
log.setup(CONF, 'ironic')
objects.register_all()
def process_launcher():
return service.ProcessLauncher(CONF, restart_method='mutate')