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

Issue 8256043: state: add machine status; refractor unit status (Closed)

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

Description

state: add machine status; refractor unit status Added Machine.Status() and SetStatus(), as with a unit. Since we're using the same code, a refactoring was in order: common code for managing statuses moved to a separate state collection (see status.go); status consts by the API and state added to state/api/params, so they can be accessed from both. Some changes to allWatcher/megawatcher code: because now Status and StatusInfo are no longer part of the unit document, you cannot watch for these changes, but arguably only the juju status command actually needs to read them, so the API should be handle this eventually. Drive-by fix: constranits and annotations (and now status) of the last unit of a service were not removed properly. Now they are. https://code.launchpad.net/~dimitern/juju-core/021-state-add-machine-status/+merge/156534 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 22

Patch Set 2 : state: add machine status; refractor unit status #

Total comments: 23

Patch Set 3 : state: add machine status; refractor unit status #

Total comments: 2

Patch Set 4 : state: add machine status; refractor unit status #

Unified diffs Side-by-side diffs Delta from patch set Stats (+332 lines, -95 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/builddb/main.go View 1 chunk +8 lines, -2 lines 0 comments Download
M cmd/juju/status.go View 1 2 2 chunks +15 lines, -19 lines 0 comments Download
M cmd/jujud/unit_test.go View 1 chunk +2 lines, -1 line 0 comments Download
M juju/conn.go View 1 chunk +5 lines, -1 line 0 comments Download
M state/api/params/params.go View 1 2 chunks +0 lines, -14 lines 0 comments Download
M state/api/params/params_test.go View 1 1 chunk +1 line, -3 lines 0 comments Download
A state/api/params/status.go View 1 2 1 chunk +51 lines, -0 lines 0 comments Download
M state/constraints.go View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M state/machine.go View 1 2 3 4 chunks +41 lines, -0 lines 0 comments Download
M state/machine_test.go View 1 2 1 chunk +55 lines, -0 lines 0 comments Download
M state/megawatcher_internal_test.go View 1 2 2 chunks +0 lines, -2 lines 0 comments Download
M state/open.go View 1 chunk +1 line, -0 lines 0 comments Download
M state/service.go View 1 2 4 chunks +30 lines, -25 lines 0 comments Download
M state/state.go View 1 2 3 chunks +13 lines, -7 lines 0 comments Download
M state/statecmd/resolved.go View 1 chunk +5 lines, -1 line 0 comments Download
A state/status.go View 1 2 1 chunk +53 lines, -0 lines 0 comments Download
M state/unit.go View 1 2 3 2 chunks +20 lines, -9 lines 0 comments Download
M state/unit_test.go View 1 2 1 chunk +28 lines, -9 lines 0 comments Download
M worker/uniter/uniter_test.go View 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 13
dimitern
Please take a look.
11 years ago (2013-04-02 12:09:56 UTC) #1
TheMue
LGTM, only getting a bit scared by the growing number of docs and collections.
11 years ago (2013-04-02 15:12:58 UTC) #2
fwereade
On 2013/04/02 15:12:58, TheMue wrote: > LGTM, only getting a bit scared by the growing ...
11 years ago (2013-04-02 15:21:55 UTC) #3
rog
LGTM with the below comments addressed. FWIW i echo frank's concerns. as discussed online i ...
11 years ago (2013-04-02 15:29:07 UTC) #4
fwereade
Looking good, but I'd like to see it again before it's merged please. https://codereview.appspot.com/8256043/diff/1/cmd/juju/status.go File ...
11 years ago (2013-04-02 15:33:42 UTC) #5
TheMue
On 2013/04/02 15:29:07, rog wrote: > LGTM with the below comments addressed. > > FWIW ...
11 years ago (2013-04-02 15:39:44 UTC) #6
dimitern
Thanks for the reviews! It really made the CL better after the suggestions! Will repropose ...
11 years ago (2013-04-03 09:33:00 UTC) #7
dimitern
Please take a look.
11 years ago (2013-04-03 09:39:06 UTC) #8
fwereade
On 2013/04/02 15:39:44, TheMue wrote: > On 2013/04/02 15:29:07, rog wrote: > > LGTM with ...
11 years ago (2013-04-03 11:13:57 UTC) #9
fwereade
I'd like a chat about the following, and agreement on which if any we're going ...
11 years ago (2013-04-03 11:42:34 UTC) #10
dimitern
Please take a look. https://codereview.appspot.com/8256043/diff/11001/cmd/juju/status.go File cmd/juju/status.go (right): https://codereview.appspot.com/8256043/diff/11001/cmd/juju/status.go#newcode224 cmd/juju/status.go:224: func processUnitStatus(r map[string]interface{}, status params.UnitStatus, ...
11 years ago (2013-04-03 14:29:26 UTC) #11
fwereade
LGTM, just a doc suggestion https://codereview.appspot.com/8256043/diff/21001/state/machine.go File state/machine.go (right): https://codereview.appspot.com/8256043/diff/21001/state/machine.go#newcode65 state/machine.go:65: // There is an ...
11 years ago (2013-04-03 14:39:11 UTC) #12
dimitern
11 years ago (2013-04-03 14:53:33 UTC) #13
*** Submitted:

state: add machine status; refractor unit status

Added Machine.Status() and SetStatus(), as with a unit.
Since we're using the same code, a refactoring was in
order: common code for managing statuses moved to a
separate state collection (see status.go); status consts
by the API and state added to state/api/params, so they
can be accessed from both.

Some changes to allWatcher/megawatcher code: because
now Status and StatusInfo are no longer part of the
unit document, you cannot watch for these changes, but
arguably only the juju status command actually needs
to read them, so the API should be handle this eventually.

Drive-by fix: constranits and annotations (and now status)
of the last unit of a service were not removed properly.
Now they are.

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

https://codereview.appspot.com/8256043/diff/21001/state/machine.go
File state/machine.go (right):

https://codereview.appspot.com/8256043/diff/21001/state/machine.go#newcode65
state/machine.go:65: // There is an implicit _id field here, which mongo
creates, which is the
On 2013/04/03 14:39:11, fwereade wrote:
> Mayse something a bit more like:
> 
> // The implicit _id field is explicitly specified set to the global key of the
> associated machine in the document's creation transaction, but is omitted to
> allow direct use of the document in both create and update transaction
> operations. 
> 
> ...and do the same for unit.

Done.
Sign in to reply to this message.

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