Add support for building ovs from git sources on stacking

This eases the deployment of a devstack machine with the latest
Open vSwitch bits, adding this to local.conf provides a fully
featured ovs-ct firewall setup:

  enable_plugin neutron git://git.openstack.org/openstack/neutron

  Q_BUILD_OVS_FROM_GIT=True

  [[post-config|/$Q_PLUGIN_CONF_FILE]]
  [securitygroup]
  firewall_driver = openvswitch

Change-Id: Ia7ad1658b95d7404384c7cae833008a57e3e5af1
This commit is contained in:
Miguel Angel Ajo 2016-04-12 12:54:48 +02:00
parent 4cdd1b1fc6
commit 2390064efa
3 changed files with 29 additions and 7 deletions

View File

@ -65,7 +65,15 @@ function compile_ovs {
if is_fedora ; then
# is_fedora covers Fedora, RHEL, CentOS, etc...
install_package kernel-devel
echo NOTE: if kernel-devel-$(uname -r) or kernel-headers-$(uname -r) installation
echo failed, please, provide a repository with the package, or yum update / reboot
echo your machine to get the latest kernel.
install_package kernel-devel-$(uname -r)
install_package kernel-headers-$(uname -r)
elif is_ubuntu ; then
install_package linux-headers-$(uname -r)
fi
if [ ! -f configure ] ; then
@ -94,6 +102,15 @@ function compile_ovs {
# start_new_ovs() - removes old ovs database, creates a new one and starts ovs
function start_new_ovs () {
rm -f /etc/openvswitch/conf.db /etc/openvswitch/.conf.db~lock~
sudo rm -f /etc/openvswitch/conf.db /etc/openvswitch/.conf.db~lock~
sudo /usr/share/openvswitch/scripts/ovs-ctl start
}
# remove_ovs_packages() - removes old ovs packages from the system
function remove_ovs_packages() {
for package in openvswitch openvswitch-switch openvswitch-common; do
if is_package_installed $package; then
uninstall_package $package
fi
done
}

View File

@ -6,6 +6,9 @@ source $LIBDIR/l2_agent
source $LIBDIR/l2_agent_sriovnicswitch
source $LIBDIR/ml2
source $LIBDIR/qos
source $LIBDIR/ovs
Q_BUILD_OVS_FROM_GIT=$(trueorfalse False Q_BUILD_OVS_FROM_GIT)
if [[ "$1" == "stack" ]]; then
case "$2" in
@ -19,6 +22,12 @@ if [[ "$1" == "stack" ]]; then
if is_service_enabled q-bgp; then
configure_bgp
fi
if [[ "$Q_AGENT" == "openvswitch" ]] && \
[[ "$Q_BUILD_OVS_FROM_GIT" == "True" ]]; then
remove_ovs_packages
compile_ovs True /usr /var
start_new_ovs
fi
;;
post-config)
if is_service_enabled q-agt; then

View File

@ -28,11 +28,7 @@ then
# we use a commit on branch-2.5 that fixes compilation with the
# latest ubuntu trusty kernel.
OVS_BRANCH=8c0b419a0b9ac0141d6973dcc80306dfc6a83d31
for package in openvswitch openvswitch-switch openvswitch-common; do
if is_package_installed $package; then
uninstall_package $package
fi
done
remove_ovs_packages
compile_ovs True /usr /var
start_new_ovs
fi