b) openvswitch bridge script

Whenever the linux bridge comes back into play, such as when I upgraded libvirt to 1.0.0, I just run this script. I am sure there are easier ways, but this works fine for me for now. What it does is, even though the default Linux bridge is undefined it still gets rebuild at reboot time. This causes confusion for openvswitch. So after reboot I need to remove the Linux default bridge, and replace it with an openvswitch switch. This is what will form the foundation for Openstack networking and Neutron specifically. After this gets built, we create a virtual network with libvirt, then build a VM and point to the virtual network which uses opnevswitch. We also have to make a couple of changes to the VM xml file if it built using Virtual Machine Manager which is kind of a lame version of VMware’s vSphere Web Client. In future posts we automate alot of this.

#!/bin/bash
#
# start with a lsmod grep bridge to show the linux bridge is there
#
lsmod | grep bridge > /dev/null
if [ “$?” -eq 0 ]; then
echo “there is a linux bridge”
echo ” do you want to delete it? If so hit enter ”
read -p “Press [Enter] key to continue…”
rmmod bridge
if [ “$?” -eq 0 ]; then
lsmod | grep bridge > /dev/null
if [ “$?” -eq 0 ]; then
echo “there is a linux bridge”
else
echo “there is no linux bridge”
fi
fi
else
echo “there is no linux bridge”
fi
#
# next do a lsmod grep bridge to shwo the linux bridge is there
#
module-assistant auto-install openvswitch-datapath
#
echo “now we start openvswitch”
service openvswitch-switch start
#
echo “now we status openvswitch”
service openvswitch-switch status
#
lsmod | grep brcom >> /dev/null
if [ “$?” -eq 0 ]; then
echo “there is a brcom bridge”
fi
#
ovs-vsctl show

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s