[openstack-dev] [nova][api] Is this a potential issue

Andrew Laski andrew.laski at rackspace.com
Mon Nov 18 15:18:48 UTC 2013


On 11/15/13 at 04:01pm, yunhong jiang wrote:
>On Fri, 2013-11-15 at 17:19 -0500, Andrew Laski wrote:
>> On 11/15/13 at 07:30am, Dan Smith wrote:
>> >> You're not missing anything.  But I think that's a bug, or at least an
>> >> unexpected change in behaviour from how it used to work.  If you follow
>> >> instance_update() in nova.db.sqlalchemy.api just the presence of
>> >> expected_task_state triggers the check.  So we may need to find a way to
>> >> pass that through with the save method.
>> >
>> >This came up recently. We decided that since we no longer have a kwargs
>> >dictionary to test for the presence or absence of that flag, that we
>> >would require setting it to a tuple, which is already supported for
>> >allowing multiple state possibilities. So, if you pass
>> >expected_task_state=(None,) then it will do the right thing.
>> >
>> >Make sense?
>>
>> Perfect.  I thought the old method was a bit counterintuitive and
>> started thinking this would be better after I sent the email earlier.
>>
>
>I checked and seems most usage of instance.save() with
>expected_state=None assume an exception and need change. Can I assume
>this rule apply to all?

Yes.

>
>If yes, would it be possible to create a special task_state as IDLE, to
>distinguish it better? When no task on-going, the task_state will be
>IDLE, instead of None.

I'm starting on some work right now which will break task_state off into 
it's own model and API resource.  In my opinion we don't need to model 
the idea of no task running, we can check if there are tasks for the 
instance or not.  So I think that using None is fine here and we 
shouldn't add an IDLE state.

>
>--jyh
>
>
>
>
>
>
>
>
>_______________________________________________
>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