[openstack-dev] [openstack][ironic] Event processing for async task improvement

Mario Villaplana mario.villaplana at gmail.com
Fri Nov 4 14:56:48 UTC 2016

I agree with the strategy Yuriy outlined. This has the added benefit
of mitigating potential future bugs related to callbacks in the task
manager since state "rollback" behavior will be implicitly built into
the task manager.

Details on the potential race condition with provision state change
notifications are noted in L511 here:

I find the risks in the notifications patch set acceptable for now,
but this would be a good general improvement afterwards, in my


On Sat, Oct 22, 2016 at 12:57 PM, Yuriy Zveryanskyy
<yzveryanskyy at mirantis.com> wrote:
> Hi.
> There is state rollback mechanism in ironic if conductor work thread can not
> be started for change provision state via API. And looks like we need the
> same for
> cleaning [1].
> This mechanism can not be clearly integrated with provision state
> notifications,
> in the start -> (end or error) scheme imlemented for async task error is
> "permanent" externally visible error like provision error, cleaning error,
> there is no FSM event that triggered this rollback etc. Due to these reasons
> current implementation of provision state notifications is overcomplex and
> potentially raceable [2].
> I propose do not change provision state until work thread is started. RFC
> 7231 does not require any type of "sync start" [3].
> All needed changes look like internal refactoring, no changes visible from
> external world.
> Details:
> - remove all callback related parameters from process_event() method. This
> is not
> breaking change because these parameters should be only used for conductor
> and not for drivers;
> - add event and related parameter to spawn_after() method. This method
> should only process event on the FSM and does not apply state changes to the
> node
> object and DB;
> - add new method post_process_event() (apply_states?) to task manager.
> Create
> a decorator that calls this method using task instance from args before main
> function. Not needed to add this decorator in the code manually to each
> function,
> callback functions can be decorated inside task manager;
> - remove hooks function for provision and cleaning, logging and last error
> setting
> can be done inside task manager.
> Have a nice time on the Summit.
> Note that I'm on PTO until Oct 31.
> [1] https://bugs.launchpad.net/ironic/+bug/1635619
> [2] https://review.openstack.org/#/c/348437/
> [3] https://tools.ietf.org/html/rfc7231#section-6.3.3
> Yuriy Zveryanskyy
> __________________________________________________________________________
> 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