Merge lp://staging/~chris.macnaughton/openstack-mojo-specs/upgrade-spec into lp://staging/openstack-mojo-specs

Proposed by Chris MacNaughton
Status: Merged
Merged at revision: 333
Proposed branch: lp://staging/~chris.macnaughton/openstack-mojo-specs/upgrade-spec
Merge into: lp://staging/openstack-mojo-specs
Diff against target: 357 lines (+297/-3)
6 files modified
helper/bundles/ubuntu-lite.yaml (+5/-0)
helper/collect/collect-ubuntu-lite (+1/-0)
helper/scripts/upgrade_all_units.py (+13/-0)
helper/utils/mojo_utils.py (+261/-3)
specs/dev/series_upgrade_ubuntu_lite/SPEC_INFO.txt (+1/-0)
specs/dev/series_upgrade_ubuntu_lite/manifest (+16/-0)
To merge this branch: bzr merge lp://staging/~chris.macnaughton/openstack-mojo-specs/upgrade-spec
Reviewer Review Type Date Requested Status
David Ames (community) Approve
Review via email: mp+337646@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Ryan Beisner (1chb1n) wrote :
Revision history for this message
David Ames (thedac) wrote :

I understand this is a WIP. Just some notes for the next revision(s).

Most (all?) juju ssh $UNIT sudo $CMD should be juju run --unit $UNIT $CMD. You get root for free and various --format output options more convenient for python.

A number of WIP print statements that either need logging statements or removal before landing. Not also the use of logging.error or logging.warn where appropriate.

The juju series-update commands, when is it safe to set this for an application that may have multiple units?

Individual try/except blocks look good. But it would make sense to have a top level try/except that determines success or failure based on raised exceptions in nested tries.

Larger question. At what point does it make more sense to create a bash script and scp it to the unit to run. Rather, than piecemeal commands over ssh? That might be a cleaner approach and it would be re-usable outside mojo.

review: Needs Fixing
Revision history for this message
Chris MacNaughton (chris.macnaughton) wrote :

Thanks for the suggestions, in addition to the comments inline, changes are incoming!

Several comments inline; regarding making a bash script rather than this approach, at the moment it is fairly isolated, and runnable with the script in helper/scripts/upgrade_all_units.py. One of the goals of this bit of code is that we will be able to migrate it easily into zaza (or just something else) at some point in the future, as a generic set of helper utilities that are consumable outside of mojo.

Revision history for this message
Chris MacNaughton (chris.macnaughton) :
330. By Chris MacNaughton

tidy a bit

331. By Chris MacNaughton

update handlers to get units started correctly

332. By Chris MacNaughton

updating series upgrade spec

333. By Chris MacNaughton

rename upgrade script

Revision history for this message
David Ames (thedac) wrote :

Need to fix linting errors. I expect this might be challenging as most of them are due to long lines in the bash snippets.

> Most (all?) juju ssh $UNIT sudo $CMD should be juju run --unit $UNIT $CMD. You get root for free and various --format output options more convenient for python.

The do-release-upgrade and the loop check after reboot makes sense to use SSH. The others, reboot and lsb_release check, make more sense as juju run.

Note: it turns out juju run --unit runs as root but juju run --machine runs as ubuntu user. Just for consistency.

> A number of WIP print statements that either need logging statements or removal before landing. Not also the use of logging.error or logging.warn where appropriate.

Still true. Some are commented but they should be removed or made logging statements. Use of logging.error and logging.warn suggestions still in effect.

review: Needs Fixing
334. By Chris MacNaughton

update to resolve lint issues and resolve discussions

- remove prints
- shift to use `juju run` where possible

Revision history for this message
Chris MacNaughton (chris.macnaughton) wrote :

A couple of things left to discuss:

> The juju series-update commands, when is it safe to set this for an application that may have multiple units?

At the moment, there is no possible config into the actual callable script, although it will only iterate through units, so, depending on the HA model of the hosted application, there shouldn't be service disruption as we will only be upgrading a single unit at a time for now.

> Individual try/except blocks look good. But it would make sense to have a top level try/except that determines success or failure based on raised exceptions in nested tries.

I'm open to working through doing something like this if we decide that it's necessary; however, I'm nervous to make this code perfect, given that the Juju core team has picked up a roadmap item that will reduce our "series_upgrade" function to something along the lines of `juju series-upgrade $machine_id`, at which point we will be removing almost all of the upgrade code. To make the cleanup of that easier, in the last commit I have comment fenced off the upgrade code, although I propose that it could be moved into a new helper alongside the mojo_utils.py for now to ensure isolation.

> Larger question. At what point does it make more sense to create a bash script and scp it to the unit to run. Rather, than piecemeal commands over ssh? That might be a cleaner approach and it would be re-usable outside mojo.

Rather than scp'ing a bash script, I am considering shifting the series of `juju ssh`'d commands into building a bash script that gets rendered (depends entirely on machine numbers, unit names & numbers, etc) and putting that into /tmp to execute this, as it would ease the run time a bit; however, the amount of time spent running these scripts pales in comparison to the runtime of the `do-release-upgrade`, so I'm not sure of the real value, except to improve readability (a good value, but questionable to me given that this code has been written to be deleted).

Revision history for this message
David Ames (thedac) wrote :

I think we are good at this point. The previous comment were topics I felt were answered previously. This looks good. I'll be merging. Several specs all back to trunk.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches