[ovs-dev] [PATCH 1/2 ovn] OVN: Fix container build.

amginwal at gmail.com amginwal at gmail.com
Thu Sep 12 00:06:33 UTC 2019


From: Aliasgar Ginwala <aginwala at ebay.com>

Current code changes in ovs/ovn split replaced openvswitch with ovn and
caused container patches to break.
Also, as per ff4439d, one should build ovn specifying ovs source.
This patch fixes the same.
---
 utilities/docker/create_ovn_dbs.sh | 18 ------------------
 utilities/docker/debian/Dockerfile | 12 +++++-------
 utilities/docker/debian/build.sh   | 20 +++++++++++++++++---
 utilities/docker/start-ovn         | 26 +++++++++++++-------------
 4 files changed, 35 insertions(+), 41 deletions(-)
 delete mode 100755 utilities/docker/create_ovn_dbs.sh

diff --git a/utilities/docker/create_ovn_dbs.sh b/utilities/docker/create_ovn_dbs.sh
deleted file mode 100755
index 43ab367d6..000000000
--- a/utilities/docker/create_ovn_dbs.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-ovsdb-tool create /etc/openvswitch/ovnnb_db.db \
-/usr/share/openvswitch/ovn-nb.ovsschema
-ovsdb-tool create /etc/openvswitch/ovnsb_db.db \
-/usr/share/openvswitch/ovn-sb.ovsschema
diff --git a/utilities/docker/debian/Dockerfile b/utilities/docker/debian/Dockerfile
index fe72c3a33..30504480d 100644
--- a/utilities/docker/debian/Dockerfile
+++ b/utilities/docker/debian/Dockerfile
@@ -9,14 +9,12 @@ ARG DISTRO
 copy $DISTRO/build.sh /build.sh
 RUN /build.sh $KERNEL_VERSION $OVN_BRANCH $GITHUB_SRC
 
-COPY create_ovn_dbs.sh /etc/openvswitch/create_ovn_dbs.sh
-RUN /etc/openvswitch/create_ovn_dbs.sh
-
-COPY ovn_default_nb_port /etc/openvswitch/ovn_default_nb_port
-COPY ovn_default_sb_port /etc/openvswitch/ovn_default_sb_port
-COPY ovn_default_northd_host /etc/openvswitch/ovn_default_northd_host
+COPY ovn_default_nb_port /etc/ovn/ovn_default_nb_port
+COPY ovn_default_sb_port /etc/ovn/ovn_default_sb_port
+COPY ovn_default_northd_host /etc/ovn/ovn_default_northd_host
 
 COPY start-ovn /bin/start-ovn
 VOLUME ["/var/log/openvswitch", \
-"/var/lib/openvswitch", "/var/run/openvswitch", "/etc/openvswitch"]
+"/var/lib/openvswitch", "/var/run/openvswitch", "/etc/openvswitch", \
+"/var/log/ovn", "/var/lib/ovn", "/var/run/ovn", "/etc/ovn"]
 ENTRYPOINT ["start-ovn"]
diff --git a/utilities/docker/debian/build.sh b/utilities/docker/debian/build.sh
index fd26a8aa8..3c404bc39 100755
--- a/utilities/docker/debian/build.sh
+++ b/utilities/docker/debian/build.sh
@@ -25,20 +25,34 @@ dh-autoreconf openssl"
 apt-get update
 apt-get install -y ${linux} ${build_deps}
 
-# get the source
+# get ovs source always from master as its needed as dependency
 mkdir /build; cd /build
+git clone --depth 1 -b master https://github.com/openvswitch/ovs.git
+cd ovs;
+mkdir _gcc;
+
+# build and install
+./boot.sh
+cd _gcc
+../configure --localstatedir="/var" --sysconfdir="/etc" --prefix="/usr" \
+--with-linux=/lib/modules/$KERNEL_VERSION/build --enable-ssl
+cd ..; make -C _gcc install; cd ..
+
+
+# get ovn source
 git clone --depth 1 -b $OVN_BRANCH $GITHUB_SRC
 cd ovn
 
 # build and install
 ./boot.sh
 ./configure --localstatedir="/var" --sysconfdir="/etc" --prefix="/usr" \
