summaryrefslogtreecommitdiff
path: root/Vagrantfile
diff options
context:
space:
mode:
authorAndy Zhou <azhou@nicira.com>2015-01-13 16:36:00 -0800
committerAndy Zhou <azhou@nicira.com>2015-01-16 13:20:34 -0800
commit3314f01ee9bdc6e4fa50fbb6033ad8cc88c0563a (patch)
tree803ace472ce7a437e4c0a095989692872c9f42e6 /Vagrantfile
parent69c2bdfef91d7b4c14c189a9fc613e25b10437ab (diff)
downloadopenvswitch-3314f01ee9bdc6e4fa50fbb6033ad8cc88c0563a.tar.gz
Vagrantfile: add test_ovs_kmod provision
Add 'test_ovs_kmod' provision. Command: # vagrant provision --provision-with=test_ovs_kmod will run "make check-kmod" in the vagrant launched VM. It turns out to be more convenient to test within as root. Switch Vagrantfile provisions to run as root user. However, vagrant can still be launched as normal user. Signed-off-by: Andy Zhou <azhou@nicira.com> Acked-by: Thomas Graf <tgraf@noironetworks.com>
Diffstat (limited to 'Vagrantfile')
-rw-r--r--Vagrantfile29
1 files changed, 19 insertions, 10 deletions
diff --git a/Vagrantfile b/Vagrantfile
index 1cacd3b2d..03e8693a6 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -3,6 +3,7 @@
# 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_fedora = <<SCRIPT
yum -y update
@@ -26,6 +27,11 @@ cd ~/build
make
SCRIPT
+$test_kmod = <<SCRIPT
+cd ~/build
+make check-kmod
+SCRIPT
+
$install_rpm = <<SCRIPT
cd ~/build
PACKAGE_VERSION=`autom4te -l Autoconf -t 'AC_INIT:$2' /vagrant/configure.ac`
@@ -34,17 +40,20 @@ rpmdev-setuptree
cp openvswitch-$PACKAGE_VERSION.tar.gz $HOME/rpmbuild/SOURCES
rpmbuild --bb -D "kversion `uname -r`" /vagrant/rhel/openvswitch-kmod-fedora.spec
rpmbuild --bb --without check /vagrant/rhel/openvswitch-fedora.spec
-sudo rpm -e openvswitch
-sudo rpm -ivh $HOME/rpmbuild/RPMS/x86_64/openvswitch-$PACKAGE_VERSION-1.fc20.x86_64.rpm
-sudo systemctl enable openvswitch
-sudo systemctl start openvswitch
-sudo systemctl status openvswitch
+rpm -e openvswitch
+rpm -ivh $HOME/rpmbuild/RPMS/x86_64/openvswitch-$PACKAGE_VERSION-1.fc20.x86_64.rpm
+systemctl enable openvswitch
+systemctl start openvswitch
+systemctl status openvswitch
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
- config.vm.box = "chef/fedora-20"
- config.vm.provision "bootstrap", type: "shell", inline: $bootstrap_fedora
- config.vm.provision "configure_ovs", type: "shell", inline: $configure_ovs, privileged: false
- config.vm.provision "build_ovs", type: "shell", inline: $build_ovs, privileged: false
- config.vm.provision "install_rpm", type: "shell", inline: $install_rpm, privileged: false
+ config.vm.define "fedora-20" do |fedora|
+ fedora.vm.box = "chef/fedora-20"
+ fedora.vm.provision "bootstrap", type: "shell", inline: $bootstrap_fedora
+ fedora.vm.provision "configure_ovs", type: "shell", inline: $configure_ovs
+ fedora.vm.provision "build_ovs", type: "shell", inline: $build_ovs
+ fedora.vm.provision "test_ovs_kmod", type: "shell", inline: $test_kmod
+ fedora.vm.provision "install_rpm", type: "shell", inline: $install_rpm
+ end
end