3 # Bridge interface setup for LXD
8 # Source function library
9 . /etc/rc.d/init.d/functions
12 . /etc/sysconfig/network
14 # Check that networking is up.
15 if is_yes "${NETWORKING}"; then
16 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
17 msg_network_down "lxdbr"
24 [ -f /etc/sysconfig/lxd ] && . /etc/sysconfig/lxd
26 if [ -z "$BRIDGE_DEV" -o -z "$BRIDGE_IPADDR" ]; then
27 nls "Please configure BRIDGE_IPADDR in /etc/sysconfig/lxd"
32 ip link show $BRIDGE_DEV 2>/dev/null | grep -q ",UP"
37 nls "lxd bridge %s is already up" "$BRIDGE_DEV"
41 msg_starting $BRIDGE_DEV
44 ip link add dev $BRIDGE_DEV type bridge
45 ip addr add $BRIDGE_IPADDR dev $BRIDGE_DEV
46 ip link set up dev $BRIDGE_DEV
56 if ! is_bridge_up; then
57 nls "lxd bridge %s is already down" "$BRIDGE_DEV"
61 if status --pidfile "/var/run/lxd.pid" lxd lxd >/dev/null; then
62 nls "lxd bridge cannot be stopped while lxd daemon is running"
67 msg_stopping $BRIDGE_DEV
68 ip link set down dev $BRIDGE_DEV
69 ip link del dev $BRIDGE_DEV
74 if ! is_bridge_up; then
75 nls "lxd bridge %s is down" $BRIDGE_DEV
91 nls "lxd bridge %s is %s" "$BRIDGE_DEV" "$st"
95 # See how we were called.
117 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"