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

Issue 12005049: More control around lxc networking.

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

Description

More control around lxc networking. This branch adds a NetworkConfig inside the lxc package that is used to configure the network of the container. This is used by the lxc-broker, and it uses an environment variable to determine the link for the network. The MAAS provider uses this environment variable to have the container use the bridge "br0" instead of the default "lxcbr0", as this allows the DHCP request from the container to be serviced by the MAAS DHCP server rather than the lxc bridge. This gives the containers inside MAAS a visible IP address from outside the host. https://code.launchpad.net/~thumper/juju-core/lxc-network-config/+merge/177735 Requires: https://code.launchpad.net/~thumper/juju-core/machine-agent-environment/+merge/177707 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 10

Patch Set 2 : More control around lxc networking. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+246 lines, -28 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
A container/lxc/export_test.go View 1 chunk +9 lines, -0 lines 0 comments Download
M container/lxc/lxc.go View 6 chunks +70 lines, -9 lines 0 comments Download
M container/lxc/lxc_test.go View 1 5 chunks +54 lines, -3 lines 0 comments Download
M environs/local/environ.go View 1 1 chunk +2 lines, -1 line 0 comments Download
M environs/maas/environ.go View 1 3 chunks +26 lines, -1 line 0 comments Download
M testing/checkers/checker.go View 1 1 chunk +22 lines, -0 lines 0 comments Download
M testing/checkers/checker_test.go View 1 1 chunk +21 lines, -13 lines 0 comments Download
M testing/environ.go View 1 1 chunk +9 lines, -0 lines 0 comments Download
M worker/provisioner/lxc-broker.go View 1 3 chunks +11 lines, -1 line 0 comments Download
M worker/provisioner/lxc-broker_test.go View 1 2 chunks +20 lines, -0 lines 0 comments Download

Messages

Total messages: 3
thumper
Please take a look.
10 years, 9 months ago (2013-07-31 03:25:14 UTC) #1
wallyworld
LGTM but I'd really like to see tests for the new functionality. There's not much ...
10 years, 9 months ago (2013-07-31 03:45:51 UTC) #2
thumper
10 years, 9 months ago (2013-07-31 05:48:12 UTC) #3
Please take a look.

https://codereview.appspot.com/12005049/diff/1/container/lxc/lxc.go
File container/lxc/lxc.go (right):

https://codereview.appspot.com/12005049/diff/1/container/lxc/lxc.go#newcode48
container/lxc/lxc.go:48: networkType string
On 2013/07/31 03:45:51, wallyworld wrote:
> not sure whether we want to alias the type of these attributes so they are not
> straight strings? it seems to be common practice to do so

I decided to just keep them private instead.  No one can mess with them.

The only way to construct the NetworkConfig struct is to use one of the methods
below.

https://codereview.appspot.com/12005049/diff/1/container/lxc/lxc_test.go
File container/lxc/lxc_test.go (right):

https://codereview.appspot.com/12005049/diff/1/container/lxc/lxc_test.go#newc...
container/lxc/lxc_test.go:100: 
On 2013/07/31 03:45:51, wallyworld wrote:
> I think we should also check that the network config file matches the network
> config passed to manger.StartContainer()

Mildly overkill, but done.

https://codereview.appspot.com/12005049/diff/1/environs/local/environ.go
File environs/local/environ.go (right):

https://codereview.appspot.com/12005049/diff/1/environs/local/environ.go#newc...
environs/local/environ.go:286: inst, err := env.containerManager.StartContainer(
On 2013/07/31 03:45:51, wallyworld wrote:
> There should be a test that local provider lxc network config file is as
> expected

This is covered by the lxc tests.

https://codereview.appspot.com/12005049/diff/1/environs/maas/environ.go
File environs/maas/environ.go (right):

https://codereview.appspot.com/12005049/diff/1/environs/maas/environ.go#newco...
environs/maas/environ.go:312:
machineConfig.MachineEnvironment["JUJU_LXC_BRIDGE"] = "br0"
On 2013/07/31 03:45:51, wallyworld wrote:
> tests?

There are already tests that cover the writing out of cloudinit scripts.

https://codereview.appspot.com/12005049/diff/1/worker/provisioner/lxc-broker.go
File worker/provisioner/lxc-broker.go (right):

https://codereview.appspot.com/12005049/diff/1/worker/provisioner/lxc-broker....
worker/provisioner/lxc-broker.go:47: 
On 2013/07/31 03:45:51, wallyworld wrote:
> tests?

adding
Sign in to reply to this message.

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