Unverified Commit 3630c6cb authored by Adam C. Stephens's avatar Adam C. Stephens Committed by GitHub
Browse files

ovn: reduce default closure size; use ovs-lib and other tools from openvswitch (#443589)

parents a6ed8157 fb21562a
Loading
Loading
Loading
Loading
+0 −31
Original line number Diff line number Diff line
From d4ead86b2184d1fc2748ed2b6fae8c0dceaf76c8 Mon Sep 17 00:00:00 2001
From: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
Date: Thu, 11 Sep 2025 23:37:28 -0400
Subject: [PATCH ovn 1/2] tests: Expect musl error string for EIO errno.

Musl uses a slightly different string representation for the error,
which makes the test fail on cleanup because an unexpected warning is
observed in the service log.

This patch will ignore both glibc and musl error messages.

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
---
 tests/ovn-controller.at | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at
index 0b00906ae..bec06e527 100644
--- a/tests/ovn-controller.at
+++ b/tests/ovn-controller.at
@@ -846,6 +846,7 @@ OVN_CLEANUP([hv1
 /Certificate must be configured to use SSL/d
 /SSL_read: error/d
 /receive error: Input/d
+/receive error: I\/O error/d
 /connection dropped/d
 ])
 AT_CLEANUP
-- 
2.50.1
+0 −37
Original line number Diff line number Diff line
From 44d9d58461e15314edf507d0379bff991d7e9964 Mon Sep 17 00:00:00 2001
From: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
Date: Thu, 11 Sep 2025 23:40:51 -0400
Subject: [PATCH ovn 2/2] tests: Use localhost when setting "wrong" ovn-remote.

In some isolated environments (e.g. in nixpkgs build sandbox), the
network namespace doesn't have any routes or interfaces but `lo`. In
this case, an attempt to connect to 192.168.0.10 results in ENETUNREACH,
producing an unexpected "Network unreachable" warning message in service
log file - breaking the test cleanup checks.

Since the test case doesn't seem to care if the address is available, as
long as there is no SB database actually running at the configured
ovn-remote port, use the localhost address instead (which is always
present, even in the most isolated environments).

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
---
 tests/ovn-controller.at | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at
index bec06e527..a8a9a2da2 100644
--- a/tests/ovn-controller.at
+++ b/tests/ovn-controller.at
@@ -404,7 +404,7 @@ check_sbdb_connection () {
 
 OVS_WAIT_UNTIL([check_sbdb_connection connected])
 
-ovs-vsctl set open . external_ids:ovn-remote=tcp:192.168.0.10:6642
+ovs-vsctl set open . external_ids:ovn-remote=tcp:127.0.0.1:12345
 OVS_WAIT_UNTIL([check_sbdb_connection 'not connected'])
 
 # reset the remote for clean-up
-- 
2.50.1
+35 −20
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  lib,
  stdenv,
  fetchFromGitHub,
  fetchpatch,
  autoreconfHook,
  libbpf,
  libcap_ng,
@@ -13,6 +14,8 @@
  python3,
  unbound,
  xdp-tools,
  openvswitch,
  makeWrapper,
}:
let
  withOpensslConfigureFlag = "--with-openssl=${lib.getLib openssl.dev}";
@@ -29,19 +32,32 @@ stdenv.mkDerivation (finalAttrs: {
    fetchSubmodules = true;
  };

  outputs = [
    "out"
    "lib"
    "man"
    "dev"
    "tools"
  ];

  patches = [
    # Fix test failure with musl libc.
    # https://patchwork.ozlabs.org/project/ovn/patch/20250912035054.50593-1-ihar.hrachyshka@gmail.com/
    ./0001-tests-Expect-musl-error-string-for-EIO-errno.patch
    (fetchpatch {
      url = "https://github.com/ovn-org/ovn/commit/d0b187905c45ce039163d18cc82869918946a41c.patch";
      hash = "sha256-mTpNpH1ZSSMLtpZmy6jKjGDu84jL0ECr+HVh1PQzaVA=";
    })
    # Fix sandbox test failure.
    # https://patchwork.ozlabs.org/project/ovn/patch/20250912035054.50593-2-ihar.hrachyshka@gmail.com/
    ./0002-tests-Use-localhost-when-setting-wrong-ovn-remote.patch
    (fetchpatch {
      url = "https://github.com/ovn-org/ovn/commit/b396babaa54ea0c8d943bbfef751dbdbf288c7af.patch";
      hash = "sha256-RjWxT3EYKjGhtvCq3bAhKN9PrPTkSR72xPkQQ4SPWWU=";
    })
  ];

  nativeBuildInputs = [
    autoreconfHook
    pkg-config
    python3
    makeWrapper
  ];

  buildInputs = [
@@ -83,23 +99,22 @@ stdenv.mkDerivation (finalAttrs: {
  ];

  postInstall = ''
    mkdir -vp $out/share/openvswitch/scripts
    mkdir -vp $out/etc/ovn
    cp ovs/ovsdb/ovsdb-client $out/bin
    cp ovs/ovsdb/ovsdb-server $out/bin
    cp ovs/ovsdb/ovsdb-tool $out/bin
    cp ovs/vswitchd/ovs-vswitchd $out/bin
    cp ovs/utilities/ovs-appctl $out/bin
    cp ovs/utilities/ovs-vsctl $out/bin
    cp ovs/utilities/ovs-ctl $out/share/openvswitch/scripts
    cp ovs/utilities/ovs-lib $out/share/openvswitch/scripts
    cp ovs/utilities/ovs-kmod-ctl $out/share/openvswitch/scripts
    cp ovs/vswitchd/vswitch.ovsschema $out/share/openvswitch
    sed -i "s#/usr/local/etc#/var/lib#g" $out/share/openvswitch/scripts/ovs-lib
    sed -i "s#/usr/local/bin#$out/bin#g" $out/share/openvswitch/scripts/ovs-lib
    sed -i "s#/usr/local/sbin#$out/bin#g" $out/share/openvswitch/scripts/ovs-lib
    sed -i "s#/usr/local/share#$out/share#g" $out/share/openvswitch/scripts/ovs-lib
    moveToOutput 'share/ovn/bugtool-plugins' "$tools"
    moveToOutput 'share/ovn/scripts/ovn-bugtool-*' "$tools"

    moveToOutput 'bin/ovn-detrace' "$tools"
    moveToOutput 'bin/ovn_detrace*' "$tools"
    moveToOutput 'bin/ovn-trace' "$tools"
    moveToOutput 'bin/ovn-debug' "$tools"
    moveToOutput 'bin/ovn-docker*' "$tools"

    sed -i '/chown -R $INSTALL_USER:$INSTALL_GROUP $ovn_etcdir/d' $out/share/ovn/scripts/ovn-ctl

    mkdir -vp $out/share/openvswitch/scripts
    ln -s ${openvswitch}/share/openvswitch/scripts/ovs-lib $out/share/openvswitch/scripts/ovs-lib

    wrapProgram $out/share/ovn/scripts/ovn-ctl \
      --prefix PATH : ${lib.makeBinPath [ openvswitch ]}
  '';

  env = {