Now that we don't test generate conf, we broke it with storpool driver

Bug #1405016 reported by John Griffith
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Committed
High
John Griffith

Bug Description

While setting up a job to perform nightly sample.conf generation and publish results to a web-page, discovered that a commit made a few days ago:

Broke the ability to parse config options in Cinder. If you try and run 'tox -egenconfig' you get this:

git/cinder.reviews - [master] » tox -egenconfig
genconfig create: /Users/jgriffith/git/cinder.reviews/.tox/venv
genconfig installdeps: -r/Users/jgriffith/git/cinder.reviews/requirements.txt, -r/Users/jgriffith/git/cinder.reviews/test-requirements.txt
genconfig develop-inst: /Users/jgriffith/git/cinder.reviews
genconfig runtests: commands[0] | /Users/jgriffith/git/cinder.reviews/tools/config/generate_sample.sh -b . -p cinder -o etc/cinder
Error importing module cinder.volume.drivers.storpool: No module named storpool
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/jgriffith/git/cinder.reviews/cinder/openstack/common/config/generator.py", line 307, in <module>
    main()
  File "/Users/jgriffith/git/cinder.reviews/cinder/openstack/common/config/generator.py", line 304, in main
    generate(sys.argv[1:])
  File "/Users/jgriffith/git/cinder.reviews/cinder/openstack/common/config/generator.py", line 130, in generate
    raise RuntimeError("Unable to import module %s" % mod_str)
RuntimeError: Unable to import module cinder.volume.drivers.storpool
Can not generate /Users/jgriffith/git/cinder.reviews/etc/cinder/cinder.conf.sample
ERROR: InvocationError: '/Users/jgriffith/git/cinder.reviews/tools/config/generate_sample.sh -b . -p cinder -o etc/cinder'
___________________________________________________________________________________ summary ____________________________________________________________________________________
ERROR: genconfig: commands failed
git/cinder.reviews - [master●] »

This appears to be due to an import in the storpool driver that doesn't exist in requirements.

description: updated
summary: - Now that we don't test generate conf, we broke it
+ Now that we don't test generate conf, we broke it with storpool driver
Jay Bryant (jsbryant)
Changed in cinder:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/143570

Changed in cinder:
assignee: nobody → John Griffith (john-griffith)
status: Confirmed → In Progress
Revision history for this message
Jay Bryant (jsbryant) wrote :

It looks like these imports are breaking the genconfig:

from storpool import spapi
from storpool import spopenstack
from storpool import sptypes

If you comment those out then the next problem it uncovers is the fact that they are not ever registering their opts. So, we definitely have some issues here.

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

Yeah, I was able to get genconfig to run to by adding in registration of the storpool_opts and commenting out the imports above.

How have we handled 3rd party libraries like this in the past?

Revision history for this message
John Griffith (john-griffith) wrote :

@Jay
Notice I already proposed a fix for this (comment #1).

 We've used try_import from oslo for some of these cases, and of course the conf registration just well... needs to be there :)

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

Sorry John, didn't see that earlier as our updates overlapped.

Thanks for tackling this.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/143570
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=84431839d972a9a2339ee220e3183130cd47c11c
Submitter: Jenkins
Branch: master

commit 84431839d972a9a2339ee220e3183130cd47c11c
Author: John Griffith <email address hidden>
Date: Mon Dec 22 17:05:01 2014 -0700

    Fix broken StorPool driver

    The newly added StorPool driver has a number of issues;
    It imports it's own 3'rd party libs which are not in the
    requirements file, it declares conf options but never registers
    them, and as a result of these two things it break the ability
    to generate a configuration file.

    This patch adds a try_import around the import storpool calls
    like we do in other drivers, and it registers the config options
    properly.

    We also move the api setting out of init and into the check_setup
    so the service doesn't crash if somebody tries to load the driver
    without the required storpool modules.

    Closes-Bug: 1405023
    Closes-Bug: 1405022
    Closes-Bug: 1405016
    Closes-Bug: 1403532

    Change-Id: I61340ab7c5abcdc21dbb12cf0693da036e69e90c

Changed in cinder:
status: In Progress → Fix Committed
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.