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

Issue 8561044: state: add nonced provisioning support (Closed)

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

Description

state: add nonced provisioning support Next step in nonced provisioning; adding support in state: machine.SetInstanceId() renamed to SetProvisioned(), taking instance id and nonce. It allows you change it only once, so some tests that assumed too much had to be changed (e.g. changing instance id several times just to trigger a machine change). Also CheckProvisioned() is added to machine, taking a nonce and returning true is returned only when the instance id is set and the nonce matches. In the upcoming CL we'll bring everything together - PA generating an unique nonce, and checking it. https://code.launchpad.net/~dimitern/juju-core/027-state-supports-nonced-provisioning/+merge/157853 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 19

Patch Set 2 : state: add nonced provisioning support #

Total comments: 12

Patch Set 3 : state: add nonced provisioning support #

Patch Set 4 : state: add nonced provisioning support #

Unified diffs Side-by-side diffs Delta from patch set Stats (+121 lines, -63 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/juju/ssh_test.go View 1 chunk +1 line, -1 line 0 comments Download
M cmd/juju/status_test.go View 1 chunk +1 line, -1 line 0 comments Download
M state/apiserver/api_test.go View 1 2 3 9 chunks +29 lines, -25 lines 0 comments Download
M state/machine.go View 1 2 3 2 chunks +30 lines, -8 lines 0 comments Download
M state/machine_test.go View 1 7 chunks +32 lines, -10 lines 0 comments Download
M state/megawatcher_internal_test.go View 4 chunks +4 lines, -4 lines 0 comments Download
M state/state.go View 4 chunks +4 lines, -3 lines 0 comments Download
M state/state_test.go View 1 2 5 chunks +7 lines, -4 lines 0 comments Download
M state/unit_test.go View 1 chunk +1 line, -1 line 0 comments Download
M worker/deployer/deployer_test.go View 1 chunk +1 line, -1 line 0 comments Download
M worker/firewaller/firewaller_test.go View 1 chunk +1 line, -1 line 0 comments Download
M worker/provisioner/provisioner.go View 1 2 chunks +6 lines, -2 lines 0 comments Download
M worker/uniter/filter_test.go View 1 chunk +1 line, -1 line 0 comments Download
M worker/uniter/uniter_test.go View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 14
dimitern
Please take a look.
11 years ago (2013-04-09 12:11:05 UTC) #1
fwereade
Couple of tweaks https://codereview.appspot.com/8561044/diff/1/state/machine.go File state/machine.go (right): https://codereview.appspot.com/8561044/diff/1/state/machine.go#newcode407 state/machine.go:407: func (m *Machine) SetProvisioned(id InstanceId, nonce ...
11 years ago (2013-04-09 13:26:27 UTC) #2
TheMue
Picture gets clearer. See Williams comments. From my side one additional. https://codereview.appspot.com/8561044/diff/1/state/machine.go File state/machine.go (right): ...
11 years ago (2013-04-09 13:31:41 UTC) #3
dimitern
Please take a look. https://codereview.appspot.com/8561044/diff/1/state/machine.go File state/machine.go (right): https://codereview.appspot.com/8561044/diff/1/state/machine.go#newcode407 state/machine.go:407: func (m *Machine) SetProvisioned(id InstanceId, ...
11 years ago (2013-04-09 14:04:22 UTC) #4
fwereade
LGTM with the below https://codereview.appspot.com/8561044/diff/7001/state/machine.go File state/machine.go (right): https://codereview.appspot.com/8561044/diff/7001/state/machine.go#newcode413 state/machine.go:413: notSetYet := D{{"$and", []D{ You ...
11 years ago (2013-04-09 15:49:20 UTC) #5
dimitern
Please take a look. https://codereview.appspot.com/8561044/diff/7001/state/machine.go File state/machine.go (right): https://codereview.appspot.com/8561044/diff/7001/state/machine.go#newcode413 state/machine.go:413: notSetYet := D{{"$and", []D{ On ...
11 years ago (2013-04-09 16:51:26 UTC) #6
rog
LGTM with a couple of trivial thoughts below https://codereview.appspot.com/8561044/diff/7001/state/apiserver/api_test.go File state/apiserver/api_test.go (right): https://codereview.appspot.com/8561044/diff/7001/state/apiserver/api_test.go#newcode912 state/apiserver/api_test.go:912: stm, ...
11 years ago (2013-04-09 17:52:09 UTC) #7
dave_cheney.net
not lgtm. Why did SetProvisioned grow another field ? Reading this diff we're always passing ...
11 years ago (2013-04-10 02:05:13 UTC) #8
rog
On 10 April 2013 03:05, <dave@cheney.net> wrote: > not lgtm. > > Why did SetProvisioned ...
11 years ago (2013-04-10 08:54:58 UTC) #9
dave_cheney.net
Could an opaque value be returned from SetProvisioned which is passed to StartInstance ? On ...
11 years ago (2013-04-10 10:47:14 UTC) #10
dimitern
On 2013/04/10 10:47:14, dfc wrote: > Could an opaque value be returned from SetProvisioned which ...
11 years ago (2013-04-10 11:00:31 UTC) #11
dave_cheney.net
Fair enough, objection withdrawn. On 10/04/2013, at 21:00, dimiter.naydenov@canonical.com wrote: > On 2013/04/10 10:47:14, dfc ...
11 years ago (2013-04-10 11:03:33 UTC) #12
dimitern
Thanks for the understanding! Sorry that I wasn't clear enough earlier. On 2013/04/10 11:03:33, dfc ...
11 years ago (2013-04-10 11:10:02 UTC) #13
dimitern
11 years ago (2013-04-10 11:51:00 UTC) #14
*** Submitted:

state: add nonced provisioning support

Next step in nonced provisioning; adding support
in state: machine.SetInstanceId() renamed to
SetProvisioned(), taking instance id and nonce.
It allows you change it only once, so some tests
that assumed too much had to be changed (e.g.
changing instance id several times just to
trigger a machine change). Also CheckProvisioned()
is added to machine, taking a nonce and returning
true is returned only when the instance id is set 
and the nonce matches.

In the upcoming CL we'll bring everything
together - PA generating an unique nonce,
and checking it.

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

https://codereview.appspot.com/8561044/diff/7001/state/apiserver/api_test.go
File state/apiserver/api_test.go (right):

https://codereview.appspot.com/8561044/diff/7001/state/apiserver/api_test.go#...
state/apiserver/api_test.go:912: stm, err := s.State.AddMachine("series",
state.JobHostUnits)
On 2013/04/09 17:52:09, rog wrote:
> i have to say i found the logic here really hard to follow. i know the logic
> comes straight from state, but i'd like a few comments. the use of oldId and
> newId make things harder too, i think. i'd just use the string constants.

Added comments, hopefully now it's easier to follow.

https://codereview.appspot.com/8561044/diff/7001/state/machine.go
File state/machine.go (right):

https://codereview.appspot.com/8561044/diff/7001/state/machine.go#newcode439
state/machine.go:439: // an instance id and the given nonce.
On 2013/04/09 17:52:09, rog wrote:
> i think i'd say "if the machine has been provisioned with the given nonce", as
> it's not possible to call SetProvisioned *without* an instance id.

Done.
Sign in to reply to this message.

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