OVN developers have had isssues with the current method by which OVS
source code is used by OVN.

* There is no way to record the minimum commit/version of OVS to use
  when compiling OVN.
* When debugging issues, bisecting OVN commits may also requires
  simultaneously changing OVS commits. This makes for multiple moving
  targets to try to track.
* Performance improvements made to OVS libraries and OVSDB may benefit
  OVN. However, there's no way to encourage the use of the improved OVS
  source.

By using a submodule, it allows for OVN to record a specific commit of
OVS that is expected to be used.

Signed-off-by: Mark Michelson <[email protected]>
---
 .gitmodules                             |  3 +++
 Documentation/intro/install/general.rst | 19 ++++++++++++++++---
 Makefile.am                             | 20 ++++++++++----------
 acinclude.m4                            |  2 +-
 build-aux/initial-tab-whitelist         |  1 +
 ovs                                     |  1 +
 6 files changed, 32 insertions(+), 14 deletions(-)
 create mode 100644 .gitmodules
 create mode 160000 ovs

diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 000000000..5c36a018f
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "ovs"]
+       path = ovs
+       url = [email protected]:openvswitch/ovs.git
diff --git a/Documentation/intro/install/general.rst 
b/Documentation/intro/install/general.rst
index 65b1f4a40..1f19baec4 100644
--- a/Documentation/intro/install/general.rst
+++ b/Documentation/intro/install/general.rst
@@ -66,6 +66,9 @@ To compile the userspace programs in the OVN distribution, 
you will
 need the following software:
 
 - Open vSwitch (https://docs.openvswitch.org/en/latest/intro/install/).
+  Open vSwitch is included as a submodule in the OVN source code. It is
+  kept at the minimum version required in order for OVN to compile. See
+  below for instructions about how to use a different OVS source location.
 
 - GNU make
 
@@ -153,9 +156,19 @@ Before configuring OVN, clone, configure and build Open 
vSwitch.
 Configuring
 -----------
 
-Configure the package by running the configure script. You need to
-invoke configure with atleast the argument --with-ovs-source.
-For example::
+OVN requires Open vSwitch source code to be present in order to compile.
+The easiest way to fulfill this requirement is to use the included ovs
+submodule. After cloning the OVN source, run the following to initialize
+the ovs submodule::
+
+    $ git submodule udpate --init
+
+Then configure the package by running the configure script::
+
+    $ ./configure
+
+If desired, you may override the default ovs source code location by
+specifying the location using --with-ovs-source::
 
     $ ./configure --with-ovs-source=/path/to/ovs/source
 
diff --git a/Makefile.am b/Makefile.am
index 7ce3d27e4..c779328ec 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -157,6 +157,7 @@ noinst_HEADERS += $(EXTRA_DIST)
 
 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
 ro_shell = printf '\043 Generated automatically -- do not modify!    -*- 
buffer-read-only: t -*-\n'
+submodules = $(shell grep 'path =' .gitmodules | sed -E 's/\s*path = (.*)/\1/')
 
 SUFFIXES += .in
 .in:
@@ -216,6 +217,8 @@ dist-hook-git: distfiles
        @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
          (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
            grep -v '\.gitattributes$$' | \
+           grep -v '\.gitmodules$$' | \
+           grep -v "$(submodules)" | \
            LC_ALL=C sort -u > all-gitfiles; \
          LC_ALL=C comm -1 -3 distfiles all-gitfiles > missing-distfiles; \
          if test -s missing-distfiles; then \
@@ -247,8 +250,8 @@ ALL_LOCAL += config-h-check
 config-h-check:
        @cd $(srcdir); \
        if test -e .git && (git --version) >/dev/null 2>&1 && \
-         git --no-pager grep -L '#include <config\.h>' `git ls-files | grep 
'\.c$$' | \
-           grep -vE 
'^ovs/datapath|^ovs/lib/sflow|^ovs/datapath-windows|^python|^ovs/python'`; \
+         git --no-pager grep -L '#include <config\.h>' `git ls-files | grep -v 
$(submodules) | grep '\.c$$' | \
+           grep -vE '^python'`; \
        then \
          echo "See above for list of violations of the rule that"; \
          echo "every C source file must #include <config.h>."; \
@@ -261,8 +264,7 @@ ALL_LOCAL += printf-check
 printf-check:
        @cd $(srcdir); \
        if test -e .git && (git --version) >/dev/null 2>&1 && \
-         git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 
'ovs_scan' `git ls-files | grep '\.[ch]$$' | \
-           grep -vE '^ovs/datapath|^ovs/lib/sflow'`; \
+         git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 
'ovs_scan' `git ls-files | grep -v $(submodules) | grep '\.[ch]$$'`; \
        then \
          echo "See above for list of violations of the rule that"; \
          echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
@@ -288,7 +290,7 @@ ALL_LOCAL += check-assert-h-usage
 check-assert-h-usage:
        @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
          (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
-         $(EGREP) -v '^ovs/lib/(sflow_receiver|vlog).c$$|^ovs/tests/|^tests/'; 
\
+         $(EGREP) -v '^tests/'; \
        then \
          echo "Files listed above unexpectedly #include <""assert.h"">."; \
          echo "Please use ovs_assert (from util.h) instead of assert."; \
@@ -304,8 +306,7 @@ ALL_LOCAL += check-endian
 check-endian:
        @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
          (cd $(srcdir) && git --no-pager grep -l -E \
-          -e 'BIG_ENDIAN|LITTLE_ENDIAN' --and --not -e 'BYTE_ORDER' | \
-         $(EGREP) -v '^ovs/datapath/|^ovs/include/sparse/rte_'); \
+          -e 'BIG_ENDIAN|LITTLE_ENDIAN' --and --not -e 'BYTE_ORDER'); \
        then \
          echo "See above for list of files that misuse LITTLE""_ENDIAN"; \
          echo "or BIG""_ENDIAN.  Please use WORDS_BIGENDIAN instead."; \
@@ -329,7 +330,7 @@ check-tabs:
        @cd $(srcdir); \
        if test -e .git && (git --version) >/dev/null 2>&1 && \
          grep -ln "^   " \
-           `git ls-files \
+           `git ls-files | grep -v $(submodules) \
              | grep -v -f build-aux/initial-tab-whitelist` /dev/null \
              | $(EGREP) -v ':[         ]*/?\*'; \
        then \
@@ -344,8 +345,7 @@ thread-safety-check:
        @cd $(srcdir); \
        if test -e .git && (git --version) >/dev/null 2>&1 && \
          grep -n -f build-aux/thread-safety-blacklist \
-           `git ls-files | grep '\.[ch]$$' \
-             | $(EGREP) -v '^ovs/datapath|^ovs/lib/sflow'` /dev/null \
+           `git ls-files | grep -v $(submodules) | grep '\.[ch]$$'` /dev/null \
              | $(EGREP) -v ':[         ]*/?\*'; \
        then \
          echo "See above for list of calls to functions that are"; \
diff --git a/acinclude.m4 b/acinclude.m4
index a797adc82..2f8755961 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -338,7 +338,7 @@ AC_DEFUN([OVN_CHECK_OVS], [
       AC_ERROR([$OVSDIR is not an OVS source directory])
     fi
   else
-    AC_ERROR([OVS source dir path needs to be specified (use 
--with-ovs-source)])
+    OVSDIR=`pwd`/ovs
   fi
 
   AC_MSG_RESULT([$OVSDIR])
diff --git a/build-aux/initial-tab-whitelist b/build-aux/initial-tab-whitelist
index 216cd2ed3..b2f5a0791 100644
--- a/build-aux/initial-tab-whitelist
+++ b/build-aux/initial-tab-whitelist
@@ -8,3 +8,4 @@
 ^xenserver/
 ^debian/rules.modules$
 ^debian/rules$
+^\.gitmodules$
diff --git a/ovs b/ovs
new file mode 160000
index 000000000..50e5523b9
--- /dev/null
+++ b/ovs
@@ -0,0 +1 @@
+Subproject commit 50e5523b9b2b154e5fafc5acdcdec85e9cc5a330
-- 
2.29.2

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to