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

Issue 88780043: Add constraints validation to providers (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years ago by wallyworld
Modified:
9 years, 12 months ago
Reviewers:
mp+216244, fwereade
Visibility:
Public.

Description

Add constraints validation to providers Each provider has a constraints validator which is used when setting constraints on a machine or service, as well as when constraints are merged. The validation step allows conflicting constraints like instance-type and mem to be rejected, and also unsupported constraints to be logged with a warning. The merge step allows things like instance-type to mask other incompatible constraints like mem or arch, and visa versa. https://code.launchpad.net/~wallyworld/juju-core/instance-type-constraint/+merge/216244 Requires: https://code.launchpad.net/~wallyworld/juju-core/constraints-validation-merge/+merge/215807 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : Add constraints validation to providers #

Patch Set 3 : Add constraints validation to providers #

Total comments: 12

Patch Set 4 : Add constraints validation to providers #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+564 lines, -53 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/juju/bootstrap.go View 1 2 3 1 chunk +8 lines, -0 lines 0 comments Download
M cmd/juju/bootstrap_test.go View 1 2 2 chunks +8 lines, -0 lines 0 comments Download
M environs/interface.go View 1 chunk +4 lines, -0 lines 0 comments Download
M environs/statepolicy.go View 2 chunks +9 lines, -0 lines 0 comments Download
M provider/azure/environ.go View 1 2 1 chunk +12 lines, -0 lines 0 comments Download
M provider/azure/environ_test.go View 1 2 3 1 chunk +9 lines, -0 lines 0 comments Download
M provider/dummy/environs.go View 1 2 1 chunk +8 lines, -0 lines 0 comments Download
M provider/ec2/ec2.go View 1 2 3 1 chunk +14 lines, -0 lines 0 comments Download
M provider/ec2/local_test.go View 1 2 3 1 chunk +19 lines, -0 lines 0 comments Download
M provider/joyent/environ_instance.go View 1 2 2 chunks +13 lines, -1 line 0 comments Download
M provider/joyent/local_test.go View 1 2 3 1 chunk +9 lines, -0 lines 0 comments Download
M provider/local/environ.go View 1 2 3 1 chunk +14 lines, -0 lines 0 comments Download
M provider/local/environ_test.go View 1 2 3 1 chunk +11 lines, -0 lines 0 comments Download
M provider/maas/environ.go View 1 chunk +12 lines, -0 lines 0 comments Download
M provider/maas/environ_test.go View 1 2 3 2 chunks +12 lines, -0 lines 0 comments Download
M provider/manual/environ.go View 1 2 3 1 chunk +13 lines, -0 lines 0 comments Download
M provider/manual/environ_test.go View 1 2 3 2 chunks +9 lines, -0 lines 0 comments Download
M provider/openstack/local_test.go View 1 2 3 1 chunk +19 lines, -0 lines 0 comments Download
M provider/openstack/provider.go View 1 chunk +15 lines, -0 lines 0 comments Download
M state/addmachine.go View 3 chunks +18 lines, -22 lines 0 comments Download
M state/conn_test.go View 3 chunks +12 lines, -3 lines 0 comments Download
state/constraints.go View 1 chunk +24 lines, -21 lines 0 comments Download
state/constraintsvalidation_test.go View 1 2 3 1 chunk +104 lines, -0 lines 0 comments Download
state/export_test.go View 2 chunks +5 lines, -0 lines 0 comments Download
state/machine.go View 1 2 3 1 chunk +7 lines, -0 lines 0 comments Download
state/machine_test.go View 1 2 3 3 chunks +37 lines, -0 lines 0 comments Download
state/policy.go View 1 2 3 2 chunks +51 lines, -0 lines 0 comments Download
state/service.go View 1 2 3 3 chunks +9 lines, -6 lines 1 comment Download
state/service_test.go View 3 chunks +33 lines, -0 lines 0 comments Download
M state/state.go View 1 2 3 1 chunk +7 lines, -0 lines 0 comments Download
state/state_test.go View 1 2 3 4 chunks +37 lines, -0 lines 0 comments Download

Messages

Total messages: 7
wallyworld
Please take a look.
10 years ago (2014-04-17 03:22:32 UTC) #1
wallyworld
Please take a look.
10 years ago (2014-04-17 03:28:53 UTC) #2
wallyworld
Please take a look.
10 years ago (2014-04-17 06:13:09 UTC) #3
fwereade
I think there's a SetEnvironConstraints somewhere that needs to be validated, and I'm a bit ...
10 years ago (2014-04-18 08:25:04 UTC) #4
wallyworld
On 2014/04/18 08:25:04, fwereade wrote: > I think there's a SetEnvironConstraints somewhere that needs to ...
10 years ago (2014-04-18 13:51:11 UTC) #5
wallyworld
Please take a look. https://codereview.appspot.com/88780043/diff/40001/provider/ec2/ec2.go File provider/ec2/ec2.go (right): https://codereview.appspot.com/88780043/diff/40001/provider/ec2/ec2.go#newcode369 provider/ec2/ec2.go:369: []string{constraints.Mem, constraints.CpuCores}) On 2014/04/18 08:25:04, ...
10 years ago (2014-04-18 13:51:18 UTC) #6
fwereade
10 years ago (2014-04-21 10:48:14 UTC) #7
LGTM if you promise to do a followup that implements constraint vocabularies ;).

https://codereview.appspot.com/88780043/diff/40001/provider/ec2/local_test.go
File provider/ec2/local_test.go (right):

https://codereview.appspot.com/88780043/diff/40001/provider/ec2/local_test.go...
provider/ec2/local_test.go:378: c.Assert(cons, gc.DeepEquals,
constraints.MustParse("arch=i386 instance-type=foo cpu-power=10"))
On 2014/04/18 13:51:19, wallyworld wrote:
> On 2014/04/18 08:25:04, fwereade wrote:
> > Ideally instance-type's value will itself be validated here -- such that
> > cc2.x8large is rejected in the regions that don't provide them, etc etc.
> That'd
> > be reasonable as a followup, possibly alongside the API that lists available
> > instance-type values (also maybe good to do the same for arch?).
> 
> The instance-type check is done in the next branch as part of the
> PrecheckInstance() step. I thought about doing it on the
constraints.Validate()
> step but this would involve plugging provider specific behaviour into the
> constraints package and we already have the pre check stuff that will do the
> job, and will cause an error before a new machine record is added to state. It
> won't prevent service constraints from being set with a bad instance type
> however. But I thought the implementation chosen is a viable approach
> nonetheless.

Hmm. ISTM that there are several, uh, vocab-constrained constraints -- arch,
instance-type, and tags -- and each of them vary by cloud, and it'll almost
certainly be to our benefit to be able to reject the crazy ones before they get
into state anywhere at all -- I'm really quite concerned about the delay between
the bad specification and the actual error reporting.

It can go into a followup, this clearly remains a good direction, but I think we
do need to be able to fail fast on those values. Some of them are potentially
tricky, ofc -- the set of arches available depends on the juju tools available,
and the images, but we've at least partly addressed that issue already iirc.

https://codereview.appspot.com/88780043/diff/60001/state/service.go
File state/service.go (right):

https://codereview.appspot.com/88780043/diff/60001/state/service.go#newcode810
state/service.go:810: 
I'm also bothered that we don't have any way to communicate this back to the
user [who isn't running debug-log, at least]. Out of scope, but irritating.
Sign in to reply to this message.

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