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
(226)
Issues Repositories Search
Open Issues | Closed Issues | All Issues | Sign in with your Google Account to create issues and add comments

Issue 13802045: MaaS tag support in constraints

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 3 months ago by natefinch
Modified:
12 years, 3 months ago
Reviewers:
mp+187298, fwereade , gz
Visibility:
Public.
MaaS tag support in constraints Added a new constraint called tags. In MaaS this corresponds to maas-tags, it is currently unsupported in other providers, though it could be implemented in the future to allow a pass-through for provider-specific features. Tags are simply comma-delimited strings. Added code to disable constraints.Value serialization to yaml, since goyaml has bugs with how it handles slices. https://code.launchpad.net/~natefinch/juju-core/013-maas-tags/+merge/187298 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 10

Patch Set 2 : MaaS tag support in constraints #

Total comments: 1

Patch Set 3 : MaaS tag support in constraints #

Patch Set 4 : MaaS tag support in constraints #

Total comments: 1
Created: 12 years, 3 months ago
Download [raw] [tar.bz2]
Unified diffs Side-by-side diffs Delta from patch set Stats (+282 lines, -78 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/juju/addmachine_test.go View 2 chunks +2 lines, -2 lines 0 comments Download
M cmd/juju/constraints_test.go View 1 2 3 3 chunks +3 lines, -2 lines 0 comments Download
M cmd/juju/deploy.go View 1 chunk +1 line, -2 lines 0 comments Download
M cmd/jujud/bootstrap_test.go View 1 2 chunks +2 lines, -1 line 0 comments Download
M constraints/constraints.go View 1 2 3 8 chunks +65 lines, -1 line 1 comment Download
M constraints/constraints_test.go View 1 2 3 7 chunks +122 lines, -44 lines 0 comments Download
M environs/instances/instancetype.go View 1 2 3 4 chunks +20 lines, -0 lines 0 comments Download
M instance/instance.go View 1 2 3 4 chunks +28 lines, -5 lines 0 comments Download
M juju/conn.go View 2 chunks +2 lines, -3 lines 0 comments Download
M provider/azure/instancetype.go View 1 chunk +1 line, -0 lines 0 comments Download
M provider/dummy/environs.go View 1 chunk +1 line, -0 lines 0 comments Download
M provider/ec2/ec2.go View 1 chunk +1 line, -0 lines 0 comments Download
M provider/maas/environ.go View 1 2 3 2 chunks +4 lines, -0 lines 0 comments Download
M provider/maas/environ_test.go View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M provider/openstack/image.go View 1 chunk +1 line, -0 lines 0 comments Download
M provider/openstack/provider.go View 1 chunk +1 line, -0 lines 0 comments Download
M state/constraints.go View 1 2 3 3 chunks +3 lines, -0 lines 0 comments Download
M state/initialize_test.go View 1 chunk +1 line, -1 line 0 comments Download
M state/machine.go View 1 2 3 3 chunks +3 lines, -0 lines 0 comments Download
M state/machine_test.go View 1 chunk +1 line, -1 line 0 comments Download
M state/service_test.go View 3 chunks +4 lines, -5 lines 0 comments Download
M state/state.go View 1 chunk +1 line, -0 lines 0 comments Download
M state/state_test.go View 1 2 3 9 chunks +7 lines, -10 lines 0 comments Download
M state/unit.go View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download
M worker/provisioner/provisioner_test.go View 1 chunk +1 line, -0 lines 0 comments Download
Total messages: 11
|
natefinch
Please take a look.
12 years, 3 months ago (2013年09月24日 17:23:38 UTC) #1
Please take a look.
Sign in to reply to this message.
natefinch
Note, most of the changed files are small mechanical changes only. I added a constraints.IsEmpty ...
12 years, 3 months ago (2013年09月24日 17:39:39 UTC) #2
Note, most of the changed files are small mechanical changes only. I added a
constraints.IsEmpty method since before we were checking for empty constraints
by comparing against the default intialized struct, and now that the constraints
struct has a slice in it, you can't do == comparisons. The meat of the change is
in constraints.go and constraints_test.go.
Sign in to reply to this message.
gz
Looks right overall, I have some doubts about what we want to store constraints as ...
12 years, 3 months ago (2013年09月25日 10:50:42 UTC) #3
Looks right overall, I have some doubts about what we want to store constraints
as in the db.
https://codereview.appspot.com/13802045/diff/1/constraints/constraints.go
File constraints/constraints.go (right):
https://codereview.appspot.com/13802045/diff/1/constraints/constraints.go#new...
constraints/constraints.go:56: v.Container == nil &&
Indentation is a little funny here, why the extra level after Arch?
https://codereview.appspot.com/13802045/diff/1/constraints/constraints.go#new...
constraints/constraints.go:356: tags := strings.Split(s, ",")
Previously, space seperated tags were also accepted, as in:
 juju set-contraints "tags=one two"
or
 juju set-contraints "tags=one, two"
https://codereview.appspot.com/13802045/diff/1/environs/instances/instancetyp...
File environs/instances/instancetype.go (right):
https://codereview.appspot.com/13802045/diff/1/environs/instances/instancetyp...
environs/instances/instancetype.go:138: machineTags := map[string]struct{}{}
Using an empty struct value seems a funny way to emulate a set, though I guess
we don't have the option of None as per the old python way, and the js version
using bool has downsides as well.
https://codereview.appspot.com/13802045/diff/1/instance/instance.go
File instance/instance.go (right):
https://codereview.appspot.com/13802045/diff/1/instance/instance.go#newcode224
instance/instance.go:224: tags := strings.Split(s, ",")
Just splitting on comma should be fine hee, as we'll only parse things we've
already serialised, right?
https://codereview.appspot.com/13802045/diff/1/state/constraints.go
File state/constraints.go (right):
https://codereview.appspot.com/13802045/diff/1/state/constraints.go#newcode25
state/constraints.go:25: Tags []string ",omitempty"
I would much prefer we record tag constraints as a plain string, in normalised
form, when putting them in the database. A simple list of tags is fine, but I
don't like our migration strategy for constraints, and if we want in future to
for instance support NOT(tag) and other boolean operations, being able to do so
without changing the schema seems far preferable for the minimal amount of extra
processing required.
https://codereview.appspot.com/13802045/diff/1/state/machine.go
File state/machine.go (right):
https://codereview.appspot.com/13802045/diff/1/state/machine.go#newcode125
state/machine.go:125: Tags []string `bson:"tags,omitempty"`
Storing the tags a machine had as a list seems okay in comparison.
Sign in to reply to this message.
natefinch
I think we addressed most of this in the standup and later conversations? We seem ...
12 years, 3 months ago (2013年09月25日 13:46:24 UTC) #4
I think we addressed most of this in the standup and later conversations? We
seem fine with comma as the separator, and storing as a list of strings in the
DB for now. Let me know if there's anything else you think needs doing.
Sign in to reply to this message.
fwereade
LGTM assuming you're ok with the following. https://codereview.appspot.com/13802045/diff/1/provider/ec2/ec2.go File provider/ec2/ec2.go (right): https://codereview.appspot.com/13802045/diff/1/provider/ec2/ec2.go#newcode97 provider/ec2/ec2.go:97: // Tags ...
12 years, 3 months ago (2013年09月25日 14:48:42 UTC) #5
LGTM assuming you're ok with the following.
https://codereview.appspot.com/13802045/diff/1/provider/ec2/ec2.go
File provider/ec2/ec2.go (right):
https://codereview.appspot.com/13802045/diff/1/provider/ec2/ec2.go#newcode97
provider/ec2/ec2.go:97: // Tags currently not supported by EC2
Eh, tricky. This throws up the issue of handling unsupported constraints again,
and it gets harder to dodge each time. At this stage, for consistency's sake, I
think you should just log an "ignored unsupported XXX constraint" at
provisioning time for these non-tag providers; we can tighten it up later if we
have to.
https://codereview.appspot.com/13802045/diff/1/provider/maas/environ.go
File provider/maas/environ.go (right):
https://codereview.appspot.com/13802045/diff/1/provider/maas/environ.go#newco...
provider/maas/environ.go:159: }
Does maas not also return filled-in hardware characteristics from StartInstance?
If not, that's a bug -- it means that maas nodes effectively can't be
automatically reused. If it does, I think it probably ought to include the
actual tags of the machine that was provisioned (not just the ones we
specified).
Either way, it's fine to defer the necessary work to a followup.
https://codereview.appspot.com/13802045/diff/1/state/constraints.go
File state/constraints.go (right):
https://codereview.appspot.com/13802045/diff/1/state/constraints.go#newcode25
state/constraints.go:25: Tags []string ",omitempty"
On 2013年09月25日 10:50:42, gz wrote:
> I would much prefer we record tag constraints as a plain string, in normalised
> form, when putting them in the database. A simple list of tags is fine, but I
> don't like our migration strategy for constraints, and if we want in future to
> for instance support NOT(tag) and other boolean operations, being able to do
so
> without changing the schema seems far preferable for the minimal amount of
extra
> processing required.
I think the prospect of fancy tag expressions is sufficiently remote (never
implemented in maas, right?) that we should stick with the natural
representation of the data as it exists today.
Sign in to reply to this message.
fwereade
Hmm, I missed a rather important file somehow. Important question which may rescind the approval ...
12 years, 3 months ago (2013年09月25日 14:52:54 UTC) #6
Hmm, I missed a rather important file somehow. Important question which may
rescind the approval above:
https://codereview.appspot.com/13802045/diff/1/constraints/constraints_test.go
File constraints/constraints_test.go (right):
https://codereview.appspot.com/13802045/diff/1/constraints/constraints_test.g...
constraints/constraints_test.go:290: c.Check(con.Tags, gc.IsNil)
Hold on, how do we handle fallbacks? "tags=" on a service ought to mask explicit
tags on the environment, and that should be distinct from nil tags (which would
fall back).
Sign in to reply to this message.
natefinch
Please take a look.
12 years, 3 months ago (2013年09月25日 17:54:25 UTC) #7
Please take a look.
Sign in to reply to this message.
fwereade
LGTM https://codereview.appspot.com/13802045/diff/14001/constraints/constraints_test.go File constraints/constraints_test.go (right): https://codereview.appspot.com/13802045/diff/14001/constraints/constraints_test.go#newcode350 constraints/constraints_test.go:350: {RootDisk: uint64p(109876)}, Add some roundtrip tests with both ...
12 years, 3 months ago (2013年09月25日 18:36:34 UTC) #8
LGTM
https://codereview.appspot.com/13802045/diff/14001/constraints/constraints_te...
File constraints/constraints_test.go (right):
https://codereview.appspot.com/13802045/diff/14001/constraints/constraints_te...
constraints/constraints_test.go:350: {RootDisk: uint64p(109876)},
Add some roundtrip tests with both nil and {} please.
Might be worth doing the equivalent in state.
Sign in to reply to this message.
natefinch
Please take a look.
12 years, 3 months ago (2013年09月27日 15:44:26 UTC) #9
Please take a look.
Sign in to reply to this message.
natefinch
Please take a look.
12 years, 3 months ago (2013年09月27日 18:08:49 UTC) #10
Please take a look.
Sign in to reply to this message.
fwereade
LGTM as far as it goes, let's get this in. We also need to return ...
12 years, 3 months ago (2013年09月27日 18:23:29 UTC) #11
LGTM as far as it goes, let's get this in.
We also need to return hardware characteristics from StartInstance (and maybe
maas doesn't even do that..?) -- including tags -- and we should try to match
existing machines with tags inside the unit assignment bits in state.
https://codereview.appspot.com/13802045/diff/36001/constraints/constraints.go
File constraints/constraints.go (right):
https://codereview.appspot.com/13802045/diff/36001/constraints/constraints.go...
constraints/constraints.go:50: // empty list will override any default tags,
where a nil list will not.
Add a comment here explaining the sad situation.
Sign in to reply to this message.
|
This is Rietveld f62528b

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