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

Issue 61520045: Wire up prechecker

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 2 months ago by axw
Modified:
10 years, 2 months ago
Reviewers:
mp+205700, fwereade
Visibility:
Public.

Description

Wire up prechecker We introduce the concept of a policy into state: state.State is given a state.Policy interface when opened, which is consulted during certain operations to validate or modify behaviour. The Policy interface contains only one method, Prechecker, which is called to obtain a Prechecker. The Prechecker, if non-nil, is used to ensure that an instance with the specified parameters can potentially be instantiated. There is currently only one implementation of Prechecker, and that is the manual provider's Environ. The manual provider thus prevents add-machine without ssh- placement. This CL supersedes https://codereview.appspot.com/14032043/ The primary differences are: - up-to-date with latest codebase - introduction of Policy, and removal of raciness/lack of environ config updates - policy is not set on State in juju.NewConn methods; prechecking simply will not occur for old environments - Environ does not embed Prechecker, and there is no new EnvironBase struct; this may be proposed as a follow-up - there is no container prechecking, as otherwise we have no lightweight means of deploying charms that do not require addressability https://code.launchpad.net/~axwalk/juju-core/wire-up-prechecker-take2/+merge/205700 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : Wire up prechecker #

Total comments: 11

Patch Set 3 : Wire up prechecker #

Total comments: 2

Patch Set 4 : Wire up prechecker #

