← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1994056] Re: nova-api does not support config dirs when run under apache via mod_wsgi

 

Reviewed:  https://review.opendev.org/c/openstack/nova/+/864014
Committed: https://opendev.org/openstack/nova/commit/73fe84fa0ea6f7c7fa55544f6bce5326d87743a6
Submitter: "Zuul (22348)"
Branch:    master

commit 73fe84fa0ea6f7c7fa55544f6bce5326d87743a6
Author: Sean Mooney <work@xxxxxxxxxxxxxxx>
Date:   Tue Nov 8 15:00:22 2022 +0000

    Support multiple config file with mod_wsgi
    
    Unlike uwsgi, apache mod_wsgi does not support passing
    commandline arguments to the python wsgi script it invokes.
    
    As a result while you can pass --config-file when hosting the
    api and metadata wsgi applications with uwsgi there is no
    way to use multiple config files with mod_wsgi.
    
    This change mirrors how this is supported in keystone today
    by intoducing a new OS_NOVA_CONFIG_FILES env var to allow
    operators to optional pass a ';' delimited list of config
    files to load.
    
    This change also add docs for this env var and the existing
    undocumented OS_NOVA_CONFIG_DIR.
    
    Closes-Bug: 1994056
    Change-Id: I8e3ccd75cbb7f2e132b403cb38022787c2c0a37b


** Changed in: nova
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1994056

Title:
  nova-api does not support config dirs when run under apache via
  mod_wsgi

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  currently nova assume that when the nova-api si run under a wsgi server that server supports
  passing command line arguments to the wsgi script.

  that is not the case with mod_wsgi

  as a result we do not support using a config director when running
  under mod_wsgi or passing any other arguments.

  as a result when we run nova-api under mod_wsgi we fallback to a
  hardcoded set of config file names

  https://github.com/openstack/nova/blob/b1958b7cfa6b8aca5b76b3f133627bb733d29f00/nova/api/openstack/wsgi_app.py#L34-L46

  CONFIG_FILES = ['api-paste.ini', 'nova.conf']

  LOG = logging.getLogger(__name__)

  objects.register_all()

  
  def _get_config_files(env=None):
      if env is None:
          env = os.environ
      dirname = env.get('OS_NOVA_CONFIG_DIR', '/etc/nova').strip()
      return [os.path.join(dirname, config_file)
              for config_file in CONFIG_FILES]

  
  This prevents operators form using the /etc/nova/nova.config.d/
  to provide a directory containing multiple config files 

  This can be addressed in several ways.

  first we can provide a env varabel for additional command line args to be parsed 
  these can be parsed here as we do for uwsgi or the python wsgi server
  https://github.com/openstack/nova/blob/b1958b7cfa6b8aca5b76b3f133627bb733d29f00/nova/api/openstack/wsgi_app.py#L96-L98

  second we could replace or augment our custom _get_config_files with a
  call to the genirc implementation provide in oslo.config

  https://github.com/openstack/oslo.config/blob/68cefad313bd03522e99b3de95f1786ebea45d4b/oslo_config/cfg.py#L281-L339

  thrid we can provide a way to extend 
  CONFIG_FILES = ['api-paste.ini', 'nova.conf']
  via a new env var.
  e.g. OS_NOVA_EXTRA_CONFIGS="nova.config.d/01-nova.conf,nova.config.d/02-nova-secret.conf,"

  we can do all three or any one of them to enable the usecase of
  supporting config directories although only the first option allows
  other command line args to be passed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1994056/+subscriptions



References