diff --git a/image/cinc/install_ubuntu_pkg.sh b/image/cinc/install_ubuntu_pkg.sh index 65f241f..5228f35 100755 --- a/image/cinc/install_ubuntu_pkg.sh +++ b/image/cinc/install_ubuntu_pkg.sh @@ -41,6 +41,7 @@ apt install -yq --no-install-recommends \ python3-pip \ python3-psutil \ python3-six \ + python3-systemd \ resource-agents* \ tcpdump \ uuid diff --git a/image/ovn/Dockerfile b/image/ovn/Dockerfile index 03508e7..ff2b14d 100644 --- a/image/ovn/Dockerfile +++ b/image/ovn/Dockerfile @@ -4,6 +4,7 @@ MAINTAINER "Numan Siddique" ARG OVS_SRC_PATH ARG OVN_SRC_PATH ARG USE_OVN_RPMS +ARG USE_OVN_DEBS ARG EXTRA_OPTIMIZE ARG INSTALL_UTILS_FROM_SOURCES ARG USE_OVSDB_ETCD @@ -11,7 +12,8 @@ ARG USE_OVSDB_ETCD COPY $OVS_SRC_PATH /ovs COPY $OVN_SRC_PATH /ovn -COPY *.rpm / +COPY README.md *.rpm / +COPY README.md *.deb / COPY install_ovn.sh /install_ovn.sh COPY install_utils_from_sources.sh /install_utils_from_sources.sh COPY install_ovsdb_etcd.sh /install_ovsdb_etcd.sh @@ -20,11 +22,19 @@ COPY run_ovsdb_etcd.sh /run_ovsdb_etcd.sh COPY run_ovsdb_etcd_sb.sh /run_ovsdb_etcd_sb.sh COPY run_ovsdb_etcd_nb.sh /run_ovsdb_etcd_nb.sh -RUN /install_ovn.sh $USE_OVN_RPMS $EXTRA_OPTIMIZE +RUN /install_ovn.sh $USE_OVN_RPMS $USE_OVN_DEBS $EXTRA_OPTIMIZE RUN /install_utils_from_sources.sh $INSTALL_UTILS_FROM_SOURCES RUN /install_ovsdb_etcd.sh RUN /install_etcd.sh +RUN if [ "$USE_OVN_RPMS" = "yes" ] || [ "$USE_OVN_DEBS" = "yes" ] ; then \ + /usr/bin/systemctl disable ovn-central && \ + /usr/bin/systemctl disable ovn-ic-db && \ + /usr/bin/systemctl disable ovn-ic && \ + /usr/bin/systemctl disable openvswitch-switch && \ + /usr/bin/systemctl disable ovn-host ; \ + fi + VOLUME ["/var/log/openvswitch", \ "/var/lib/openvswitch", "/var/run/openvswitch", "/etc/openvswitch", \ "/var/log/ovn", "/var/lib/ovn", "/var/run/ovn", "/etc/ovn"] diff --git a/install_ovn.sh b/install_ovn.sh index 2f1b276..2ff527f 100755 --- a/install_ovn.sh +++ b/install_ovn.sh @@ -16,7 +16,8 @@ set -o xtrace set -o errexit use_ovn_rpm=$1 -extra_optimize=$2 +use_ovn_debs=$2 +extra_optimize=$3 # When system's python environment is marked as "Externally managed" # (PEP 668), this variable is needed to allow pip to install @@ -32,6 +33,10 @@ fi if [ "$use_ovn_rpm" = "yes" ]; then ls ovn*.rpm > /dev/null || exit 1 dnf install -y /*.rpm +elif [ "$use_ovn_debs" = "yes" ]; then + ls ovn*.deb > /dev/null || exit 1 + apt update + apt install -y /*.deb else mkdir -p /root/ovsdb-etcd/schemas @@ -90,7 +95,7 @@ popd dnf autoremove -y || apt autoremove -y # Clean all object files -if [ "$use_ovn_rpm" = "no" ]; then +if [ "$use_ovn_rpm" = "no" ] && [ "$use_ovn_debs" = "no" ]; then cd /ovs make distclean cd /ovn diff --git a/ovn_cluster.sh b/ovn_cluster.sh index 762e66a..c0f54f8 100755 --- a/ovn_cluster.sh +++ b/ovn_cluster.sh @@ -13,6 +13,7 @@ GW_IMAGE=${GW_IMAGE:-"ovn/ovn-multi-node:latest"} RELAY_IMAGE=${RELAY_IMAGE:-"ovn/ovn-multi-node:latest"} USE_OVN_RPMS="${USE_OVN_RPMS:-no}" +USE_OVN_DEBS="${USE_OVN_DEBS:-no}" EXTRA_OPTIMIZE="${EXTRA_OPTIMIZE:-no}" OS_BASE=${OS_BASE:-"fedora"} OS_IMAGE=${OS_IMAGE:-"quay.io/fedora/fedora:latest"} @@ -964,7 +965,7 @@ function build-images() { ${RUNC_CMD} build -t ovn/ovn-multi-node --build-arg OVS_SRC_PATH=ovs \ --build-arg OVN_SRC_PATH=ovn --build-arg USE_OVN_RPMS=${USE_OVN_RPMS} \ - --build-arg EXTRA_OPTIMIZE=${EXTRA_OPTIMIZE} \ + --build-arg USE_OVN_DEBS=${USE_OVN_DEBS} --build-arg EXTRA_OPTIMIZE=${EXTRA_OPTIMIZE} \ --build-arg INSTALL_UTILS_FROM_SOURCES=${INSTALL_UTILS_FROM_SOURCES} \ --build-arg USE_OVSDB_ETCD=${USE_OVSDB_ETCD} \ -f image/ovn/Dockerfile . @@ -975,6 +976,11 @@ function check-for-ovn-rpms() { ls ovn*.rpm > /dev/null 2>&1 || USE_OVN_RPMS=no } +function check-for-ovn-debs() { + USE_OVN_DEBS=yes + ls ovn*.deb > /dev/null 2>&1 || USE_OVN_DEBS=no +} + function build-images-with-ovn-rpms() { mkdir -p ovs mkdir -p ovn @@ -982,6 +988,13 @@ function build-images-with-ovn-rpms() { build-images } +function build-images-with-ovn-debs() { + mkdir -p ovs + mkdir -p ovn + rm -f tst.deb + build-images +} + function build-images-with-ovn-sources() { if [ ! -d ./ovs ]; then echo "OVS_SRC_PATH = $OVS_SRC_PATH" @@ -1007,8 +1020,10 @@ function build-images-with-ovn-sources() { fi touch tst.rpm + touch tst.deb build-images rm -f tst.rpm + rm -f tst.deb [ -n "$DO_RM_OVS" ] && rm -rf ovs ||: [ -n "$DO_RM_OVN" ] && rm -rf ovn ||: } @@ -1114,10 +1129,25 @@ case "${1:-""}" in ;; build) check-for-ovn-rpms + check-for-ovn-debs if [ "$USE_OVN_RPMS" == "yes" ] then + if [ "$USE_OVN_DEBS" == "yes" ] + then + echo "Do not keep rpm and deb packages on the same directory or enable both package manager!" + exit 1 + fi echo "Building images using OVN rpms" build-images-with-ovn-rpms + elif [ "$USE_OVN_DEBS" == "yes" ] + then + if [ "$USE_OVN_RPMS" == "yes" ] + then + echo "Do not keep rpm and deb packages on the same directory or enable both package manager!" + exit 1 + fi + echo "Building images using OVN debs" + build-images-with-ovn-debs else echo "Building images using OVN/OVS sources" build-images-with-ovn-sources