diff --git a/devstack/lib/ovs b/devstack/lib/ovs index d722010250e..a889b6eac34 100644 --- a/devstack/lib/ovs +++ b/devstack/lib/ovs @@ -69,7 +69,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 @@ -98,6 +106,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 +} diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 45b10cf79fe..fe97c9c4ee5 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -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 diff --git a/neutron/tests/contrib/gate_hook.sh b/neutron/tests/contrib/gate_hook.sh index b39248f4af0..b0d0b954c81 100644 --- a/neutron/tests/contrib/gate_hook.sh +++ b/neutron/tests/contrib/gate_hook.sh @@ -49,11 +49,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