Unit state during charm upgrade

Kapil Thangavelu kapil.thangavelu at canonical.com
Mon Mar 5 15:48:17 UTC 2012


Excerpts from Francesco Banconi's message of 2012-03-05 09:03:56 -0500:
> Hi everybody,
> 
> while working on functional tests for our charms, I've seen that, having
> a started unit, the unit state remains "started" during charm upgrade.
> 
> In my tests I ended up waiting a few seconds before checking the unit
> state using `juju status`. However, in my opinion, the charm upgrade
> could be more testable if a state transition is performed during upgrade.
> E.g.: the charm switch to state "pending" (or "upgrading" or something
> else) when `juju upgrade-charm` is invoked, and then back again to
> "started" if the hook completes successfully.
> 
> I hope my suggestion will be of some use.
> Thank you!

what's the value add? if the upgrade hook executes quickly enough its just 
introducing a race condition around watching for an ephemeral state.

additional notes.

if the upgrade hook fails, the unit does transition to an error state.

during upgrades, relation and lifecycle hooks are not executed until the 
upgrade is complete, ie. the upgrade hook is guaranteed to be the first hook 
executed from the new unit.

the charmrunner package (http://launchpad.net/charmrunner) has a nice cli 
abstraction (juju-watch) around service watching, which takes into account a 
service's units, machines, and its relations.

cheers,

Kapil



More information about the Juju mailing list