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

Issue 7035060: state: unit with subordinates cannot become Dead

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 3 months ago by fwereade
Modified:
11 years, 3 months ago
Reviewers:
mp+141930, rog, TheMue
Visibility:
Public.

Description

state: unit with subordinates cannot become Dead https://code.launchpad.net/~fwereade/juju-core/unit-death-restrictions/+merge/141930 Requires: https://code.launchpad.net/~fwereade/juju-core/machine-death-restrictions/+merge/141088 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : state: unit with subordinates cannot become Dead #

Patch Set 3 : state: unit with subordinates cannot become Dead #

Total comments: 1

Patch Set 4 : state: unit with subordinates cannot become Dead #

Total comments: 4

Patch Set 5 : state: unit with subordinates cannot become Dead #

Unified diffs Side-by-side diffs Delta from patch set Stats (+195 lines, -35 lines) Patch
A [revision details] View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M state/assign_test.go View 3 chunks +10 lines, -6 lines 0 comments Download
M state/service_test.go View 1 2 3 3 chunks +14 lines, -8 lines 0 comments Download
M state/unit.go View 1 2 3 3 chunks +39 lines, -9 lines 0 comments Download
M state/unit_test.go View 2 chunks +55 lines, -5 lines 0 comments Download
M worker/uniter/modes.go View 1 2 3 4 2 chunks +25 lines, -3 lines 0 comments Download
M worker/uniter/uniter_test.go View 1 2 5 chunks +50 lines, -4 lines 0 comments Download

Messages

Total messages: 11
fwereade
Please take a look.
11 years, 3 months ago (2013-01-04 15:07:27 UTC) #1
fwereade
On 2013/01/04 15:07:27, fwereade wrote: > Please take a look. Whoops, I think I need ...
11 years, 3 months ago (2013-01-04 21:52:52 UTC) #2
fwereade
Please take a look.
11 years, 3 months ago (2013-01-07 09:09:35 UTC) #3
fwereade
On 2013/01/07 09:09:35, fwereade wrote: > Please take a look. OK, this is a complete ...
11 years, 3 months ago (2013-01-07 09:12:42 UTC) #4
fwereade
Please take a look.
11 years, 3 months ago (2013-01-07 09:20:26 UTC) #5
rog
looks good except the below. https://codereview.appspot.com/7035060/diff/7001/worker/uniter/modes.go File worker/uniter/modes.go (right): https://codereview.appspot.com/7035060/diff/7001/worker/uniter/modes.go#newcode198 worker/uniter/modes.go:198: case _, ok := ...
11 years, 3 months ago (2013-01-07 13:45:52 UTC) #6
fwereade
On 2013/01/07 13:45:52, rog wrote: > looks good except the below. > > https://codereview.appspot.com/7035060/diff/7001/worker/uniter/modes.go > ...
11 years, 3 months ago (2013-01-07 20:32:41 UTC) #7
fwereade
Please take a look.
11 years, 3 months ago (2013-01-07 20:38:50 UTC) #8
rog
LGTM https://codereview.appspot.com/7035060/diff/11001/worker/uniter/modes.go File worker/uniter/modes.go (right): https://codereview.appspot.com/7035060/diff/11001/worker/uniter/modes.go#newcode205 worker/uniter/modes.go:205: if u.unit.HasSubordinates() { although I suggested you add ...
11 years, 3 months ago (2013-01-08 15:49:41 UTC) #9
TheMue
Mostly LGTM, one comment. https://codereview.appspot.com/7035060/diff/11001/worker/uniter/modes.go File worker/uniter/modes.go (right): https://codereview.appspot.com/7035060/diff/11001/worker/uniter/modes.go#newcode208 worker/uniter/modes.go:208: if err := u.unit.EnsureDead(); err ...
11 years, 3 months ago (2013-01-08 16:22:24 UTC) #10
fwereade
11 years, 3 months ago (2013-01-08 20:57:11 UTC) #11
*** Submitted:

state: unit with subordinates cannot become Dead

R=rog, TheMue
CC=
https://codereview.appspot.com/7035060

https://codereview.appspot.com/7035060/diff/11001/worker/uniter/modes.go
File worker/uniter/modes.go (right):

https://codereview.appspot.com/7035060/diff/11001/worker/uniter/modes.go#newc...
worker/uniter/modes.go:205: if u.unit.HasSubordinates() {
On 2013/01/08 15:49:41, rog wrote:
> although I suggested you add Unit.HasSubordinates, i don't think it's worth
> actually calling here :-)
> 
> i'd just go with the old code. my gripe was with state, not here.

Given TheMue's observation, I think I'd prefer to drop the specific-error
checking below.

https://codereview.appspot.com/7035060/diff/11001/worker/uniter/modes.go#newc...
worker/uniter/modes.go:208: if err := u.unit.EnsureDead(); err ==
state.ErrUnitHasSubordinates {
On 2013/01/08 16:22:24, TheMue wrote:
> This error should not be returned if HasSubordinates() returned true and the
> loop continued before. So IMHO the test before is not needed.

This is only correct given an additional assumption (that the unit is Dying)...
which should indeed always be true, so I guess we can drop it. Cheers.
Sign in to reply to this message.

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