[openstack-dev] [Nova][Oslo.cfg] Configuration string substitution

Gary Kotton gkotton at vmware.com
Wed Jun 18 14:34:10 UTC 2014



On 6/18/14, 4:19 PM, "Doug Hellmann" <doug.hellmann at dreamhost.com> wrote:

>On Wed, Jun 18, 2014 at 4:47 AM, Gary Kotton <gkotton at vmware.com> wrote:
>> Hi,
>> I have encountered a problem with string substitution with the nova
>> configuration file. The motivation was to move all of the glance
>>settings to
>> their own section (https://review.openstack.org/#/c/100567/). The
>> glance_api_servers had default setting that uses the current
>>glance_host and
>> the glance port. This is a problem when we move to the Œglance¹ section.
>> First and foremost I think that we need to decide on how we should
>>denote
>> the string substitutions for group variables and then we can dive into
>> implementation details. Does anyone have any thoughts on this?
>>
>> My thinking is that when we use we should use a format of
>>$<group>.<key>. An
>> example is below.
>>
>> Original code:
>>
>>     cfg.ListOpt('glance_api_servers',
>>                 default=['$glance_host:$glance_port'],
>>                 help='A list of the glance api servers available to
>>nova. '
>>                      'Prefix with
>>https://urldefense.proofpoint.com/v1/url?u=https:///&k=oIvRg1%2BdGAgOoM1B
>>IlLLqw%3D%3D%0A&r=eH0pxTUZo8NPZyF6hgoMQu%2BfDtysg45MkPhCZFxPEq8%3D%0A&m=t
>>PCYaurIa1F3hEMCd5LOOfvP785BZFa8M58fXpp0Lcw%3D%0A&s=2ac62a772fd5bd58fa7cf7
>>0a973956ba97f933d649fb2f95be7b7d3e18d2b086 for ssl-based glance api
>>servers.
>> '
>>                      '([hostname|ip]:port)'),
>>
>> Proposed change (in the glance section):
>>     cfg.ListOpt('api_servers',
>>                 default=[Œ$glance.host:$glance.port'],
>>                 help='A list of the glance api servers available to
>>nova. '
>>                      'Prefix with
>>https://urldefense.proofpoint.com/v1/url?u=https:///&k=oIvRg1%2BdGAgOoM1B
>>IlLLqw%3D%3D%0A&r=eH0pxTUZo8NPZyF6hgoMQu%2BfDtysg45MkPhCZFxPEq8%3D%0A&m=t
>>PCYaurIa1F3hEMCd5LOOfvP785BZFa8M58fXpp0Lcw%3D%0A&s=2ac62a772fd5bd58fa7cf7
>>0a973956ba97f933d649fb2f95be7b7d3e18d2b086 for ssl-based glance api
>>servers.
>> '
>>                      '([hostname|ip]:port)¹,
>>                 deprecated_group='DEFAULT¹,
>>
>> deprecated_name='glance_api_servers'),
>>
>> This would require some preprocessing on the oslo.cfg side to be able to
>> understand the $glance is the specific group and then host is the
>>requested
>> value int he group.
>>
>> Thanks
>> Gary
>
>Do we need to set the variable off somehow to allow substitutions that
>need the literal '.' after a variable? How often is that likely to
>come up?


To be honest I think that this is a real edge case. I had a chat with
markmc on IRC and he suggested a different approach, which I liked,
regarding the specific patch. That is, to set the default to None and when
the data is accessed to check if it is is None. If so then provide the
default values.

We may still nonetheless need something like this in the future.

>
>Doug
>
>>
>>
>> _______________________________________________
>> OpenStack-dev mailing list
>> OpenStack-dev at lists.openstack.org
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
>
>_______________________________________________
>OpenStack-dev mailing list
>OpenStack-dev at lists.openstack.org
>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev




More information about the OpenStack-dev mailing list