-
Notifications
You must be signed in to change notification settings - Fork 254
/
Vagrantfile
179 lines (165 loc) · 7.05 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">=1.7.0"
$bootstrap_ovs_fedora = <<SCRIPT
#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 \
desktop-file-utils groff graphviz rpmdevtools nc curl \
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
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 \
libcap-ng-dev libunbound-dev
SCRIPT
$bootstrap_ovs_centos7 = <<SCRIPT
#yum -y update ; # save your time. "vagrant box update" is your friend
yum -y install autoconf automake openssl-devel libtool \
python3-devel python3-twisted-core python3-zope-interface \
desktop-file-utils groff graphviz rpmdevtools nc curl \
wget pyftpdlib checkpolicy selinux-policy-devel \
libcap-ng-devel kernel-devel-`uname -r` ethtool net-tools \
lftp
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-pip \
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 twisted zope-interface
SCRIPT
$configure_ovs = <<SCRIPT
cd /vagrant/ovs
./boot.sh
[ -f Makefile ] && ./configure && make distclean
mkdir -pv ~/build/ovs
cd ~/build/ovs
/vagrant/ovs/configure --prefix=/usr
SCRIPT
$build_ovs = <<SCRIPT
cd ~/build/ovs
make -j$(($(nproc) + 1)) V=0
make install
SCRIPT
$configure_ovn = <<SCRIPT
cd /vagrant/ovn
./boot.sh
[ -f Makefile ] && \
./configure --prefix=/usr --with-ovs-source=/vagrant/ovs \
--with-ovs-build=${HOME}/build/ovs && make distclean
mkdir -pv ~/build/ovn
cd ~/build/ovn
/vagrant/ovn/configure --prefix=/usr --with-ovs-source=/vagrant/ovs \
--with-ovs-build=${HOME}/build/ovs
SCRIPT
$build_ovn = <<SCRIPT
cd ~/build/ovn
make -j$(($(nproc) + 1))
make install
SCRIPT
$test_ovn = <<SCRIPT
cd ~/build/ovn
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|
vm_memory = ENV['VM_MEMORY'] || '1024'
vm_cpus = ENV['VM_CPUS'] || '4'
config.vm.provider 'libvirt' do |lb|
lb.memory = vm_memory
lb.cpus = vm_cpus
end
config.vm.provider "virtualbox" do |vb|
vb.memory = vm_memory
vb.cpus = vm_cpus
end
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"
debian.vm.provision "bootstrap_ovs", type: "shell",
inline: $bootstrap_ovs_debian
debian.vm.provision "configure_ovs", type: "shell",
inline: $configure_ovs
debian.vm.provision "build_ovs", type: "shell", inline: $build_ovs
debian.vm.provision "configure_ovn", type: "shell",
inline: $configure_ovn
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-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"
fedora.vm.provision "bootstrap_ovs", type: "shell",
inline: $bootstrap_ovs_fedora
fedora.vm.provision "configure_ovs", type: "shell",
inline: $configure_ovs
fedora.vm.provision "build_ovs", type: "shell", inline: $build_ovs
fedora.vm.provision "configure_ovn", type: "shell",
inline: $configure_ovn
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", 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 = "centos/8"
centos.vm.synced_folder ".", "/vagrant", disabled: true
centos.vm.synced_folder ".", "/vagrant/ovn", type: "rsync"
centos.vm.synced_folder "../ovs", "/vagrant/ovs", type: "rsync"
centos.vm.provision "bootstrap_ovs", type: "shell",
inline: $bootstrap_ovs_centos
centos.vm.provision "configure_ovs", type: "shell",
inline: $configure_ovs
centos.vm.provision "build_ovs", type: "shell", inline: $build_ovs
centos.vm.provision "configure_ovn", type: "shell",
inline: $configure_ovn
centos.vm.provision "build_ovn", type: "shell", inline: $build_ovn
centos.vm.provision "test_ovn", type: "shell", inline: $test_ovn
end
end