[openstack-dev] [Oslo][Designate][Congress] Problem with from_dict overrides and new oslo.context release

Ben Nemec openstack at nemebean.com
Tue Oct 10 16:02:37 UTC 2017



On 10/10/2017 07:14 AM, Graham Hayes wrote:
> 
> 
> On 09/10/17 18:03, Ben Nemec wrote:
>> Hi,
>>
>> I brought up the fix[1] I proposed for [2] in the Oslo meeting today,
>> and it led to some good discussion that we wanted to take to a broader
>> audience.  In particular, the projects that are affected by the bug.
>>
>> The oslo.context change I proposed would essentially obsolete the
>> from_dict function in the Context object since it would obligate us to
>> support all the keys in to_dict in the constructor.  This unfortunately
>> implies some rather rigid constraints on the Context object.  We could
>> essentially never remove any parameters from the constructor (which at
>> some point we want to do for things like "tenant" that are deprecated
>> but still present) or risk breaking if someone passed in parameters from
>> an old to_dict call.
>>
>> The other proposal was to rewrite the existing naive from_dict overrides
>> in the affected projects to function more like the from_dict in the base
>> class where it explicitly handles only the keys that the constructor
>> will recognize.[3]  One benefit of this approach is that it would allow
>> the removal of some previous workarounds[4].  This is also cleaner from
>> an API perspective as it doesn't impose any new requirements on the
>> oslo.context API.  The obvious drawback is that it requires
>> project-specific fixes in the affected projects.  We would, of course,
>> be happy to help with those fixes though.
>>
>> So those are the options we've discussed and my thoughts on them. Please
>> feel free to weigh in with any other input you may have.  Thanks.
>>
>> -Ben
>>
>> 1: https://review.openstack.org/509919
>> 2: https://launchpad.net/bugs/1721432
>> 3:
>> https://github.com/openstack/oslo.context/blob/master/oslo_context/context.py#L371
>>
>> 4:
>> https://github.com/openstack/designate/blob/46de766e513cfb97cbfc50b001734e02711517e4/designate/context.py#L42
>>
>>
> 
> I am happy to do whatever work is needed on the Designate side for a
> good generic solution. We keep running into issues with our custom
> `from_dict` so anything I can do to help avoid it would be great.

Cool, I've proposed https://review.openstack.org/510917 which I believe 
will help avoid such issues in the future.  I think we can generalize it 
to the point where projects don't even have to carry an override for 
from_dict to get their custom keys respected, but in the meantime this 
should unblock things.

I'm also working on something similar for Congress, but I wanted to get 
this out there for comment ASAP.  I'll do the generalization as a 
follow-up since it will require changes across oslo.context and the 
consuming projects.

> 
> I put up a change to block 2.19.1 until we can pass the gate [1] with
> the new solution
> 
> - Graham
> 
> 1 - https://review.openstack.org/510857
> 
>> __________________________________________________________________________
>> OpenStack Development Mailing List (not for usage questions)
>> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
>>
>> __________________________________________________________________________
>> OpenStack Development Mailing List (not for usage questions)
>> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev



More information about the OpenStack-dev mailing list