[ovs-dev] [PATCH ovn v1] vagrant: Use python3 and newer linux distros

Flavio Fernandes flavio at flaviof.com
Sun Nov 3 19:15:18 UTC 2019


Stop usage of python2 as ovs+ovn no longer support it.
Update vagrant boxes to the following revisions:

- Debian: buster (from jessie)
- Fedora: v31 (from v29)
- Centos: 8 (from 7, kinda**)

Centos 7 may still be used, but only if explicitly
provided in command: 'vagrant up centos-7'

Fedora-31's dnf is not reliable. This patch
uses a max retry loop to improve the odds of success.

Not all tests are passing when doing 'make check' and
that is not related to this change [1].
While provisioning will invoke 'make check', failures will
be ignored based on this variable: exit_rc_when_failed.

The provisioning does not yet include building rpms+deb
packages.

[1]: https://github.com/ovn-org/ovn/issues/23

Signed-off-by: Flavio Fernandes <flavio at flaviof.com>
---
Vagrantfile | 96 +++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 68 insertions(+), 28 deletions(-)

diff --git a/Vagrantfile b/Vagrantfile
index 07ed0b0e0..88c981c71 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -6,41 +6,58 @@ VAGRANTFILE_API_VERSION = "2"
 Vagrant.require_version ">=1.7.0"
 
 $bootstrap_ovs_fedora = <<SCRIPT
-dnf -y update
-dnf -y install autoconf automake openssl-devel libtool \
-               python-devel python3-devel \
-               python-twisted python-zope-interface \
+#dnf -y update ||:  ; # save your time. "vagrant box update" is your friend
+
+# loop to deal with flaky dnf
+cnt=0
+until [ $cnt -ge 3 ] ; do
+   dnf -y -vvv install autoconf automake openssl-devel libtool \
+               python3-devel \
+               python3-twisted python3-zope-interface python3-six \
                desktop-file-utils groff graphviz rpmdevtools nc curl \
-               wget python-six pyftpdlib checkpolicy selinux-policy-devel \
+               wget pyftpdlib checkpolicy selinux-policy-devel \
                libcap-ng-devel kernel-devel-`uname -r` ethtool python-tftpy \
                lftp
+   if [ "$?" -eq 0 ]; then break ; fi
+   (( cnt++ ))
+   >&2 echo "Sad panda: dnf failed ${cnt} times."
+done
+
 echo "search extra update built-in" >/etc/depmod.d/search_path.conf
 SCRIPT
 
 $bootstrap_ovs_debian = <<SCRIPT
-aptitude -y update
-aptitude -y upgrade
-aptitude -y install -R \
-                build-essential dpkg-dev lintian devscripts fakeroot \
-                debhelper dh-autoreconf uuid-runtime \
-                autoconf automake libtool \
-                python-all python-twisted-core python-twisted-conch \
-                xdg-utils groff graphviz netcat curl \
-                wget python-six ethtool \
-                libcap-ng-dev libssl-dev python-dev openssl \
-                python-pyftpdlib python-flake8 python-tftpy \
-                linux-headers-`uname -r` \
-                lftp
+update-alternatives --install /usr/bin/python python /usr/bin/python3 1
+apt-get update
+#apt-get -y upgrade  ; # save your time. "vagrant box update" is your friend
+apt-get -y install build-essential fakeroot graphviz autoconf automake bzip2 \
+                   debhelper dh-autoreconf libssl-dev libtool openssl procps \
+                   python-all python-qt4 python-twisted-conch python-zopeinterface \
+                   python-six libcap-ng-dev libunbound-dev
 SCRIPT
 
-$bootstrap_ovs_centos = <<SCRIPT
-yum -y update
+$bootstrap_ovs_centos7 = <<SCRIPT
+yum -y update  ; # save your time. "vagrant box update" is your friend
 yum -y install autoconf automake openssl-devel libtool \
-               python-twisted-core python-zope-interface \
+               python3-devel python3-twisted-core python3-zope-interface \
                desktop-file-utils groff graphviz rpmdevtools nc curl \
                wget python-six pyftpdlib checkpolicy selinux-policy-devel \
                libcap-ng-devel kernel-devel-`uname -r` ethtool net-tools \
                lftp
