From 04e71efb01a314baf0531b5848984220e91de86e Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Wed, 3 Apr 2013 15:05:03 -0700 Subject: [PATCH] Make LXC aware of custom bridge Upstream-commit: d9a9bfc9c7bee2e4316debcd9f393b8f2fb1e45a Component: engine --- components/engine/container.go | 2 ++ components/engine/lxc_template.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/components/engine/container.go b/components/engine/container.go index 981b9f29c0..fccdbf0b68 100644 --- a/components/engine/container.go +++ b/components/engine/container.go @@ -135,6 +135,7 @@ type NetworkSettings struct { IpAddress string IpPrefixLen int Gateway string + Bridge string PortMapping map[string]string } @@ -491,6 +492,7 @@ func (container *Container) allocateNetwork() error { } } container.network = iface + container.NetworkSettings.Bridge = container.runtime.networkManager.bridgeIface container.NetworkSettings.IpAddress = iface.IPNet.IP.String() container.NetworkSettings.IpPrefixLen, _ = iface.IPNet.Mask.Size() container.NetworkSettings.Gateway = iface.Gateway.String() diff --git a/components/engine/lxc_template.go b/components/engine/lxc_template.go index e3beb037f9..c6849cb0df 100644 --- a/components/engine/lxc_template.go +++ b/components/engine/lxc_template.go @@ -16,7 +16,7 @@ lxc.utsname = {{.Id}} # network configuration lxc.network.type = veth lxc.network.flags = up -lxc.network.link = lxcbr0 +lxc.network.link = {{.NetworkSettings.Bridge}} lxc.network.name = eth0 lxc.network.mtu = 1500 lxc.network.ipv4 = {{.NetworkSettings.IpAddress}}/{{.NetworkSettings.IpPrefixLen}}