← Back to team overview

yahoo-eng-team team mailing list archive

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

 

Public bug reported:

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.

** Affects: nova
     Importance: Medium
     Assignee: sean mooney (sean-k-mooney)
         Status: Triaged


** Tags: api config

-- 
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):
  Triaged

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



Follow ups