From 9f0d324a17a6b1219dc75b64cb57903ce4145f60 Mon Sep 17 00:00:00 2001 From: "long.wang" <42292669+wlooppy@users.noreply.github.com> Date: Sun, 21 Aug 2022 20:47:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20ovs-ovn-dpdk=20=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E9=95=9C=E5=83=8F=E7=BC=96=E8=AF=91=E6=89=93=E5=8C=85?= =?UTF-8?q?=EF=BC=8C=E8=A7=A3=E5=86=B3=E5=AE=B9=E5=99=A8=E4=B8=AD=20ovs=20?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E4=B8=8D=E6=AD=A3=E5=B8=B8=EF=BC=9A=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=B7=BB=E5=8A=A0=E7=89=A9=E7=90=86=E7=BD=91=E5=8D=A1?= =?UTF-8?q?=EF=BC=8C=E6=97=A0=E6=B3=95=E5=88=9B=E5=BB=BA=20vhostuserclient?= =?UTF-8?q?=20port=20=E9=97=AE=E9=A2=98=20(#1831)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add webhook vaildate the vpc resource whether can be deleted. * add note for dpdk-v2 install * set vhostuser dir 777 for qemu has the permission to create sock * Change gosec args to make it happy * edit ovs ovn source patch for compile ovs-dpdk * edit Dockerfile.base-dpdk for compile ovn-ovs-dpdk image Co-authored-by: oilbeater Co-authored-by: wanglong (cherry picked from commit babd802194c97d877d1479236c722c4bbc33a861) --- dist/images/Dockerfile.base-dpdk | 16 ++++++++++++++-- dist/images/start-ovs-dpdk-v2.sh | 17 +++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/dist/images/Dockerfile.base-dpdk b/dist/images/Dockerfile.base-dpdk index 2aee5a8bb3e..53e598a85b8 100644 --- a/dist/images/Dockerfile.base-dpdk +++ b/dist/images/Dockerfile.base-dpdk @@ -2,6 +2,7 @@ FROM ubuntu:22.04 as ovs-builder ARG ARCH +ARG NO_AVX512=false ARG DEBIAN_FRONTEND=noninteractive ENV SRC_DIR='/usr/src' @@ -29,6 +30,8 @@ RUN cd /usr/src/ && \ cd ovs && \ git checkout c50a0f080d95e9027b7ba3a70150b02c2377c721 && \ curl -s https://github.com/kubeovn/ovs/commit/22ea22c40b46ee5adeae977ff6cfca81b3ff25d7.patch | git apply && \ + # compile without avx512 + if [ "$ARCH" = "amd64" -a "$NO_AVX512" = "true" ]; then curl -s https://github.com/kubeovn/ovs/commit/38c59e078d69b343f56ab0f380fb9f42b94b7c02.patch | git apply; fi && \ ./boot.sh && \ rm -rf .git && \ export DPDK_DIR=/usr/src/dpdk-stable-20.11.1 && \ @@ -48,7 +51,14 @@ RUN cd /usr/src/ && git clone -b branch-21.06 --depth=1 https://github.com/kubeo if [ "$ARCH" = "amd64" ]; then CONFIGURE_OPTS='LIBS=-ljemalloc CFLAGS="-O2 -g -msse4.2 -mpopcnt"'; fi && \ OVSDIR=/usr/src/ovs EXTRA_CONFIGURE_OPTS=$CONFIGURE_OPTS DEB_BUILD_OPTIONS='parallel=8 nocheck' fakeroot debian/rules binary +RUN cd /usr/src/ && \ + cd ovs && \ + ./boot.sh && \ + ./configure --with-dpdk=yes && \ + make + RUN mkdir /packages/ && \ + cp /usr/src/ovs/vswitchd/ovs-vswitchd /packages && \ cp /usr/src/libopenvswitch*.deb /packages && \ cp /usr/src/openvswitch-*.deb /packages && \ cp /usr/src/python3-openvswitch*.deb /packages && \ @@ -58,7 +68,7 @@ RUN mkdir /packages/ && \ FROM ubuntu:22.04 ARG DEBIAN_FRONTEND=noninteractive -RUN apt update && apt upgrade -y && apt install ca-certificates python3 hostname libunwind8 netbase \ +RUN apt update && apt upgrade -y && apt install ca-certificates python3 hostname driverctl libunwind8 netbase \ ethtool iproute2 ncat libunbound-dev procps libatomic1 kmod iptables \ tcpdump ipset curl uuid-runtime openssl inetutils-ping arping ndisc6 \ logrotate libjemalloc2 dnsutils libnuma-dev -y --no-install-recommends && \ @@ -81,4 +91,6 @@ RUN --mount=type=bind,target=/packages,from=ovs-builder,source=/packages \ dpkg -i /packages/libopenvswitch*.deb && \ dpkg -i /packages/openvswitch-*.deb && \ dpkg -i /packages/python3-openvswitch*.deb &&\ - dpkg -i --ignore-depends=openvswitch-switch,openvswitch-common /packages/ovn-*.deb + dpkg -i --ignore-depends=openvswitch-switch,openvswitch-common /packages/ovn-*.deb && \ + cp -f /packages/ovs-vswitchd /usr/sbin/ + diff --git a/dist/images/start-ovs-dpdk-v2.sh b/dist/images/start-ovs-dpdk-v2.sh index b7e3946c733..1d67bc4e7a4 100755 --- a/dist/images/start-ovs-dpdk-v2.sh +++ b/dist/images/start-ovs-dpdk-v2.sh @@ -11,6 +11,23 @@ if ! test -f "$OVS_DPDK_CONFIG_FILE"; then fi source $OVS_DPDK_CONFIG_FILE +# set up driver +modprobe vfio-pci + + +# band nic to dpdk driver +driverctl set-override ${DPDK_DEV} modprobe vfio-pci + +# link sock +mkdir -p /usr/local/var/run + +if [ -L /usr/local/var/run/openvswitch ] +then + echo "sock exist" +else + echo "link sock" + ln -s /var/run/openvswitch /usr/local/var/run/openvswitch +fi export PATH=$PATH:/usr/share/openvswitch/scripts export PATH=$PATH:/usr/share/ovn/scripts