Friday, October 26, 2012

CloudStack 2.14 + KVM + Openwitch + openflow (Part 1)



Part 1: Install centos 6 and openvswitch


I have built a private cloud system with Cloudstack 2.14 and KVM on centos 6.0. However, the CS2.14 not support the bandwidth limit (network throttling) on the VMs.The bandwidth limit is only supported on the CS 4.1 http://bugs.cloudstack.org/browse/CS-11687?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel.I have chosen the solution is install Openvswitch on KVM . Openvswitch + openflow to create a virtual network, QoS, firewall ... for VMs

I used the following link in my lab:
- Install openvswitch and KVM on centos:  http://networkstatic.net/installing-openvswitch-and-kvm-on-centos-6-2-part-1/
- Install openvswitch http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob_plain;f=INSTALL;hb=HEAD
- Cloudstack document  http://docs.cloudstack.org/

My lab:
 - 1 PC with iperf installed.
 - Host 1 IBM X3650 (Install Centos 6.0, CloudStack 2.14 Manager, KVM Agent, openvswitch with openflow)
 - Host 2 IBM X3650 (Install Centos 6.0, KVM Agent, openvswitch with openflow)


1. Install base package on Host 1 and Host 2
Step 1: Install Centos 6.0 at link: http://www.itbox4vn.com/2011/08/how-to-install-centos-6-step-by-step.html

Step 2: Install Openvswitch
Download the following tars and packages to resolve dependencies or packages not in the Yum repositories.

DL Openvswitch tar

$ wget http://openvswitch.org/releases/openvswitch-1.3.0.tar.gz

$ wget http://www.graphviz.org/pub/graphviz/stable/SRPMS/graphviz-2.28.0-1.src.rpm

$ wget http://www.graphviz.org/pub/graphviz/stable/redhat/el6/i386/os/webdot-2.26-1.el6.noarch.rpm

wget http://download.fedoraproject.org/pub/fedora/linux/releases/16/Everything/source/SRPMS/autoconf-2.68-2.fc15.src.rpm

$rpm -ivh graphviz-2.28.0-1.src.rpm

$rpm -ivh webdot-2.26-1.el6.noarch.rpm

$yum -y install graphviz-devel

$rpm -ivh webdot-2.26-1.el6.noarch.rpm

$yum -y install graphviz-tcl

$yum -y install python-zope-filesystem

$yum -y install python-zope-interface

$yum -y install automake

$yum -y install autoconf

add yum -y install openssl-devel this package is necessary if you use SSL with OpenVSWitch. (Thanks for input Marcos)

$yum –y install gcc
The Open vSwitch datapath requires bridging support
(CONFIG_BRIDGE) to be built as a kernel module.  (This is common
in kernels provided by Linux distributions.)  The bridge module
must not be loaded or in use.  If the bridge module is running
(check with “lsmod | grep bridge”), you must remove it (“rmmod
bridge”) before starting the datapath.

To build the Linux kernel module, so that you can run the
kernel-based switch, pass the location of the kernel build
directory on –with-linux.  For example, to build for a running
instance of Linux:

./configure –with-linux=/lib/modules/`uname -r`/build

$make

$make install

Load the built kernel module

insmod datapath/linux/openvswitch_mod.ko
insmod datapath/linux/brcompat_mod.ko

Verify the kernel mod loaded
[root@localhost openvswitch-1.3.0]# lsmod
openvswitch_mod        82086  0

If everything compiles and install create the sockets and db.

$mkdir -p /usr/local/etc/openvswitch

$ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema

Start the configuration DB
$
ovsdb-server /usr/local/etc/openvswitch/conf.db
–remote=punix:/usr/local/var/run/openvswitch/db.sock
–remote=db:Open_vSwitch,manager_options
–private-key=db:SSL,private_key
–certificate=db:SSL,certificate
–bootstrap-ca-cert=db:SSL,ca_cert –pidfile –detach –log-file

Initialize the DB
$ovs-vsctl –no-wait init

Then start the main Open vSwitch daemon, telling it to connect to the
same Unix domain socket
$ovs-vswitchd –pidfile –detach
$sudo ovs-vswitchd –pidfile –log-file –detach -v
$ovs-vswitchd –pidfile –detach

Part 2: Create bridge interface (use openvswitch bridge) for Cloud agent      




No comments:

Post a Comment