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

Issue 7845048: state.Unit: don't reuse existing machines

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years ago by thumper
Modified:
13 years ago
Reviewers:
fwereade, dave, mp+155688, wallyworld
Visibility:
Public.

Description

state.Unit: don't reuse existing machines Two main changes here: * A new AssignNew policy has been added that doesn't reuse machines * A function to AssignToNewMachine for a Unit We don't want to reuse machines right now as existing machines that may have had units deployed on them may well be dirty, as we cannot ensure that the charms clean up after themselves. Perhaps in the not too distant future, we may be able to deploy charms into containers that would mean that when we removed the unit we can be sure that the machine is clean, but until that is the case, we don't want to reuse machines. However I didn't want to remove functionality that we would be wanting again soon(ish), so a new policy has been created, and the providers updated to use it. To make the operations to construct a new machine easily available, a new function was added to State to get the required operations. Unit gets a new function to AssignToNewMachine. This creates the new machine and sets the assignment in one transaction. Preconditions are much easier here as we know that the machine doesn't have any current principals, and is of the correct series. https://code.launchpad.net/~thumper/juju-core/start-instance-tool-selection/+merge/155688 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 26

Patch Set 2 : state.Unit: don't reuse existing machines #

Total comments: 12

Patch Set 3 : state.Unit: don't reuse existing machines #

Patch Set 4 : state.Unit: don't reuse existing machines #

Unified diffs Side-by-side diffs Delta from patch set Stats (+191 lines, -51 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M environs/dummy/environs.go View 1 2 1 chunk +4 lines, -1 line 0 comments Download
M environs/ec2/ec2.go View 1 chunk +6 lines, -1 line 0 comments Download
M environs/ec2/local_test.go View 1 chunk +1 line, -1 line 0 comments Download
M environs/jujutest/tests.go View 1 2 1 chunk +0 lines, -6 lines 0 comments Download
M environs/openstack/local_test.go View 1 chunk +1 line, -1 line 0 comments Download
M environs/openstack/provider.go View 1 chunk +6 lines, -1 line 0 comments Download
M juju/conn.go View 1 chunk +4 lines, -3 lines 0 comments Download
M state/assign_test.go View 1 2 chunks +82 lines, -0 lines 0 comments Download
M state/state.go View 2 chunks +34 lines, -37 lines 0 comments Download
M state/unit.go View 1 2 chunks +51 lines, -0 lines 0 comments Download

Messages

Total messages: 10
thumper
Please take a look.
13 years ago (2013-03-27 09:52:50 UTC) #1
fwereade
Looks very nice, just a few comments; LGTM with those addressed. https://codereview.appspot.com/7845048/diff/1/state/assign_test.go File state/assign_test.go (right): ...
13 years ago (2013-03-27 11:06:40 UTC) #2
thumper
About to push changes from this review. https://codereview.appspot.com/7845048/diff/1/state/assign_test.go File state/assign_test.go (right): https://codereview.appspot.com/7845048/diff/1/state/assign_test.go#newcode425 state/assign_test.go:425: unused, err ...
13 years ago (2013-03-27 20:23:24 UTC) #3
thumper
Please take a look.
13 years ago (2013-03-27 20:28:32 UTC) #4
wallyworld
Nice branch, good tests. LGTM, but best to get a more informed opinion on the ...
13 years ago (2013-03-27 21:33:17 UTC) #5
dave_cheney.net
Super close, just a few things to polish up. https://codereview.appspot.com/7845048/diff/6001/environs/dummy/environs.go File environs/dummy/environs.go (right): https://codereview.appspot.com/7845048/diff/6001/environs/dummy/environs.go#newcode511 environs/dummy/environs.go:511: ...
13 years ago (2013-03-27 22:47:08 UTC) #6
thumper
https://codereview.appspot.com/7845048/diff/6001/environs/dummy/environs.go File environs/dummy/environs.go (right): https://codereview.appspot.com/7845048/diff/6001/environs/dummy/environs.go#newcode511 environs/dummy/environs.go:511: // Updated to be consistent with ec2 and openstack. ...
13 years ago (2013-03-28 00:43:35 UTC) #7
dave_cheney.net
LGTM. Fire at will.
13 years ago (2013-03-28 00:44:31 UTC) #8
thumper
Please take a look.
13 years ago (2013-03-28 00:45:07 UTC) #9
thumper
13 years ago (2013-03-28 00:52:20 UTC) #10
*** Submitted:

state.Unit: don't reuse existing machines

Two main changes here:
 * A new AssignNew policy has been added that doesn't reuse machines
 * A function to AssignToNewMachine for a Unit

We don't want to reuse machines right now as existing machines
that may have had units deployed on them may well be dirty, as we
cannot ensure that the charms clean up after themselves.  Perhaps
in the not too distant future, we may be able to deploy charms
into containers that would mean that when we removed the unit we
can be sure that the machine is clean, but until that is the
case, we don't want to reuse machines.  However I didn't want to
remove functionality that we would be wanting again soon(ish), so
a new policy has been created, and the providers updated to use
it.

To make the operations to construct a new machine easily
available, a new function was added to State to get the required
operations.

Unit gets a new function to AssignToNewMachine.  This creates the
new machine and sets the assignment in one transaction.
Preconditions are much easier here as we know that the machine
doesn't have any current principals, and is of the correct
series.

R=fwereade, wallyworld, dfc
CC=
https://codereview.appspot.com/7845048
Sign in to reply to this message.

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