I followed the instructions from http://blog.scottlowe.org/2014/01/23/automatically-connecting-lxc-to-open-vswitch/ but wasn't happy with the script
# pip install shyaml
# cat /var/lib/lxc/vm1/config
# Distribution configuration
lxc.include = /usr/share/lxc/config/ubuntu.common.conf
lxc.arch = x86_64
# Container specific configuration
lxc.rootfs = /var/lib/lxc/vm1/rootfs
lxc.utsname = vm1
# Network configuration
lxc.network.type = veth
lxc.network.veth.pair = veth-vmone
lxc.network.script.up = /etc/lxc/ovsup
lxc.network.script.down = /etc/lxc/ovsdown
# cat /etc/lxc/ovsup
#!/bin/bash
BRIDGE=`cat /etc/lxc/ovs_cfg | shyaml get-value $1.bridge`
VLAN=`cat /etc/lxc/ovs_cfg | shyaml get-value $1.vlan`
ovs-vsctl --may-exist add-br $BRIDGE
ovs-vsctl --if-exists del-port $BRIDGE $5
ovs-vsctl --may-exist add-port $BRIDGE $5
ovs-vsctl set port $5 tag=$VLAN
# cat /etc/lxc/ovsdown
#!/bin/bash
BRIDGE=`cat /etc/lxc/ovs_cfg | shyaml get-value $1.bridge`
ovs-vsctl --if-exists del-port $BRIDGE $5
# cat /etc/lxc/cat ovs_cfg
vm1:
bridge: containers0
vlan: 2