osapi_volume_workers warning when unspecified

Bug #1367454 reported by Matthew Edmonds
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Medium
Jay Bryant

Bug Description

Seeing the following warning in cinder logs (juno):

cinder.service [-] Value of config option osapi_volume_workers must be integer greater than 1. Input value ignored.

We're not specifying this in cinder.conf, so the following OpenStack code from cinder/service.py attempts to get the default:

        self.workers = getattr(CONF, '%s_workers' % name,
                               processutils.get_worker_count())
        setup_profiler(name, self.host)

        if self.workers < 1:
            LOG.warn(_("Value of config option %(name)s_workers must be "
                       "integer greater than 1. Input value ignored.") %
                     {'name': name})
            # Reset workers to default
            self.workers = processutils.get_worker_count()

processutils.get_worker_count() looks like this:

    try:
        return multiprocessing.cpu_count()
    except NotImplementedError:
        return 1

and multiprocessing.cpu_count() returns this:

>>> import multiprocessing
>>> multiprocessing.cpu_count()
8

It looks to me like getattr is reading a value for osapi_volume_workers from the conf file even though there is no default set and we didn't specify this in the conf, preventing the default processutils.get_worker_count() from being returned by getattr when it should have been. It still works because processutils.get_worker_count() gets called again, but that shouldn't have been necessary, and neither should the warning (in this case).

Revision history for this message
Jay Bryant (jsbryant) wrote :

I have seen this as well.

Changed in cinder:
importance: Undecided → Medium
status: New → Confirmed
Jay Bryant (jsbryant)
Changed in cinder:
assignee: nobody → Jay Bryant (jsbryant)
Changed in cinder:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/122807
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=3d301346a7100e52fe0c319c1c1b5b81a3bc1660
Submitter: Jenkins
Branch: master

commit 3d301346a7100e52fe0c319c1c1b5b81a3bc1660
Author: Jay S. Bryant <email address hidden>
Date: Fri Sep 19 12:46:21 2014 -0500

    Fix unnecessary WSGI worker warning at API startup

    There was a bug in WSGIService in the way that it was
    checking the osapi_volume_workers option. It was using
    getattr() to see if the option was set, if not it was supposed
    to set the value to processutils.get_worker_count(). This,
    however, never happened because getattr interpreted the default
    'None' value to be a value. So, on any system with no value set
    the self.workers < 1 check would be hit and a warning would be
    output.

    Nova had changed their approach to this option to avoid this
    problem. This patch pulls Nova's approach into Cinder for
    consistency. Cinder will now use processutils.get_worker_count()
    if no option is set in /etc/cinder/cinder.conf and when the user sets
    osapi_volume_workers to 0. A negative value will cause an
    InvalidInput exception to be thrown.

    Unittests have been added for this functionality.

    Change-Id: I4ec2fdd0d19195cccffd63cdd1af1b9ca9884c7d
    Closes-bug: #1367454

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
milestone: none → juno-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: juno-rc1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.