Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1817)

Issue 7497047: state: upgrade charm for services/units (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 1 month ago by dimitern
Modified:
11 years, 1 month ago
Reviewers:
mp+153853
Visibility:
Public.

Description

state: upgrade charm for services/units This introduces the following changes: - Service.SetCharm now performs validation on the configuration when changing the charm to ensure what's about to be set is compatible with the current service's charm. Also introduces multiple settings per service (one for each unique charm URL), and uses reference counting to manage these and clean them up. - Unit.SetCharmURL does more sanity checks before changing the unit's charm and also maintains the reference counts of service settings. Fixes LP bug #1063621. This CL was reverted before in r943, now reintroduced and made to work with current trunk. https://code.launchpad.net/~dimitern/juju-core/015-charm-upgrade-settings-refs/+merge/153853 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 15

Patch Set 2 : state: upgrade charm for services/units #

Total comments: 33

Patch Set 3 : state: upgrade charm for services/units #

Total comments: 16

Patch Set 4 : state: upgrade charm for services/units #

Patch Set 5 : state: upgrade charm for services/units #

Patch Set 6 : state: upgrade charm for services/units #

Unified diffs Side-by-side diffs Delta from patch set Stats (+543 lines, -67 lines) Patch
A [revision details] View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M state/conn_test.go View 1 3 chunks +22 lines, -3 lines 0 comments Download
M state/export_test.go View 2 chunks +14 lines, -1 line 0 comments Download
M state/open.go View 1 1 chunk +1 line, -0 lines 0 comments Download
M state/service.go View 1 2 3 8 chunks +219 lines, -20 lines 0 comments Download
M state/service_test.go View 1 3 chunks +191 lines, -2 lines 0 comments Download
M state/settings.go View 2 chunks +12 lines, -8 lines 0 comments Download
M state/state.go View 1 2 chunks +8 lines, -1 line 0 comments Download
M state/unit.go View 1 2 3 3 chunks +59 lines, -27 lines 0 comments Download
M state/watcher.go View 1 2 chunks +7 lines, -3 lines 0 comments Download
M worker/uniter/filter.go View 1 2 chunks +8 lines, -2 lines 0 comments Download

Messages

Total messages: 12
dimitern
Please take a look.
11 years, 1 month ago (2013-03-18 15:55:48 UTC) #1
fwereade
Mostly looking good, but WatchServiceConfig needs to look up the correct settings document (on the ...
11 years, 1 month ago (2013-03-18 16:10:18 UTC) #2
rog
this all looks fine to me at surface level, but i confess i am finding ...
11 years, 1 month ago (2013-03-19 11:54:30 UTC) #3
dimitern
Please take a look. https://codereview.appspot.com/7497047/diff/1/state/conn_test.go File state/conn_test.go (right): https://codereview.appspot.com/7497047/diff/1/state/conn_test.go#newcode77 state/conn_test.go:77: // AddConfigCharm clones a testing ...
11 years, 1 month ago (2013-03-19 14:37:31 UTC) #4
rog
the comments are much better thank you. a few more suggestions, then LGTM. https://codereview.appspot.com/7497047/diff/10001/state/service.go File ...
11 years, 1 month ago (2013-03-19 17:51:16 UTC) #5
fwereade
You're using the wrong charm url in unit.py; but if you're clear about the problem ...
11 years, 1 month ago (2013-03-20 09:11:30 UTC) #6
dimitern
Please take a look. https://codereview.appspot.com/7497047/diff/10001/state/service.go File state/service.go (right): https://codereview.appspot.com/7497047/diff/10001/state/service.go#newcode328 state/service.go:328: // otherwise returns an error). ...
11 years, 1 month ago (2013-03-20 09:45:56 UTC) #7
rog
LGTM with one last question https://codereview.appspot.com/7497047/diff/26001/state/service.go File state/service.go (right): https://codereview.appspot.com/7497047/diff/26001/state/service.go#newcode714 state/service.go:714: // settings document identified ...
11 years, 1 month ago (2013-03-20 10:42:42 UTC) #8
dimitern
https://codereview.appspot.com/7497047/diff/26001/state/service.go File state/service.go (right): https://codereview.appspot.com/7497047/diff/26001/state/service.go#newcode714 state/service.go:714: // settings document identified by this document's id. Every ...
11 years, 1 month ago (2013-03-20 10:44:29 UTC) #9
fwereade
Few more suggestions re documentation, but I'll leave it to your judgment. https://codereview.appspot.com/7497047/diff/26001/state/service.go File state/service.go ...
11 years, 1 month ago (2013-03-20 10:50:37 UTC) #10
rog
https://codereview.appspot.com/7497047/diff/26001/state/service.go File state/service.go (right): https://codereview.appspot.com/7497047/diff/26001/state/service.go#newcode719 state/service.go:719: // is responsible for deleting the old settings doc. ...
11 years, 1 month ago (2013-03-20 11:22:13 UTC) #11
dimitern
11 years, 1 month ago (2013-03-20 11:48:49 UTC) #12
*** Submitted:

state: upgrade charm for services/units

This introduces the following changes:
- Service.SetCharm now performs validation on the
configuration when changing the charm to ensure
what's about to be set is compatible with the
current service's charm. Also introduces multiple
settings per service (one for each unique charm URL),
and uses reference counting to manage these and clean
them up.
- Unit.SetCharmURL does more sanity checks before
changing the unit's charm and also maintains the
reference counts of service settings.

Fixes LP bug #1063621.

This CL was reverted before in r943, now reintroduced
and made to work with current trunk.

R=fwereade, rog
CC=
https://codereview.appspot.com/7497047

https://codereview.appspot.com/7497047/diff/26001/state/service.go
File state/service.go (right):

https://codereview.appspot.com/7497047/diff/26001/state/service.go#newcode368
state/service.go:368: // The unit adds a reference to the new settings doc with
this.
On 2013/03/20 10:50:37, fwereade wrote:
> // Add or create a reference to the new settings doc.

Done.

https://codereview.appspot.com/7497047/diff/26001/state/service.go#newcode373
state/service.go:373: // The service drops its reference to its old settings doc
with this.
On 2013/03/20 10:50:37, fwereade wrote:
> // Drop the reference to the old settings doc.
> 
> I still think it's clearer to move it down past the if, because the duplicated
> comments make it look like we're doing the same thing twice; if we had better
> locality it'd be clearer.

Done.

https://codereview.appspot.com/7497047/diff/26001/state/service.go#newcode714
state/service.go:714: // settings document identified by this document's id.
Every time a
On 2013/03/20 10:50:37, fwereade wrote:
> On 2013/03/20 10:42:43, rog wrote:
> > i find this a useful comment. one thing i hadn't picked up on before: what
> does
> > "this document" refer to in this context?
> 
> s/this/the/ I guess?

Done.

https://codereview.appspot.com/7497047/diff/26001/state/service.go#newcode719
state/service.go:719: // is responsible for deleting the old settings doc.
On 2013/03/20 11:22:13, rog wrote:
> On 2013/03/20 10:50:37, fwereade wrote:
> > Honestly, I'm not sure this adds anything (and it misses a detail on service
> > charm change). I think I'd prefer to stick to the original.
> 
> it might not add anything for you, but it's useful for me (and i'd presume for
> other people coming to this code from cold).
> 
> if there's a missing detail, let's add it.
> 

Finally, changed as agreed online.

https://codereview.appspot.com/7497047/diff/26001/state/unit.go
File state/unit.go (right):

https://codereview.appspot.com/7497047/diff/26001/state/unit.go#newcode510
state/unit.go:510: // Update new settings doc ref count.
On 2013/03/20 10:50:37, fwereade wrote:
> // Add a reference to the service settings for the new charm.

Done.

https://codereview.appspot.com/7497047/diff/26001/state/unit.go#newcode527
state/unit.go:527: // Update old settings doc ref count.
On 2013/03/20 10:50:37, fwereade wrote:
> // Drop the reference to the old charm.

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b