[openstack-dev] Nova extension oddness?

Joshua Harlow harlowja at yahoo-inc.com
Wed Sep 5 19:51:19 UTC 2012

Hi all,

In looking at how 'launch-index' works in the OS nova api (its used when you spin up more than 1 instance in 1 api call) I was seeing that extensions almost seem to be used as configuration 'flags', is that the purpose? I always thought of an extension as something you could hook-in that would override default behavior (which some of the extensions seem to be doing), not something that was tied to the main program  so tightly.

An example:

        min_count = 1
        max_count = 1
        if self.ext_mgr.is_loaded('os-multiple-create'):
            ret_resv_id = server_dict.get('return_reservation_id', False)
            min_count = server_dict.get('min_count', 1)
            max_count = server_dict.get('max_count', min_count)

This is in nova/api/openstack/computer/servers.py (~L700). Is that how we want to proceed with extension, or does there need to be refactoring to make the right 'hook-in' points be used; say have the create server 'top' level code go through various 'states', where each 'state' can be adjusted by an extension (more data added, different configuration…), with no checking of extensions being loaded in the top level code. There seems to be multiple cases of extensions being used as boolean flags there and I wonder if that’s the right approach?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20120905/72b7de2a/attachment.html>

More information about the OpenStack-dev mailing list