[openstack-dev] [devstack] Overriding settings file for devstack plugin

Sean Dague sean at dague.net
Wed Mar 25 10:28:06 UTC 2015


On 03/25/2015 03:16 AM, Deepak Shetty wrote:
> 
> 
> On Wed, Mar 25, 2015 at 11:29 AM, Deepak Shetty <dpkshetty at gmail.com
> <mailto:dpkshetty at gmail.com>> wrote:
> 
> 
> 
>     On Wed, Mar 25, 2015 at 12:58 AM, Ian Wienand <iwienand at redhat.com
>     <mailto:iwienand at redhat.com>> wrote:
> 
>         On 03/24/2015 03:17 PM, Deepak Shetty wrote:
>         > For eg: Look at [1]
>         > [1] https://github.com/stackforge/devstack-plugin-glusterfs/blob/master/devstack/settings
> 
>         > I would like ability to change these while I use the enable_plugin
>         > apporach to setup devstack w/ GlusterFS per my local glusterfs setup
> 
>         So I think the plugin should do
> 
>         CINDER_ENABLED_BACKENDS=${CINDER_ENABLED_BACKENDS:-glusterfs:glusterfs,lvm:lvm1}
> 
>         i.e. provide a default only if the variable is unset.
> 
> 
>     Bah! That was easy, i should have figured that myself :)
>     Thanks for catching that
>      
> 
> 
>         This seems like one of those "traps for new players" and is one
>         concern I have with devstack plugins -- that authors keep having to
>         find out lessons learned independently.  I have added a note on this
>         to the documentation in [1].
> 
>         -i
> 
>         [1] https://review.openstack.org/#/c/167375/
> 
> 
>     Great, i +1'ed it.
> 
>     Also i posted patch to fix settings file @
>     https://review.openstack.org/167494
> 
> 
> Ian,
>    Looks like usign bash default in settings file of plugin is not
> working, in my patch it didn't use glusterfs driver, it used LVM (default)
> I think whats happening here is that by the time settings file is
> sourced, CINDER_ENABLED_BACKENDS is already set to lvm by lib/cinder
> so settings file's default value is never taken
> 
> IIUC there are 3 scenarios (taking CINDER_ENABLED_BACKENDS as example var) :
> 
> 1) localrc doesn't have CINDER_ENABLED_BACKENDS and enable_plugin
>     - Here we want the lib/cinder's default value to be taken
>     - this should work fine
> 
> 2) localrc doesn't have CINDER_ENABLED_BACKENDS but has enable_plugin
> glusterfs
>     - Here we want the plugin's default values to be taken, but its not
> as lib/cinder already initialized CINDER_ENABLED_BACKENDS to use lvm backend
>     - Thus broken
> 
> 3) localrc has both CINDER_ENABLED_BACKENDS and enable_plugin glusterfs
> specified
>     - Here we want CINDER_ENABLED_BACKENDS present in my localrc to be
> chosen
>     - This will work as by the time settings file is sourced
> CINDER_ENABLED_BACKENDS is already initialised to my value in localrc
> 
> So #2 scenario would need some changes in stack.sh handling of plugin code ?

Right, so this code runs late enough that you don't get to change the
defaults. I think that's ok.

I would instead do the following:

1) CINDER_ENABLED_BACKENDS+=,glusterfs:glusterfs

or

2) CINDER_ENABLED_BACKENDS=glusterfs:glusterfs

in the plugin.

Clearly, if you've enabled the plugin, you want glusterfs. I think that
in most cases you probably only want glusterfs as your backend, so
option #2 seems sensible.

	-Sean

-- 
Sean Dague
http://dague.net

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 465 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150325/e6cebc80/attachment.pgp>


More information about the OpenStack-dev mailing list