[Openstack] nova.conf changes for API extensions

Kevin L. Mitchell kevin.mitchell at rackspace.com
Fri Oct 21 21:26:46 UTC 2011


Short form: --osapi_extensions_path is now gone; use --osapi_extension,
which takes a different form of input.

Long form: Extensions have been refactored in a couple of ways.  For
one, the get_name(), get_alias(), get_description(), get_namespace(),
and get_updated() accessor methods are all gone; set name, alias,
namespace, and updated attributes instead, and use the docstring for the
description.

The more important change, for the purposes of nova.conf, is the
replacement of --osapi_extensions_path.  Before, this took a directory
name, and all extensions from that directory were loaded.  Now, you use
one or more instances of --osapi_extension to name a callable located
within the Python path.  For instance, if you extension was Foxinsocks,
located in foxinsocks.py, you would now use something like
package.path.to.foxinsocks.Foxinsocks.  Since this now loads only a
single extension, you are now able to use --osapi_extension multiple
times.

Note that it is not necessary to name every single extension that's
distributed with nova in nova.api.openstack.contrib; extensions in that
directory will be automatically loaded as long as they comply with the
previous naming convention (class needs the exact same name as the
module, with the first character upper-cased).

Further details: The argument to --osapi_extension must be a callable
taking one argument--the extension manager.  It must arrange to call the
register() method of the extension manager, passing it an extension
object (not class).  The ExtensionDescriptor object has been extended
with an __init__() method that does this, so all extensions inheriting
from it are automatically covered unless they override __init__() and
don't pass the argument to the superclass constructor.

To auto-load the extensions in nova.api.openstack.contrib, the
nova/api/openstack/contrib/__init__.py module now has a
standard_extensions() callable which walks the directory tree rooted
there and loads all other modules it finds, using the previously
established conventions.  This standard_extensions() function is simply
added to the default list of extensions to load.
-- 
Kevin L. Mitchell <kevin.mitchell at rackspace.com>

This email may include confidential information. If you received it in error, please delete it.


More information about the Openstack mailing list