+pip3 install six
+SCRIPT
+
+$bootstrap_ovs_centos = <<SCRIPT
+dnf -y update ||:  ; # save your time. "vagrant box update" is your friend
+dnf -y install autoconf automake openssl-devel libtool \
+               python3-devel \
+               python3-twisted python3-zope-interface python3-six \
+               desktop-file-utils graphviz rpmdevtools nc curl \
+               wget checkpolicy selinux-policy-devel \
+               libcap-ng-devel kernel-devel-`uname -r` ethtool \
+               lftp
+echo "search extra update built-in" >/etc/depmod.d/search_path.conf
+pip3 install pyftpdlib tftpy
 SCRIPT
 
 $configure_ovs = <<SCRIPT
@@ -78,12 +95,17 @@ SCRIPT
 
 $test_ovn = <<SCRIPT
 cd ~/build/ovn
-make check RECHECK=yes
+exit_rc_when_failed=0 ; # make this non-zero to halt provision
+make check RECHECK=yes || {
+   >&2 echo "ERROR: CHECK FAILED $?"
+   exit ${exit_rc_when_failed}
+}
 SCRIPT
 
 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
-  config.vm.define "debian-8" do |debian|
-       debian.vm.box = "debian/jessie64"
+  config.vm.define "debian-10" do |debian|
+       debian.vm.hostname = "debian-10"
+       debian.vm.box = "debian/buster64"
        debian.vm.synced_folder ".", "/vagrant", disabled: true
        debian.vm.synced_folder ".", "/vagrant/ovn", type: "rsync"
        debian.vm.synced_folder "../ovs", "/vagrant/ovs", type: "rsync"
@@ -97,8 +119,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
        debian.vm.provision "build_ovn", type: "shell", inline: $build_ovn
        debian.vm.provision "test_ovn", type: "shell", inline: $test_ovn
   end
-  config.vm.define "fedora-29" do |fedora|
-       fedora.vm.box = "fedora/29-cloud-base"
+  config.vm.define "fedora-31" do |fedora|
+       fedora.vm.hostname = "fedora-31"
+       fedora.vm.box = "fedora/31-cloud-base"
        fedora.vm.synced_folder ".", "/vagrant", disabled: true
        fedora.vm.synced_folder ".", "/vagrant/ovn", type: "rsync"
        fedora.vm.synced_folder "../ovs", "/vagrant/ovs", type: "rsync"
@@ -112,8 +135,25 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
        fedora.vm.provision "build_ovn", type: "shell", inline: $build_ovn
        fedora.vm.provision "test_ovn", type: "shell", inline: $test_ovn
   end
-  config.vm.define "centos-7" do |centos|
-       centos.vm.box = "centos/7"
+  config.vm.define "centos-7", autostart: false do |centos7|
+       centos7.vm.hostname = "centos-7"
+       centos7.vm.box = "centos/7"
+       centos7.vm.synced_folder ".", "/vagrant", disabled: true
+       centos7.vm.synced_folder ".", "/vagrant/ovn", type: "rsync"
+       centos7.vm.synced_folder "../ovs", "/vagrant/ovs", type: "rsync"
+       centos7.vm.provision "bootstrap_ovs", type: "shell",
+                           inline: $bootstrap_ovs_centos7
+       centos7.vm.provision "configure_ovs", type: "shell",
+                           inline: $configure_ovs
+       centos7.vm.provision "build_ovs", type: "shell", inline: $build_ovs
+       centos7.vm.provision "configure_ovn", type: "shell",
+                           inline: $configure_ovn
+       centos7.vm.provision "build_ovn", type: "shell", inline: $build_ovn
+       centos7.vm.provision "test_ovn", type: "shell", inline: $test_ovn
+  end
+  config.vm.define "centos-8" do |centos|
+       centos.vm.hostname = "centos-8"
+       centos.vm.box = "generic/centos8"
        centos.vm.synced_folder ".", "/vagrant", disabled: true
        centos.vm.synced_folder ".", "/vagrant/ovn", type: "rsync"
        centos.vm.synced_folder "../ovs", "/vagrant/ovs", type: "rsync"
-- 
2.17.1



More information about the dev mailing list