You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by Svetoslav Neykov <sv...@cloudsoftcorp.com> on 2015/03/18 15:18:14 UTC

STOP_MACHINE_MODE & IF_NOT_STOPPED

The STOP_MACHINE_MODE stop parameter introduced an unpleasant case where stopping the entity with STOP_MACHINE_MODE=NEVER and then stopping the parent application would leak the machine. This was fixed thanks to @nakomis at https://github.com/apache/incubator-brooklyn/pull/553 <https://github.com/apache/incubator-brooklyn/pull/553>.
The current behaviour of STOP_MACHINE_MODE is identical to the deprecated STOP_MACHINE=true/false, where StopMode.ALWAYS corresponds to true and StopMode.NEVER corresponds to false. IF_NOT_STOPPED behaves as ALWAYS (it will shutdown the machine if the machine is not shut down already). This makes STOP_MACHINE_MODE awkward to use, so any thoughts on should we:
  * Deprecate STOP_MACHINE_MODE and bring back STOP_MACHINE as the preferred parameter.
  * Make the default value for STOP_MACHINE_MODE=ALWAYS and revert to the previous behaviour of IF_NOT_STOPPED, where it would not stop the machine if the entity is already stopped.

I prefer the latter for consistency, though can't give real-world examples where IF_NOT_STOPPED would be needed.

Historically STOP behaved as if STOP_PROCESS_MODE=IF_NOT_STOPPED, STOP_MACHINE_MODE=IF_NOT_STOPPED, hence the state was introduced and made default.

If a machine needs to be leaked on purpose, to preserve some state, stop it with STOP_MACHINE_MODE=NEVER and unmanage the entity.

Svet.

Re: STOP_MACHINE_MODE & IF_NOT_STOPPED

Posted by Aled Sage <al...@gmail.com>.
Hi Svet,

If we fail to stop the machine (e.g. because it is already stopped), the 
does it continue? Or does it abort reporting failure?

Assuming stop's behaviour is sensible when the machine is not running, 
then your suggestion sounds good to me: to have 
`STOP_MACHINE_MODE=ALWAYS` as the default.

Aled


On 18/03/2015 14:18, Svetoslav Neykov wrote:
> The STOP_MACHINE_MODE stop parameter introduced an unpleasant case where stopping the entity with STOP_MACHINE_MODE=NEVER and then stopping the parent application would leak the machine. This was fixed thanks to @nakomis at https://github.com/apache/incubator-brooklyn/pull/553 <https://github.com/apache/incubator-brooklyn/pull/553>.
> The current behaviour of STOP_MACHINE_MODE is identical to the deprecated STOP_MACHINE=true/false, where StopMode.ALWAYS corresponds to true and StopMode.NEVER corresponds to false. IF_NOT_STOPPED behaves as ALWAYS (it will shutdown the machine if the machine is not shut down already). This makes STOP_MACHINE_MODE awkward to use, so any thoughts on should we:
>    * Deprecate STOP_MACHINE_MODE and bring back STOP_MACHINE as the preferred parameter.
>    * Make the default value for STOP_MACHINE_MODE=ALWAYS and revert to the previous behaviour of IF_NOT_STOPPED, where it would not stop the machine if the entity is already stopped.
>
> I prefer the latter for consistency, though can't give real-world examples where IF_NOT_STOPPED would be needed.
>
> Historically STOP behaved as if STOP_PROCESS_MODE=IF_NOT_STOPPED, STOP_MACHINE_MODE=IF_NOT_STOPPED, hence the state was introduced and made default.
>
> If a machine needs to be leaked on purpose, to preserve some state, stop it with STOP_MACHINE_MODE=NEVER and unmanage the entity.
>
> Svet.