diff options
author | Rodolfo Alonso Hernandez <ralonsoh@redhat.com> | 2023-02-03 13:11:24 +0100 |
---|---|---|
committer | Rodolfo Alonso Hernandez <ralonsoh@redhat.com> | 2023-02-08 11:48:48 +0100 |
commit | 47fef55e25fb1b7d3c6c7d6083a916e26fd45b6d (patch) | |
tree | 1dc85e0acfe3f1f296bc58898560adc428787864 /neutron/conf | |
parent | 0a1cd10570ef9c9aacff4b7b400dd9f4077c8b2c (diff) | |
download | neutron-47fef55e25fb1b7d3c6c7d6083a916e26fd45b6d.tar.gz |
Add a method to retrieve and register "rpc_workers" config knob
This new method retrieves the config option "rpc_workers" from the
configuration. If this option is not loaded, the method registers
the ``neutron.conf.service.SERVICE_OPTS`` options before reading
the knob again.
Closes-Bug: #2004656
Related-Bug: #1889737
Change-Id: I1f99cb32f33cc91141136cb4e3fbd33715530c59
Diffstat (limited to 'neutron/conf')
-rw-r--r-- | neutron/conf/service.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/neutron/conf/service.py b/neutron/conf/service.py index 294116b73d..058b88d1bc 100644 --- a/neutron/conf/service.py +++ b/neutron/conf/service.py @@ -53,3 +53,12 @@ RPC_EXTRA_OPTS = [ def register_service_opts(opts, conf=cfg.CONF): conf.register_opts(opts) + + +def get_rpc_workers(conf=cfg.CONF): + """Retrieve the conf knob rpc_workers, register option first if needed""" + try: + return conf.rpc_workers + except cfg.NoSuchOptError: + register_service_opts(SERVICE_OPTS, conf=conf) + return conf.rpc_workers |