---with-linux=/lib/modules/$KERNEL_VERSION/build --enable-ssl
+--with-linux=/lib/modules/$KERNEL_VERSION/build --enable-ssl \
+--with-ovs-source=/build/ovs/ --with-ovs-build=/build/ovs/_gcc
 make -j8; make install
 
 # remove deps to make the container light weight.
 apt-get remove --purge -y ${build_deps}
 apt-get autoremove -y --purge
-cd ..; rm -rf ovn
+cd ..; rm -rf ovn; rm -rf ovs
 basic_utils="vim kmod net-tools uuid-runtime iproute2"
 apt-get install -y ${basic_utils}
diff --git a/utilities/docker/start-ovn b/utilities/docker/start-ovn
index 7f87e65a3..7457836fe 100755
--- a/utilities/docker/start-ovn
+++ b/utilities/docker/start-ovn
@@ -13,28 +13,28 @@
 # limitations under the License.
 
 case $1 in
-        "ovn-nb-tcp") source /etc/openvswitch/ovn_default_nb_port
-                      /usr/share/openvswitch/scripts/ovn-ctl start_ovsdb
+        "ovn-nb-tcp") source /etc/ovn/ovn_default_nb_port
+                      /usr/share/ovn/scripts/ovn-ctl start_ovsdb
                       ovn-nbctl set-connection ptcp:$nb_db_port
-                      /usr/share/openvswitch/scripts/ovn-ctl stop_ovsdb
-                      /usr/share/openvswitch/scripts/ovn-ctl run_nb_ovsdb
+                      /usr/share/ovn/scripts/ovn-ctl stop_ovsdb
+                      /usr/share/ovn/scripts/ovn-ctl run_nb_ovsdb
         ;;
-        "ovn-sb-tcp") source /etc/openvswitch/ovn_default_sb_port
-                      /usr/share/openvswitch/scripts/ovn-ctl start_ovsdb
+        "ovn-sb-tcp") source /etc/ovn/ovn_default_sb_port
+                      /usr/share/ovn/scripts/ovn-ctl start_ovsdb
                       ovn-sbctl set-connection ptcp:$sb_db_port
-                      /usr/share/openvswitch/scripts/ovn-ctl stop_ovsdb
-                      /usr/share/openvswitch/scripts/ovn-ctl run_sb_ovsdb
+                      /usr/share/ovn/scripts/ovn-ctl stop_ovsdb
+                      /usr/share/ovn/scripts/ovn-ctl run_sb_ovsdb
         ;;
-        "ovn-northd-tcp") source /etc/openvswitch/ovn_default_northd_host
-                          source /etc/openvswitch/ovn_default_nb_port
-                          source /etc/openvswitch/ovn_default_sb_port
+        "ovn-northd-tcp") source /etc/ovn/ovn_default_northd_host
+                          source /etc/ovn/ovn_default_nb_port
+                          source /etc/ovn/ovn_default_sb_port
                           ovn-northd --pidfile \
                           --ovnnb-db="tcp:$northd_host:$nb_db_port" \
                           --ovnsb-db="tcp:$northd_host:$sb_db_port" \
-                          --log-file=/var/log/openvswitch/ovn-northd.log
+                          --log-file=/var/log/ovn/ovn-northd.log
         ;;
         "ovn-controller") ovn-controller --pidfile \
-                          --log-file=/var/log/openvswitch/ovn-controller.log
+                          --log-file=/var/log/ovn/ovn-controller.log
         ;;
         *) echo "$0 [ovn-nb-tcp|ovn-sb-tcp|ovn-northd-tcp|ovn-controller]"
 esac
-- 
2.20.1 (Apple Git-117)



More information about the dev mailing list