
This rewrites the core logic of scatter-gather to use the futurist lib that provides a consistent API to use either Green or native ThreadPoolExecutor. This way the scatter-gather code can be made independent from the actual concurrency backend. In this change we also create a separate executor for the scatter-gather calls to better control it. A new config option [default]cell_worker_thread_pool_size is added to define the number of threads in this ThreadPoolExecutor. For the GreenThreadPoolExecutor case this config is ignored as only real threads are expensive, green threads doesn't. As oslo.sevice use os.fork(), and fork copies the parent process state to the children processes we need to make sure that the children processes get a proper, fresh executor state, so we destroy the executor just before the fork. The fixtures.SynchronousThreadPoolExecutorFixture is deleted. It was globally mocking futurist.GreenThreadPoolExecutor which would now mocking more than what we want. There was only one usage of it in the ComputeManager testing where it is replaced with a direct change of the manager internal executor in the test setup to get the same, but localized, result. Note that testing the threading mode is done in nova-next job in I36c68740fae3e3a9bd3286a1b66d86fd3341aff5, pool statistics reporting will be added by Id4244f5ae0fd49c99af2898789cdd510859e150d, and documentation about our threading tunables are in I003177de3a9f69c71c19eb8eaa7232785e03e669. Change-Id: Ibff6c73ad9af911a42204e53fee31ed5537c829d
89 lines
2.8 KiB
Python
89 lines
2.8 KiB
Python
# Copyright 2010 United States Government as represented by the
|
|
# Administrator of the National Aeronautics and Space Administration.
|
|
# Copyright 2011 Justin Santa Barbara
|
|
# All Rights Reserved.
|
|
#
|
|
# 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_config import cfg
|
|
|
|
base_options = [
|
|
cfg.IntOpt(
|
|
'password_length',
|
|
default=12,
|
|
min=0,
|
|
help='Length of generated instance admin passwords.'),
|
|
cfg.StrOpt(
|
|
'instance_usage_audit_period',
|
|
default='month',
|
|
regex='^(hour|month|day|year)(@([0-9]+))?$',
|
|
help='''
|
|
Time period to generate instance usages for. It is possible to define optional
|
|
offset to given period by appending @ character followed by a number defining
|
|
offset.
|
|
|
|
Possible values:
|
|
|
|
* period, example: ``hour``, ``day``, ``month` or ``year``
|
|
* period with offset, example: ``month@15`` will result in monthly audits
|
|
starting on 15th day of month.
|
|
'''),
|
|
cfg.BoolOpt(
|
|
'use_rootwrap_daemon',
|
|
default=False,
|
|
help='''
|
|
Start and use a daemon that can run the commands that need to be run with
|
|
root privileges. This option is usually enabled on nodes that run nova compute
|
|
processes.
|
|
'''),
|
|
cfg.StrOpt(
|
|
'rootwrap_config',
|
|
default="/etc/nova/rootwrap.conf",
|
|
help='''
|
|
Path to the rootwrap configuration file.
|
|
|
|
Goal of the root wrapper is to allow a service-specific unprivileged user to
|
|
run a number of actions as the root user in the safest manner possible.
|
|
The configuration file used here must match the one defined in the sudoers
|
|
entry.
|
|
'''),
|
|
cfg.StrOpt(
|
|
'tempdir',
|
|
help='Explicitly specify the temporary working directory.'),
|
|
cfg.IntOpt(
|
|
'default_green_pool_size',
|
|
default=1000,
|
|
min=100,
|
|
help='''
|
|
The total number of coroutines that can be run via nova's default
|
|
greenthread pool concurrently, defaults to 1000, min value is 100.
|
|
'''),
|
|
cfg.IntOpt(
|
|
'cell_worker_thread_pool_size',
|
|
default=5,
|
|
min=1,
|
|
help='''
|
|
The number of tasks that can run concurrently, one for each cell, for
|
|
operations requires cross cell data gathering a.k.a scatter-gather, like
|
|
listing instances across multiple cells.
|
|
'''),
|
|
]
|
|
|
|
|
|
def register_opts(conf):
|
|
conf.register_opts(base_options)
|
|
|
|
|
|
def list_opts():
|
|
return {'DEFAULT': base_options}
|