openvswitch and openvswitch-datapath element

Split out the openvswitch installation from the neutron element.

Don't install openvswitch dkms modules in kernel >= 3.12
Openvswitch GRE and VXLAN capabilities are now included in
vanilla kernels (GRE tunneling support in 3.11 and VXLAN in
3.12) so there is no need to install the dkms packages to activate
them. When installing the datapath package, dkms will fail at
compile time with an unsupported kernel version message.

Change-Id: Id456cfb1a0634f43617c23ac82fc4445a58ddb2c
Partial-bug: #1316985
This commit is contained in:
Ghe Rivero 2014-05-23 14:31:36 +02:00
parent 6ab3b1f816
commit 3cc80bcb76
6 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Install openvswitch datapath from packages.
Note: For kernels >= 3.12 there is no need to install
the dkms datapath to get GRE and VXLAN support.

View File

@ -0,0 +1,2 @@
openvswitch
select-boot-kernel-initrd

View File

@ -0,0 +1,13 @@
#!/bin/bash
set -eux
RET=$(select-boot-kernel-initrd)
KERNEL_VERSION=`echo ${RET%:*} | sed 's/vmlinuz-//g' | cut -f-2 -d'.'`
maj=$(printf "%02d" ${KERNEL_VERSION%.*})
min=$(printf "%02d" ${KERNEL_VERSION#*.})
# Open vSwitch GRE tunneling included in kernel 3.11 and
# VXLAN tunneling in kernel 3.12
if [[ $((10#$maj$min)) -lt 312 ]]; then
install-packages openvswitch-datapath-dkms
fi

View File

@ -0,0 +1,5 @@
Install openvswitch from packages.
Enables the openvswitch service for systemd systems and
and adds an upstart script service to override the default
sysv one on systems with upstart.

View File

@ -0,0 +1 @@
os-svc-install

View File

@ -0,0 +1,24 @@
#!/bin/bash
set -eux
install-packages openvswitch-switch
if [ "$DIB_INIT_SYSTEM" == "systemd" ] ; then
os-svc-enable -n openvswitch-switch
fi
if [ "$DIB_INIT_SYSTEM" == "upstart" ] ; then
echo "start on starting cloud-init-nonet" >> /etc/init/openvswitch-switch.override
if [ ! -f /etc/init/openvswitch-switch.conf ] ; then
cat << 'EOF' > /etc/init/openvswitch-switch.conf
# openvswitch-switch
# the purpose of this job is
# * start openvwitch-switch in upstart rather than SysV startup
pre-start script
export RUNLEVEL=2
/etc/init.d/openvswitch-switch start
end script
post-stop exec /etc/init.d/openvswitch-switch stop
EOF
fi
fi