Packages in distro
This installation procedure was tested with CentOS 6.4 and openvswitch version 1.9. Openvswitch required some custom patches to work with the kernel version supplied with CentOS 6.4, these patches are at the bottom of this page.
CentOS 6.4 Basic Server
yum groupinstall Virtualization "Virtualization Client" "Virtualization Platform" "Virtualization Tools"
Verify Installation. The following packages should be installed
Edit /etc/libvirt/libvirtd.conf
listen_tls = 0 listen_tcp = 1 tcp_port = "16059" auth_tcp = "none" mdns_adv = 0
Edit /etc/sysconfig/libvirtd
LIBVIRTD_ARGS="--listen"
Start libvirtd
Verify installation:
# virsh capabilities
Should list two guest tags with os_type hvm
Install build requirements:
# yum install rpmdevtools openssl-devel kernel-devel gcc redhat-rpm-config
Build packages:
# mkdir -p ~/rpmbuild/SOURCES # curl -O http://openvswitch.org/releases/openvswitch-1.9.0.tar.gz # cp openvswitch-1.9.0.tar.gz ~/rpmbuild/SOURCES # cp centos64-openvswitch.patch ~/rpmbuild/SOURCES # tar -xzf openvswitch-1.9.0.tar.gz # cd openvswitch-1.9.0 # patch -p1 < ~/rpmbuild/SOURCES/centos64-openvswitch.patch # rpmbuild -bb rhel/openvswitch.spec # rpmbuild -bb -D "kversion `uname -r`" rhel/openvswitch-kmod-rhel6.spec
Install openvswitch:
# yum install ~/rpmbuild/RPMS/x86_64/kmod-openvswitch-1.9.0-1.el6.x86_64.rpm ~/rpmbuild/RPMS/x86_64/openvswitch-1.9.0-1.x86_64.rpm # echo 'blacklist bridge' >> /etc/modprobe.d/blacklist.conf # reboot
Verify installation
# lsmod |grep openvswitch # ovs-vsctl -V
Network design:
cloudbr0 (Management, Storage)
ip: 172.16.10.10/24
gateway: 172.16.10.1
eth0 (physical port, no vlans)
cloudbr1 (Guest, Public)
eth1 (physical port, vlan trunk)
ip: none
Configure network interfaces:
/etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=none IPV6INIT=no NM_CONTROLLED=no ONBOOT=yes TYPE=OVSPort DEVICETYPE=ovs OVS_BRIDGE=cloudbr0 /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth1 BOOTPROTO=none IPV6INIT=no NM_CONTROLLED=no ONBOOT=yes TYPE=OVSPort DEVICETYPE=ovs OVS_BRIDGE=cloudbr1 /etc/sysconfig/network-scripts/ifcfg-cloudbr0 DEVICE=cloudbr0 ONBOOT=yes DEVICETYPE=ovs TYPE=OVSBridge BOOTPROTO=static IPADDR=172.16.10.10 GATEWAY=172.16.10.1 NETMASK=255.255.255.0 HOTPLUG=no /etc/sysconfig/network-scripts/ifcfg-cloudbr1 DEVICE=cloudbr1 ONBOOT=yes DEVICETYPE=ovs TYPE=OVSBridge BOOTPROTO=none HOTPLUG=no /etc/sysconfig/network NETWORKING=yes HOSTNAME=testkvm1 GATEWAY=172.10.10.1
Install cloudstack-agent
# yum install cloudstack-agent
Edit /etc/cloudstack/agent/agent.properties
network.bridge.type=openvswitch libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.OvsVifDriver
Now add the host to cloudstack.
diff -ru openvswitch-1.9.0-clean/datapath/linux/compat/include/linux/etherdevice.h openvswitch-1.9.0/datapath/linux/compat/include/linux/etherdevice.h --- openvswitch-1.9.0-clean/datapath/linux/compat/include/linux/etherdevice.h 2013-02-26 21:25:37.000000000 +0100 +++ openvswitch-1.9.0/datapath/linux/compat/include/linux/etherdevice.h 2013-04-25 10:45:09.942027933 +0200 @@ -4,16 +4,4 @@ #include <linux/version.h> #include_next <linux/etherdevice.h> -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36) -static inline void eth_hw_addr_random(struct net_device *dev) -{ - random_ether_addr(dev->dev_addr); -} -#elif LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0) -static inline void eth_hw_addr_random(struct net_device *dev) -{ - dev_hw_addr_random(dev, dev->dev_addr); -} -#endif - #endif diff -ru openvswitch-1.9.0-clean/datapath/linux/compat/include/linux/if_vlan.h openvswitch-1.9.0/datapath/linux/compat/include/linux/if_vlan.h --- openvswitch-1.9.0-clean/datapath/linux/compat/include/linux/if_vlan.h 2013-02-26 21:25:37.000000000 +0100 +++ openvswitch-1.9.0/datapath/linux/compat/include/linux/if_vlan.h 2013-04-25 10:44:33.270023182 +0200 @@ -55,38 +55,4 @@ #define VLAN_TAG_PRESENT VLAN_CFI_MASK #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) -static inline void vlan_set_encap_proto(struct sk_buff *skb, struct vlan_hdr *vhdr) -{ - __be16 proto; - unsigned char *rawp; - - /* - * Was a VLAN packet, grab the encapsulated protocol, which the layer - * three protocols care about. - */ - - proto = vhdr->h_vlan_encapsulated_proto; - if (ntohs(proto) >= 1536) { - skb->protocol = proto; - return; - } - - rawp = skb->data; - if (*(unsigned short *) rawp == 0xFFFF) - /* - * This is a magic hack to spot IPX packets. Older Novell - * breaks the protocol design and runs IPX over 802.3 without - * an 802.2 LLC layer. We look for FFFF which isn't a used - * 802.2 SSAP/DSAP. This won't work for fault tolerant netware - * but does for the rest. - */ - skb->protocol = htons(ETH_P_802_3); - else - /* - * Real 802.2 LLC - */ - skb->protocol = htons(ETH_P_802_2); -} -#endif #endif /* linux/if_vlan.h wrapper */ diff -ru openvswitch-1.9.0-clean/datapath/linux/compat/include/linux/skbuff.h openvswitch-1.9.0/datapath/linux/compat/include/linux/skbuff.h --- openvswitch-1.9.0-clean/datapath/linux/compat/include/linux/skbuff.h 2013-02-26 21:25:37.000000000 +0100 +++ openvswitch-1.9.0/datapath/linux/compat/include/linux/skbuff.h 2013-04-25 10:43:21.167021697 +0200 @@ -245,10 +245,4 @@ } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,40) -static inline void skb_reset_mac_len(struct sk_buff *skb) -{ - skb->mac_len = skb->network_header - skb->mac_header; -} -#endif #endif diff -ru openvswitch-1.9.0-clean/rhel/openvswitch-kmod-rhel6.spec openvswitch-1.9.0/rhel/openvswitch-kmod-rhel6.spec --- openvswitch-1.9.0-clean/rhel/openvswitch-kmod-rhel6.spec 2013-02-26 21:25:52.000000000 +0100 +++ openvswitch-1.9.0/rhel/openvswitch-kmod-rhel6.spec 2013-04-25 10:40:41.039023915 +0200 @@ -22,6 +22,7 @@ Source0: %{oname}-%{version}.tar.gz BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildRequires: %kernel_module_package_buildreqs +Patch0: centos64-openvswitch.patch # Without this we get an empty openvswitch-debuginfo package (whose name # conflicts with the openvswitch-debuginfo package for OVS userspace). @@ -43,6 +44,7 @@ %prep %setup -n %{oname}-%{version} +%patch0 -p1 %build for flavor in %flavors_to_build; do