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

Issue 9886045: Update add machine command to create containers (Closed)

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

Description

Update add machine command to create containers The add machine command accepts additional command line arguments to specify a container to create. The container can be on a new machine or an existing instance. Container constraints are also supported eg create a container with 2G memory. The state is updated with the new machine document but the machine watcher ignores the machine since there's no code to provision containers yet. examples: juju add-machine /lxc juju add-machine --constraints mem=4G /lxc juju add-machine 1/lxc https://code.launchpad.net/~wallyworld/juju-core/add-machine-container/+merge/167195 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 12

Patch Set 2 : Update add machine command to create containers #

Total comments: 11

Patch Set 3 : Update add machine command to create containers #

Unified diffs Side-by-side diffs Delta from patch set Stats (+608 lines, -61 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/juju/addmachine.go View 1 2 4 chunks +41 lines, -5 lines 0 comments Download
M cmd/juju/addmachine_test.go View 1 2 2 chunks +41 lines, -0 lines 0 comments Download
A state/container.go View 1 2 1 chunk +113 lines, -0 lines 0 comments Download
M state/machine.go View 1 2 6 chunks +58 lines, -12 lines 0 comments Download
M state/machine_test.go View 1 2 3 chunks +27 lines, -0 lines 0 comments Download
M state/open.go View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M state/state.go View 1 2 5 chunks +103 lines, -25 lines 0 comments Download
M state/state_test.go View 1 2 7 chunks +164 lines, -7 lines 0 comments Download
M state/unit.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M state/watcher.go View 1 2 2 chunks +25 lines, -9 lines 0 comments Download
M worker/firewaller/firewaller.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M worker/provisioner/provisioner.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M worker/provisioner/provisioner_test.go View 1 2 1 chunk +30 lines, -0 lines 0 comments Download

Messages

Total messages: 12
wallyworld
Please take a look.
10 years, 11 months ago (2013-06-04 03:36:13 UTC) #1
mue
Most parts look good, only provisioner needs a different solution which I'm currently working on. ...
10 years, 11 months ago (2013-06-04 08:05:18 UTC) #2
mue
On 2013/06/04 08:05:18, mue wrote: > Most parts look good, only provisioner needs a different ...
10 years, 11 months ago (2013-06-04 11:20:04 UTC) #3
fwereade
Several concerns here, I'm afraid. Let's discuss live. https://codereview.appspot.com/9886045/diff/1/constraints/constraints.go File constraints/constraints.go (right): https://codereview.appspot.com/9886045/diff/1/constraints/constraints.go#newcode79 constraints/constraints.go:79: func ...
10 years, 11 months ago (2013-06-04 13:12:09 UTC) #4
fwereade
On 2013/06/04 13:12:09, fwereade wrote: > Several concerns here, I'm afraid. Let's discuss live. > ...
10 years, 11 months ago (2013-06-04 13:13:06 UTC) #5
fwereade
https://codereview.appspot.com/9886045/diff/1/state/machine.go File state/machine.go (right): https://codereview.appspot.com/9886045/diff/1/state/machine.go#newcode61 state/machine.go:61: NumChildren int On 2013/06/04 13:12:10, fwereade wrote: > Not ...
10 years, 11 months ago (2013-06-04 13:59:22 UTC) #6
thumper
https://codereview.appspot.com/9886045/diff/1/state/machine.go File state/machine.go (right): https://codereview.appspot.com/9886045/diff/1/state/machine.go#newcode61 state/machine.go:61: NumChildren int On 2013/06/04 13:12:10, fwereade wrote: > Not ...
10 years, 11 months ago (2013-06-05 02:36:27 UTC) #7
fwereade
Sorry for the vacillation re refcount/list: I think I'm convinced that a list is better ...
10 years, 11 months ago (2013-06-06 16:48:17 UTC) #8
wallyworld
*** Submitted: Update add machine command to create containers The add machine command accepts additional ...
10 years, 11 months ago (2013-06-07 07:34:21 UTC) #9
fwereade
A test was failing in cmd/juju, so dimitern reverted this. I have a few more ...
10 years, 10 months ago (2013-06-07 16:24:47 UTC) #10
fwereade
On 2013/06/07 16:24:47, fwereade wrote: > A test was failing in cmd/juju, so dimitern reverted ...
10 years, 10 months ago (2013-06-07 16:28:16 UTC) #11
wallyworld
10 years, 10 months ago (2013-06-11 21:11:31 UTC) #12
*** Submitted:

Update add machine command to create containers

The add machine command accepts additional command line
arguments to specify a container to create. The container
can be on a new machine or an existing instance. Container
constraints are also supported eg create a container with 
2G memory. The state is updated with the new machine document
but the machine watcher ignores the machine since there's no
code to provision containers yet.

examples:

juju add-machine /lxc
juju add-machine --constraints mem=4G /lxc
juju add-machine 1/lxc

R=
CC=
https://codereview.appspot.com/9886045

https://codereview.appspot.com/9886045/diff/11002/state/machine_test.go
File state/machine_test.go (right):

https://codereview.appspot.com/9886045/diff/11002/state/machine_test.go#newco...
state/machine_test.go:31: func (s *MachineSuite) ContainerDefaults(c *C) {
On 2013/06/07 16:24:48, fwereade wrote:
> TestContainerDefaults, otherwise it won't get run.

Done.

https://codereview.appspot.com/9886045/diff/11002/state/machine_test.go#newco...
state/machine_test.go:105: _, err = state.MachineContainers(s.State,
s.machine.Id())
On 2013/06/07 16:24:48, fwereade wrote:
> Can we maybe maintain the domain-object style within state, for now, just
> consistency's sake? Once we isolate state behind the API we can make
bulk-style
> changes as indicated, but for now Machine.Containers() seems appropriate at
this
> level.

Done.

https://codereview.appspot.com/9886045/diff/11002/state/state.go
File state/state.go (right):

https://codereview.appspot.com/9886045/diff/11002/state/state.go#newcode198
state/state.go:198: func (st *State) AddContainerWithConstraints(
On 2013/06/07 16:24:48, fwereade wrote:
> I still think that AddMachine vs AddContainer is an unhelpful distinction --
you
> could surely pass a `location string` into AddMachine for the same effect? I'd
> prefer not to distinguish between the two at the state level unless there's a
> really good reason in favour of doing so.

The 3 related functions:
AddMachine
AddMachineWithConstraints
AddContainerWithConstraints

were provided since Go doesn't have default parameter values, and essentially
provide a semantic wrapper around state.addMachine(). I collapsed the
...WithConstraints variants down to one function taking the (now) exported
AddMachineParams struct as an argument.

https://codereview.appspot.com/9886045/diff/11002/state/watcher.go
File state/watcher.go (left):

https://codereview.appspot.com/9886045/diff/11002/state/watcher.go#oldcode69
state/watcher.go:69: func (st *State) WatchMachines() *LifecycleWatcher {
On 2013/06/07 16:24:48, fwereade wrote:
> WatchEnvironMachines, just to be explicit, perhaps? They're all machines, but
> the "environment machines" are the ones that we expect to have provisioned via
> the environment?

Done.

https://codereview.appspot.com/9886045/diff/11002/state/watcher.go
File state/watcher.go (right):

https://codereview.appspot.com/9886045/diff/11002/state/watcher.go#newcode187
state/watcher.go:187: ids = w.filter(ids)
On 2013/06/07 16:24:48, fwereade wrote:
> Just a thought -- how about filtering before merging, so there's less work to
do
> in merge?

If I do that the initial ids do not get filtered. So easiest just to filter
after the merge to ensure everything is picked up.
Sign in to reply to this message.

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