<div dir="ltr"><div>Hi.<br><br></div><div>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<br></div><div>cleaning [1].<br></div><div>This mechanism can not be clearly integrated with provision state notifications,<br></div><div>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].<br></div><div>I propose do not change provision state until work thread is started. RFC 7231 does not require any type of "sync start" [3].<br></div><div>All needed changes look like internal refactoring, no changes visible from external world.<br></div><div>Details:<br></div><div>- remove all callback related parameters from process_event() method. This is not<br></div><div>breaking change because these parameters should be only used for conductor and not for drivers;<br></div><div>- 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<br></div><div>object and DB;<br></div><div>- add new method post_process_event() (apply_states?) to task manager. Create<br></div><div>a decorator that calls this method using task instance from args before main<br></div><div>function. Not needed to add this decorator in the code manually to each function,<br></div><div>callback functions can be decorated inside task manager;<br></div><div>- remove hooks function for provision and cleaning, logging and last error setting<br></div><div>can be done inside task manager.<br><br></div><div>Have a nice time on the Summit.<br></div><div>Note that I'm on PTO until Oct 31.<br></div><div><span class="gmail-pl-v"></span><br>[1] <a href="https://bugs.launchpad.net/ironic/+bug/1635619">https://bugs.launchpad.net/ironic/+bug/1635619</a><br>[2] <a href="https://review.openstack.org/#/c/348437/">https://review.openstack.org/#/c/348437/</a><br>[3] <a rel="nofollow" target="_blank" href="https://tools.ietf.org/html/rfc7231#section-6.3.3">https://tools.ietf.org/html/rfc7231#section-6.3.3</a><br><br></div><div>Yuriy Zveryanskyy<br><br></div></div>