Keyboard Shortcuts

File
u :up to issue
m :publish + mail comments
M :edit review message
j / k :jump to file after / before current file
J / K :jump to next file with a comment after / before current file
Side-by-side diff
i :toggle intra-line diffs
e :expand all comments
c :collapse all comments
s :toggle showing all comments
n / p :next / previous diff chunk or comment
N / P :next / previous comment
<Up> / <Down> :next / previous line
<Enter> :respond to / edit current comment
d :mark current comment as done
Issue
u :up to list of issues
m :publish + mail comments
j / k :jump to patch after / before current patch
o / <Enter> :open current patch in side-by-side view
i :open current patch in unified diff view
Issue List
j / k :jump to issue after / before current issue
o / <Enter> :open current issue
# : close issue
Comment/message editing
<Ctrl> + s or <Ctrl> + Enter :save comment
<Esc> :cancel edit
Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(404)
Issues Repositories Search
Open Issues | Closed Issues | All Issues | Sign in with your Google Account to create issues and add comments

Issue 37850043: state: AddMachine revamp continues

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 1 month ago by rog
Modified:
12 years ago
Reviewers:
mp+197934, dimitern
Visibility:
Public.
state: AddMachine revamp continues We bring the exported State methods closer to the underlying implementation. The old interface is still visible in the API, which we can't easily change for backward compatibility reasons. As a drive-by fix, we also remove state.Machine.TxnRevno because it's unnecessary. https://code.launchpad.net/~rogpeppe/juju-core/468-state-addmachines/+merge/197934 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : state: AddMachine revamp continues #

Patch Set 3 : state: AddMachine revamp continues #

Total comments: 31

Patch Set 4 : state: AddMachine revamp continues #

Patch Set 5 : state: AddMachine revamp continues #

Patch Set 6 : state: AddMachine revamp continues #

Patch Set 7 : state: AddMachine revamp continues #

