[ovs-dev] [PATCH] vagrant: Provide basic Vagrantfile

Kyle Mestery mestery at mestery.com
Mon Jan 5 15:41:20 UTC 2015


On Mon, Jan 5, 2015 at 9:31 AM, Thomas Graf <tgraf at noironetworks.com> wrote:

> This is a basic Vagrantfile which compiles and provisions the local OVS
> source tree in a Fedora 20 VM. The Vagrantfile.in can be extended to
> support additional distributions.
>
> To use this Vagrantfile:
>  1. Install Vagrant plus a compatible hypervisor
>  2. Run configure to translate Vagrantfile.in to Vagrantfile
>  3. Run `vagrant up` to create & provision the VM
>  4. Run `vagrant ssh` to log into the VM
>
> Signed-off-by: Thomas Graf <tgraf at noironetworks.com>
> ---
>  .gitignore     |  2 ++
>  INSTALL.md     | 18 ++++++++++++++++++
>  Makefile.am    |  3 ++-
>  Vagrantfile.in | 30 ++++++++++++++++++++++++++++++
>  configure.ac   |  1 +
>  5 files changed, 53 insertions(+), 1 deletion(-)
>  create mode 100644 Vagrantfile.in
>
> diff --git a/.gitignore b/.gitignore
> index 50ec1d7..a3522d8 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -65,3 +65,5 @@ tags
>  _debian
>  odp-netlink.h
>  OvsDpInterface.h
> +Vagrantfile
> +/.vagrant/
> diff --git a/INSTALL.md b/INSTALL.md
> index 941cf37..122c362 100644
> --- a/INSTALL.md
> +++ b/INSTALL.md
> @@ -562,6 +562,24 @@ test failures that you believe to represent bugs in
> Open vSwitch.
>  Include the precise versions of Open vSwitch and Ryu in your bug
>  report, plus any other information needed to reproduce the problem.
>
> +Vagrant
> +-------
> +
> +Requires: Vagrant and a compatible hypervisor
> +
> +A Vagrantfile is provided allowing to compile and provision the source
> +tree as found locally in a virtual machine using the following commands:
> +
> +       vagrant up
> +       vagrant ssh
> +
> +This will bring up w Fedora 20 VM by default, alternatively the
> +`Vagrantfile.in` can be modified to use a different distribution box as
> +base. Also, the VM can be reprovisioned at any time to recompile and
> +reinstall OVS:
> +
> +       vagrant provision
> +
>  Continuous Integration with Travis-CI
>  -------------------------------------
>
> diff --git a/Makefile.am b/Makefile.am
> index 46e8610..e209e3c 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -103,7 +103,8 @@ EXTRA_DIST = \
>         build-aux/sodepends.pl \
>         build-aux/soexpand.pl \
>         $(MAN_FRAGMENTS) \
> -       $(MAN_ROOTS)
> +       $(MAN_ROOTS) \
> +       Vagrantfile.in
>  bin_PROGRAMS =
>  sbin_PROGRAMS =
>  bin_SCRIPTS =
> diff --git a/Vagrantfile.in b/Vagrantfile.in
> new file mode 100644
> index 0000000..ba10ede
> --- /dev/null
> +++ b/Vagrantfile.in
> @@ -0,0 +1,30 @@
> +# -*- mode: ruby -*-
> +# vi: set ft=ruby :
> +
> +# Vagrantfile API/syntax version. Don't touch unless you know what you're
> doing!
> +VAGRANTFILE_API_VERSION = "2"
> +
> +$bootstrap_fedora = <<SCRIPT
> +yum -y update
> +yum -y install autoconf automake openssl-devel libtool \
> +               python-twisted-core python-zope-interface PyQt4 \
> +              desktop-file-utils groff graphviz rpmdevtools
> +cd /vagrant
> +./boot.sh && ./configure
> +make clean && make dist
> +rpmdev-setuptree
> +cp openvswitch- at PACKAGE_VERSION@.tar.gz $HOME/rpmbuild/SOURCES
> +rpmbuild --bb --without check rhel/openvswitch-fedora.spec
> +rpm -e openvswitch
> +rpm -ivh $HOME/rpmbuild/RPMS/x86_64/openvswitch- at PACKAGE_VERSION
> @-1.fc20.x86_64.rpm
> +systemctl enable openvswitch
> +systemctl start openvswitch
> +systemctl status openvswitch
>

Would it be useful to also have this run the OVS tests as a part of this
after installing and starting it? We could also make this use a local OVS
repository instead of pulling from master. In this way, this could be a
somewhat self contained vehicle for testing OVS for developers.

Maybe I'm getting ahead of where you're going with this though. :)


> +SCRIPT
> +
> +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
> +  config.vm.define "fedora-20" do |fedora|
> +    fedora.vm.box = "chef/fedora-20"
> +    fedora.vm.provision :shell, inline: $bootstrap_fedora
> +  end
> +end
> diff --git a/configure.ac b/configure.ac
> index ebb8b02..03f9369 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -177,6 +177,7 @@ AC_CONFIG_FILES(lib/libsflow.pc)
>  AC_CONFIG_FILES(ofproto/libofproto.pc)
>  AC_CONFIG_FILES(ovsdb/libovsdb.pc)
>  AC_CONFIG_FILES(include/openvswitch/version.h)
> +AC_CONFIG_FILES(Vagrantfile)
>
>  dnl This makes sure that include/openflow gets created in the build
> directory.
>  AC_CONFIG_COMMANDS([include/openflow/openflow.h.stamp])
> --
> 1.9.3
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>



More information about the dev mailing list