← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1736114] [NEW] metadata_agent.ini cannot be built reproducibly

 

Public bug reported:

Hi,

When generating metadata_agent.ini, the metadata_workers directive
default value is filled with the number of CPUs used when building the
file. This makes the whole Neutron package not reproducible.

The config code is like this (from
neutron/conf/agent/metadata/config.py):

    cfg.IntOpt('metadata_workers',
               default=host.cpu_count() // 2,
               help=_('Number of separate worker processes for metadata '
                      'server (defaults to half of the number of CPUs)')),

Instead of writing this, the default value should be set to None, then
whenever something fetches the metadata_workers value, something like
this should be written (probably, a //2 should be added if we want to
retain the above):

def get_num_metadata_workers():
    """Return the configured number of workers."""
    if CONF.metadata_workers is None:
        # None implies the number of CPUs
        return processutils.get_worker_count()
    return CONF.metadata_workers

This way, the value really is taken from runtime, and not build time,
which is probably what the original author wanted to write. Note that
this type of fix has already been written in Glance, and many other
OpenStack packages.

** Affects: neutron
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1736114

Title:
  metadata_agent.ini cannot be built reproducibly

Status in neutron:
  New

Bug description:
  Hi,

  When generating metadata_agent.ini, the metadata_workers directive
  default value is filled with the number of CPUs used when building the
  file. This makes the whole Neutron package not reproducible.

  The config code is like this (from
  neutron/conf/agent/metadata/config.py):

      cfg.IntOpt('metadata_workers',
                 default=host.cpu_count() // 2,
                 help=_('Number of separate worker processes for metadata '
                        'server (defaults to half of the number of CPUs)')),

  Instead of writing this, the default value should be set to None, then
  whenever something fetches the metadata_workers value, something like
  this should be written (probably, a //2 should be added if we want to
  retain the above):

  def get_num_metadata_workers():
      """Return the configured number of workers."""
      if CONF.metadata_workers is None:
          # None implies the number of CPUs
          return processutils.get_worker_count()
      return CONF.metadata_workers

  This way, the value really is taken from runtime, and not build time,
  which is probably what the original author wanted to write. Note that
  this type of fix has already been written in Glance, and many other
  OpenStack packages.

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


Follow ups