Created: 12 years ago
Download [raw] [tar.bz2]
Unified diffs Side-by-side diffs Delta from patch set Stats (+585 lines, -679 lines) Patch
A [revision details] View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M agent/bootstrap.go View 1 chunk +1 line, -1 line 0 comments Download
M cmd/juju/addmachine.go View 1 2 3 4 5 6 1 chunk +14 lines, -8 lines 0 comments Download
M cmd/juju/addmachine_test.go View 1 2 3 4 5 2 chunks +3 lines, -2 lines 0 comments Download
M cmd/juju/addunit_test.go View 1 chunk +4 lines, -6 lines 0 comments Download
M cmd/juju/deploy_test.go View 1 2 3 4 5 6 1 chunk +4 lines, -5 lines 0 comments Download
M cmd/juju/status_test.go View 1 2 3 4 5 6 2 chunks +6 lines, -9 lines 0 comments Download
M cmd/jujud/machine_test.go View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M environs/manual/provisioner.go View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M juju/deploy.go View 1 2 3 4 5 6 1 chunk +7 lines, -10 lines 0 comments Download
M provider/common/bootstrap_test.go View 1 2 3 4 5 6 4 chunks +4 lines, -4 lines 0 comments Download
M state/addmachine.go View 1 2 3 4 5 6 8 chunks +128 lines, -171 lines 0 comments Download
M state/address.go View 1 2 chunks +9 lines, -1 line 0 comments Download
M state/api/client.go View 1 2 3 4 5 6 1 chunk +0 lines, -10 lines 0 comments Download
M state/api/params/params.go View 1 2 3 4 5 6 1 chunk +25 lines, -5 lines 0 comments Download
M state/api/provisioner/provisioner_test.go View 1 2 3 4 5 6 4 chunks +13 lines, -19 lines 0 comments Download
M state/apiserver/agent/agent_test.go View 1 2 3 4 5 6 1 chunk +5 lines, -6 lines 0 comments Download
M state/apiserver/client/client.go View 1 2 3 4 5 6 3 chunks +50 lines, -60 lines 0 comments Download
M state/apiserver/client/client_test.go View 1 2 3 4 5 6 5 chunks +64 lines, -89 lines 0 comments Download
M state/apiserver/provisioner/provisioner_test.go View 1 2 3 4 5 6 3 chunks +7 lines, -9 lines 0 comments Download
M state/assign_test.go View 1 2 3 4 5 6 4 chunks +16 lines, -28 lines 0 comments Download
M state/cleanup_test.go View 1 2 3 4 5 6 1 chunk +4 lines, -6 lines 0 comments Download
M state/export_test.go View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M state/machine.go View 1 2 3 4 5 6 3 chunks +1 line, -7 lines 0 comments Download
M state/machine_test.go View 1 2 3 4 5 6 6 chunks +21 lines, -42 lines 0 comments Download
M state/state_test.go View 1 2 3 4 5 6 19 chunks +136 lines, -130 lines 0 comments Download
M state/unit.go View 1 4 chunks +5 lines, -6 lines 0 comments Download
M state/watcher.go View 1 2 3 4 5 6 6 chunks +30 lines, -10 lines 0 comments Download
M worker/provisioner/container_initialisation_test.go View 1 2 3 chunks +8 lines, -12 lines 0 comments Download
M worker/provisioner/kvm-broker_test.go View 1 1 chunk +4 lines, -6 lines 0 comments Download
M worker/provisioner/lxc-broker_test.go View 1 1 chunk +4 lines, -6 lines 0 comments Download
M worker/provisioner/provisioner_test.go View 1 2 3 4 5 6 2 chunks +6 lines, -9 lines 0 comments Download
Total messages: 6
|
rog
Please take a look.
12 years, 1 month ago (2013年12月05日 18:46:07 UTC) #1
Please take a look.
Sign in to reply to this message.
dimitern
Looks great so far, just a bunch of mostly trivials. TxnRevNo removal should be part ...
12 years, 1 month ago (2013年12月06日 13:13:37 UTC) #2
Looks great so far, just a bunch of mostly trivials. TxnRevNo removal should be
part of the CL description.
https://codereview.appspot.com/37850043/diff/40001/juju/conn.go
File juju/conn.go (left):
https://codereview.appspot.com/37850043/diff/40001/juju/conn.go#oldcode366
juju/conn.go:366: // See https://bugs.launchpad.net/juju-core/+bug/1252799
Link this branch to bug 1252799 please.
https://codereview.appspot.com/37850043/diff/40001/state/addmachine.go
File state/addmachine.go (right):
https://codereview.appspot.com/37850043/diff/40001/state/addmachine.go#newcode68
state/addmachine.go:68: // AddMachineInsideNewMachine creates a new machine
within a container
This feels like Inception :)
https://codereview.appspot.com/37850043/diff/40001/state/addmachine.go#newcode74
state/addmachine.go:74: return nil, fmt.Errorf("cannot add a new container: %v",
err)
s/container/machine/ ?
https://codereview.appspot.com/37850043/diff/40001/state/addmachine.go#newcode84
state/addmachine.go:84: return nil, fmt.Errorf("cannot add a new container: %v",
err)
ditto?
https://codereview.appspot.com/37850043/diff/40001/state/addmachine.go#newcod...
state/addmachine.go:102: // AddOne machine adds a new machine configured
according to the
s/AddOne/AddOneMachine/
https://codereview.appspot.com/37850043/diff/40001/state/addmachine.go#newcod...
state/addmachine.go:104: func (st *State) AddOneMachine(template
MachineTemplate) (*Machine, error) {
Perhaps call this AddMachineWithTemplate? AddOneMachine is confusing given the
above call which seems to do the same, judging by the names.
https://codereview.appspot.com/37850043/diff/40001/state/addmachine.go#newcod...
state/addmachine.go:172: return MachineTemplate{}, fmt.Errorf("cannot inject a
machine without a nonce")
s/inject/add/ ? for consistency
https://codereview.appspot.com/37850043/diff/40001/state/api/params/params.go
File state/api/params/params.go (right):
https://codereview.appspot.com/37850043/diff/40001/state/api/params/params.go...
state/api/params/params.go:83: // series, constraints and jobs as the new
container.
s/the same series, constraints and jobs as the new container/the given series,
constraints, and jobs/ - I find that easier to parse.
https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/cli...
File state/apiserver/client/client_test.go (left):
https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/cli...
state/apiserver/client/client_test.go:1635: func (s *clientSuite)
TestClientInjectMachinesDefaultSeries(c *gc.C) {
why are these two tests removed?
https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/cli...
File state/apiserver/client/client_test.go (right):
https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/cli...
state/apiserver/client/client_test.go:1580: c.Assert(machines[2].Error,
gc.NotNil)
not even sure we need this when we're using ErrorMatches just below.
https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/cli...
state/apiserver/client/client_test.go:1582: c.Assert(machines[2].Error,
gc.NotNil)
d
https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/cli...
state/apiserver/client/client_test.go:1615: machines, err :=
s.APIState.Client().AddMachines(apiParams)
I thought we're not changing the client API for compatibility sake? If we're
renaming InjectMachines to AddMachines, we need to have the old method there and
also a test that both the new and the old one do the same (with a comment about
testing backward compatibility). Unless I'm not getting something right..
https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/cli...
state/apiserver/client/client_test.go:1650: c.Assert(machineResult.Error,
gc.NotNil)
again, not sure we need NotNil with ErrorMatches after that - the latter should
be enough.
https://codereview.appspot.com/37850043/diff/40001/state/cleanup_test.go
File state/cleanup_test.go (left):
https://codereview.appspot.com/37850043/diff/40001/state/cleanup_test.go#oldc...
state/cleanup_test.go:156: c.Assert(err, gc.IsNil)
why delete this?
https://codereview.appspot.com/37850043/diff/40001/state/machine.go
File state/machine.go (left):
https://codereview.appspot.com/37850043/diff/40001/state/machine.go#oldcode86
state/machine.go:86: TxnRevno int64 `bson:"txn-revno"`
I'm ok with landing txnrevno removal with this CL, but please update the
description to mention it.
https://codereview.appspot.com/37850043/diff/40001/state/machine_test.go
File state/machine_test.go (left):
https://codereview.appspot.com/37850043/diff/40001/state/machine_test.go#oldc...
state/machine_test.go:114: c.Assert(err, gc.IsNil)
why remove this assert?
https://codereview.appspot.com/37850043/diff/40001/state/watcher.go
File state/watcher.go (right):
https://codereview.appspot.com/37850043/diff/40001/state/watcher.go#newcode1116
state/watcher.go:1116: func getTxnRevno(coll *mgo.Collection, key string)
(int64, error) {
a little doc comment explaining why we need this would be helpful.
Sign in to reply to this message.
rog
Please take a look. https://codereview.appspot.com/37850043/diff/40001/juju/conn.go File juju/conn.go (left): https://codereview.appspot.com/37850043/diff/40001/juju/conn.go#oldcode366 juju/conn.go:366: // See https://bugs.launchpad.net/juju-core/+bug/1252799 On 2013年12月06日 ...
12 years ago (2013年12月19日 21:03:25 UTC) #3
Please take a look.
https://codereview.appspot.com/37850043/diff/40001/juju/conn.go
File juju/conn.go (left):
https://codereview.appspot.com/37850043/diff/40001/juju/conn.go#oldcode366
juju/conn.go:366: // See https://bugs.launchpad.net/juju-core/+bug/1252799
On 2013年12月06日 13:13:37, dimitern wrote:
> Link this branch to bug 1252799 please.
Done.
https://codereview.appspot.com/37850043/diff/40001/state/addmachine.go
File state/addmachine.go (right):
https://codereview.appspot.com/37850043/diff/40001/state/addmachine.go#newcode74
state/addmachine.go:74: return nil, fmt.Errorf("cannot add a new container: %v",
err)
On 2013年12月06日 13:13:37, dimitern wrote:
> s/container/machine/ ?
i never know when to refer to machines as containers...
we do different things in different places.
done.
https://codereview.appspot.com/37850043/diff/40001/state/addmachine.go#newcod...
state/addmachine.go:104: func (st *State) AddOneMachine(template
MachineTemplate) (*Machine, error) {
On 2013年12月06日 13:13:37, dimitern wrote:
> Perhaps call this AddMachineWithTemplate? AddOneMachine is confusing given the
> above call which seems to do the same, judging by the names.
I'm planning to move AddMachine out of state entirely.
Then we can rename AddOneMachine to AddMachine.
"AddMachineWithTemplate" is also confusing because the other AddMachine calls
have templates too.
https://codereview.appspot.com/37850043/diff/40001/state/addmachine.go#newcod...
state/addmachine.go:172: return MachineTemplate{}, fmt.Errorf("cannot inject a
machine without a nonce")
On 2013年12月06日 13:13:37, dimitern wrote:
> s/inject/add/ ? for consistency
done, slightly differently.
https://codereview.appspot.com/37850043/diff/40001/state/api/params/params.go
File state/api/params/params.go (right):
https://codereview.appspot.com/37850043/diff/40001/state/api/params/params.go...
state/api/params/params.go:83: // series, constraints and jobs as the new
container.
On 2013年12月06日 13:13:37, dimitern wrote:
> s/the same series, constraints and jobs as the new container/the given series,
> constraints, and jobs/ - I find that easier to parse.
Done.
https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/cli...
File state/apiserver/client/client_test.go (left):
https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/cli...
state/apiserver/client/client_test.go:1635: func (s *clientSuite)
TestClientInjectMachinesDefaultSeries(c *gc.C) {
On 2013年12月06日 13:13:37, dimitern wrote:
> why are these two tests removed?
Because TestClientAddMachinesDefaultSeries and TestClientAddMachinesWithSeries
already exist and duplicate the functionality.
https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/cli...
File state/apiserver/client/client_test.go (right):
https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/cli...
state/apiserver/client/client_test.go:1580: c.Assert(machines[2].Error,
gc.NotNil)
On 2013年12月06日 13:13:37, dimitern wrote:
> not even sure we need this when we're using ErrorMatches just below.
We do.
https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/cli...
state/apiserver/client/client_test.go:1582: c.Assert(machines[2].Error,
gc.NotNil)
On 2013年12月06日 13:13:37, dimitern wrote:
> d
ditto
https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/cli...
state/apiserver/client/client_test.go:1615: machines, err :=
s.APIState.Client().AddMachines(apiParams)
On 2013年12月06日 13:13:37, dimitern wrote:
> I thought we're not changing the client API for compatibility sake? If we're
> renaming InjectMachines to AddMachines, we need to have the old method there
and
> also a test that both the new and the old one do the same (with a comment
about
> testing backward compatibility). Unless I'm not getting something right..
I've added a test that InjectMachines still exists.
Given that it's a single line of code that calls AddMachines
and that I changed all the existing InjectMachine tests to
call AddMachines instead, I think that should be ok.
https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/cli...
state/apiserver/client/client_test.go:1650: c.Assert(machineResult.Error,
gc.NotNil)
On 2013年12月06日 13:13:37, dimitern wrote:
> again, not sure we need NotNil with ErrorMatches after that - the latter
should
> be enough.
Unfortunately not.
When the error is nil, ErrorMatches panics because it tries to call
params.Error.Error on a nil *params.Error.
https://codereview.appspot.com/37850043/diff/40001/state/cleanup_test.go
File state/cleanup_test.go (left):
https://codereview.appspot.com/37850043/diff/40001/state/cleanup_test.go#oldc...
state/cleanup_test.go:156: c.Assert(err, gc.IsNil)
On 2013年12月06日 13:13:37, dimitern wrote:
> why delete this?
Done.
https://codereview.appspot.com/37850043/diff/40001/state/machine_test.go
File state/machine_test.go (left):
https://codereview.appspot.com/37850043/diff/40001/state/machine_test.go#oldc...
state/machine_test.go:114: c.Assert(err, gc.IsNil)
On 2013年12月06日 13:13:37, dimitern wrote:
> why remove this assert?
editing error i think. done.
https://codereview.appspot.com/37850043/diff/40001/state/watcher.go
File state/watcher.go (right):
https://codereview.appspot.com/37850043/diff/40001/state/watcher.go#newcode1116
state/watcher.go:1116: func getTxnRevno(coll *mgo.Collection, key string)
(int64, error) {
On 2013年12月06日 13:13:37, dimitern wrote:
> a little doc comment explaining why we need this would be helpful.
Done.
Sign in to reply to this message.
dimitern
LGTM, thank you. https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/client_test.go File state/apiserver/client/client_test.go (right): https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/client_test.go#newcode1650 state/apiserver/client/client_test.go:1650: c.Assert(machineResult.Error, gc.NotNil) On 2013年12月19日 21:03:26, rog ...
12 years ago (2013年12月19日 21:09:29 UTC) #4
LGTM, thank you.
https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/cli...
File state/apiserver/client/client_test.go (right):
https://codereview.appspot.com/37850043/diff/40001/state/apiserver/client/cli...
state/apiserver/client/client_test.go:1650: c.Assert(machineResult.Error,
gc.NotNil)
On 2013年12月19日 21:03:26, rog wrote:
> On 2013年12月06日 13:13:37, dimitern wrote:
> > again, not sure we need NotNil with ErrorMatches after that - the latter
> should
> > be enough.
> 
> Unfortunately not.
> When the error is nil, ErrorMatches panics because it tries to call
> params.Error.Error on a nil *params.Error.
Good to know! Thanks.
Sign in to reply to this message.
rog
Please take a look.
12 years ago (2013年12月19日 21:11:29 UTC) #5
Please take a look.
Sign in to reply to this message.
rog
Please take a look.
12 years ago (2013年12月20日 12:17:12 UTC) #6
Please take a look.
Sign in to reply to this message.
|
Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b

AltStyle によって変換されたページ (->オリジナル) /