Ensure LXC bridge exists, is up, and has rules
Additional check to ensure the lxc bridge interface exists added when starting networks. Additional edge cases in the bridge being created and the interface made usable are tested and resolved when they fail. In addition dnsmasq is only kicked when the container network is modified. Co-Authored-By: Kevin Carter <kevin.carter@rackspace.com> Change-Id: I7350626bd736f815bd2a9ed0d4949d42cd5db9af Closes-Bug: 1438374
This commit is contained in:
parent
2d4f9c750f
commit
5aa09d5afe
@ -178,10 +178,14 @@ function stop_containers_with_fire() {
|
||||
|
||||
function start_networks() {
|
||||
set -e
|
||||
if [ -f "/sys/class/net/${LXC_BRIDGE}/bridge/bridge_id" ];then
|
||||
success "LXC container network is already online."
|
||||
else
|
||||
if [ ! "$(ifup ${LXC_BRIDGE})" ];then
|
||||
info "Building the LXC container network."
|
||||
|
||||
# Create lxc bridge
|
||||
brctl addbr "${LXC_BRIDGE}"
|
||||
brctl addbr "${LXC_BRIDGE}" || true
|
||||
|
||||
# Set the lxc bridge up
|
||||
ip link set "${LXC_BRIDGE}" up || true
|
||||
@ -200,6 +204,8 @@ function start_networks() {
|
||||
DHCP_LEASE_FILE="/var/lib/misc/dnsmasq.${LXC_BRIDGE}.leases"
|
||||
start_dnsmasq
|
||||
success "LXC container network has been created."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function stop_dnsmasq() {
|
||||
|
Loading…
Reference in New Issue
Block a user