Merge lp://qastaging/~free.ekanayaka/landscape-charm/dont-restart-services-unnecessarily into lp://qastaging/~landscape/landscape-charm/trunk

Proposed by Free Ekanayaka
Status: Merged
Approved by: Free Ekanayaka
Approved revision: 310
Merged at revision: 309
Proposed branch: lp://qastaging/~free.ekanayaka/landscape-charm/dont-restart-services-unnecessarily
Merge into: lp://qastaging/~landscape/landscape-charm/trunk
Diff against target: 401 lines (+238/-35)
5 files modified
lib/callbacks/filesystem.py (+3/-7)
lib/callbacks/scripts.py (+55/-12)
lib/callbacks/tests/test_scripts.py (+89/-10)
lib/tests/test_utils.py (+52/-6)
lib/utils.py (+39/-0)
To merge this branch: bzr merge lp://qastaging/~free.ekanayaka/landscape-charm/dont-restart-services-unnecessarily
Reviewer Review Type Date Requested Status
Björn Tillenius (community) Approve
Adam Collard (community) Approve
🤖 Landscape Builder test results Approve
Review via email: mp+261696@code.qastaging.launchpad.net

Commit message

This branch makes the LSCtl callback a bit smarter and avoid restarting services in a few situations that don't require a restart. For instance:

- If the SSL certificate change (since we don't load it in memory)

- If the postgresql relation data changed in a way that doesn't affect connection details (for example a new landscape-server unit was added and it's popping up in the allowed_units key).

There is also a small cleanup of repeated logic for finding a certain key in the required_data list of a ServiceManager.

Description of the change

This branch makes the LSCtl callback a bit smarter and avoid restarting services in a few situations that don't require a restart. For instance:

- If the SSL certificate change (since we don't load it in memory)

- If the postgresql relation data changed in a way that doesn't affect connection details (for example a new landscape-server unit was added and it's popping up in the allowed_units key).

There is also a small cleanup of repeated logic for finding a certain key in the required_data list of a ServiceManager.

Note that since this is mainly an optimization it's a bit hard to add an integration test for it. Perhaps we could look at the logs, but it's quite brittle and would somehow depend on test ordering. Maybe we can find a good way later down the road if we want.

To post a comment you must log in.
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :
review: Approve (test results)
Revision history for this message
Adam Collard (adam-collard) wrote :

Code looks good, just one comment. Need to do the testing before I +1,

Revision history for this message
Adam Collard (adam-collard) wrote :

Confirmed that Landscape didn't restart after setting some of the non-restart keys

review: Approve
Revision history for this message
Björn Tillenius (bjornt) wrote :

Looks good. I was surprised to see that this doesn't seem to affect the time it takes to add a new unit, but maybe my computer wasn't completely idle when I tested it. It does seem that this branch prevents landscape-server/0 from restarting when adding a new unit. landscape-server/1 starts twice, though, so as a follow-up branch it would be nice to reduce that to once.

review: Approve
310. By Free Ekanayaka

Drop redundant comment

Revision history for this message
Free Ekanayaka (free.ekanayaka) :

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