Unified diffs Side-by-side diffs Delta from patch set Stats (+382 lines, -224 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M agent/agent.go View 1 4 chunks +4 lines, -4 lines 0 comments Download
M agent/bootstrap.go View 1 2 3 chunks +3 lines, -3 lines 0 comments Download
M agent/bootstrap_test.go View 1 2 5 chunks +6 lines, -5 lines 0 comments Download
M cmd/jujud/agent.go View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M cmd/jujud/agent_test.go View 1 2 3 chunks +3 lines, -2 lines 0 comments Download
M cmd/jujud/bootstrap.go View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M cmd/jujud/bootstrap_test.go View 1 2 8 chunks +8 lines, -7 lines 0 comments Download
M cmd/plugins/juju-restore/restore.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M environs/errors.go View 1 1 chunk +0 lines, -24 lines 0 comments Download
M environs/interface.go View 2 chunks +4 lines, -22 lines 0 comments Download
M environs/jujutest/livetests.go View 1 1 chunk +3 lines, -13 lines 0 comments Download
A environs/statepolicy.go View 1 2 1 chunk +34 lines, -0 lines 0 comments Download
M juju/conn.go View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M juju/conn_test.go View 1 2 3 chunks +3 lines, -3 lines 0 comments Download
M provider/azure/environ.go View 1 1 chunk +0 lines, -12 lines 0 comments Download
M provider/azure/environ_test.go View 1 1 chunk +0 lines, -9 lines 0 comments Download
M provider/dummy/environs.go View 1 2 7 chunks +18 lines, -5 lines 0 comments Download
M provider/ec2/ec2.go View 1 1 chunk +0 lines, -12 lines 0 comments Download
M provider/ec2/local_test.go View 1 1 chunk +0 lines, -11 lines 0 comments Download
M provider/local/environ.go View 1 1 chunk +0 lines, -12 lines 0 comments Download
M provider/local/environ_test.go View 1 2 chunks +0 lines, -16 lines 0 comments Download
M provider/manual/environ.go View 1 1 chunk +4 lines, -0 lines 0 comments Download
M provider/openstack/local_test.go View 1 1 chunk +0 lines, -11 lines 0 comments Download
M provider/openstack/provider.go View 1 1 chunk +0 lines, -12 lines 0 comments Download
M state/addmachine.go View 1 2 chunks +14 lines, -0 lines 0 comments Download
M state/api/agent/machine_test.go View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M state/apiserver/client/api_test.go View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M state/compat_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M state/conn_test.go View 1 2 3 4 chunks +16 lines, -1 line 0 comments Download
M state/environ_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M state/export_test.go View 1 1 chunk +10 lines, -2 lines 0 comments Download
M state/initialize_test.go View 1 2 6 chunks +8 lines, -8 lines 0 comments Download
M state/megawatcher_internal_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M state/open.go View 1 5 chunks +12 lines, -6 lines 0 comments Download
A state/policy.go View 1 2 3 1 chunk +63 lines, -0 lines 0 comments Download
A state/prechecker_test.go View 1 2 3 1 chunk +132 lines, -0 lines 0 comments Download
M state/settings_test.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M state/state.go View 1 1 chunk +1 line, -0 lines 0 comments Download
M state/state_test.go View 1 2 10 chunks +10 lines, -10 lines 0 comments Download
M state/unit_test.go View 1 2 3 chunks +3 lines, -3 lines 0 comments Download
M worker/provisioner/provisioner_test.go View 1 2 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 11
axw
Please take a look.
10 years, 2 months ago (2014-02-11 06:26:20 UTC) #1
fwereade
On 2014/02/11 06:26:20, axw wrote: > Please take a look. Couple of preliminary comments: I'm ...
10 years, 2 months ago (2014-02-14 09:28:53 UTC) #2
axw
On 2014/02/14 09:28:53, fwereade wrote: > On 2014/02/11 06:26:20, axw wrote: > > Please take ...
10 years, 2 months ago (2014-02-14 09:39:44 UTC) #3
fwereade
On 2014/02/14 09:39:44, axw wrote: > It doesn't seem ideal to allow containers for everyone, ...
10 years, 2 months ago (2014-02-17 09:47:03 UTC) #4
fwereade
possible approach question, please discuss with waigani: the issue with setting a prechecker, even if ...
10 years, 2 months ago (2014-02-17 10:00:17 UTC) #5
axw
On 2014/02/17 10:00:17, fwereade wrote: > possible approach question, please discuss with waigani: > > ...
10 years, 2 months ago (2014-02-17 12:26:29 UTC) #6
axw
Please take a look.
10 years, 2 months ago (2014-02-18 05:56:11 UTC) #7
fwereade
Looking very nice, basically just quibbles. And I'm not quite clear about the distinction between ...
10 years, 2 months ago (2014-02-18 15:30:18 UTC) #8
axw
Please take a look. https://codereview.appspot.com/61520045/diff/20001/cmd/jujud/bootstrap_test.go File cmd/jujud/bootstrap_test.go (right): https://codereview.appspot.com/61520045/diff/20001/cmd/jujud/bootstrap_test.go#newcode121 cmd/jujud/bootstrap_test.go:121: }, state.DefaultDialOpts(), state.Policy(nil)) On 2014/02/18 ...
10 years, 2 months ago (2014-02-19 07:08:45 UTC) #9
fwereade
LGTM, thanks https://codereview.appspot.com/61520045/diff/20001/cmd/jujud/bootstrap_test.go File cmd/jujud/bootstrap_test.go (right): https://codereview.appspot.com/61520045/diff/20001/cmd/jujud/bootstrap_test.go#newcode121 cmd/jujud/bootstrap_test.go:121: }, state.DefaultDialOpts(), state.Policy(nil)) On 2014/02/19 07:08:45, axw ...
10 years, 2 months ago (2014-02-19 13:01:39 UTC) #10
axw
10 years, 2 months ago (2014-02-20 08:14:22 UTC) #11
Please take a look.

https://codereview.appspot.com/61520045/diff/40001/state/policy.go
File state/policy.go (right):

https://codereview.appspot.com/61520045/diff/40001/state/policy.go#newcode58
state/policy.go:58: logger.Debugf("policy returned nil prechecker, ignoring")
On 2014/02/19 13:01:39, fwereade wrote:
> I think this is really bad behaviour on the policy's part; probably bad enough
> to justify erroring out of the AddMachine, because the implementation is crazy
> enough that all bets should be considered to be off.

Done.
Sign in to reply to this message.

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