From 2bc7f0fd88f4f518159e53639ec1c6b48abcaebe Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Thu, 11 Sep 2025 20:30:05 -0400 Subject: [PATCH 1/9] ovn: enable tests --- pkgs/by-name/ov/ovn/package.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/by-name/ov/ovn/package.nix b/pkgs/by-name/ov/ovn/package.nix index f5ccc3485ba9..effc66eb89cf 100644 --- a/pkgs/by-name/ov/ovn/package.nix +++ b/pkgs/by-name/ov/ovn/package.nix @@ -65,8 +65,7 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - # disable tests due to networking issues and because individual tests can't be skipped easily - doCheck = false; + doCheck = true; nativeCheckInputs = [ gnused From adff8f0a20256509e943ab60e8f2c3f02ab98c2c Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Thu, 11 Sep 2025 22:24:24 -0400 Subject: [PATCH 2/9] ovn: fix test failure due to network sandbox --- pkgs/by-name/ov/ovn/package.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/by-name/ov/ovn/package.nix b/pkgs/by-name/ov/ovn/package.nix index effc66eb89cf..8624371c1ea1 100644 --- a/pkgs/by-name/ov/ovn/package.nix +++ b/pkgs/by-name/ov/ovn/package.nix @@ -45,6 +45,16 @@ stdenv.mkDerivation rec { xdp-tools ]; + postPatch = '' + # One test assumes that the test environment has a network route to + # 192.168.0.10 and fails in sandbox. Replace it with localhost. + # + # The test case checks behavior when the configured ovn-remote is down, so + # we can pick any "free" port here. + substituteInPlace tests/ovn-controller.at \ + --replace-fail 192.168.0.10:6642 127.0.0.1:9999 + ''; + # need to build the ovs submodule first preConfigure = '' pushd ovs From 468cd45f7254f4f046e35228cffae677d818bf82 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Thu, 11 Sep 2025 20:45:05 -0400 Subject: [PATCH 3/9] ovn: skip unstable tests --- pkgs/by-name/ov/ovn/package.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/by-name/ov/ovn/package.nix b/pkgs/by-name/ov/ovn/package.nix index 8624371c1ea1..bf08bb388996 100644 --- a/pkgs/by-name/ov/ovn/package.nix +++ b/pkgs/by-name/ov/ovn/package.nix @@ -102,6 +102,10 @@ stdenv.mkDerivation rec { sed -i '/chown -R $INSTALL_USER:$INSTALL_GROUP $ovn_etcdir/d' $out/share/ovn/scripts/ovn-ctl ''; + env = { + SKIP_UNSTABLE = "yes"; + }; + # https://docs.ovn.org/en/latest/topics/testing.html preCheck = '' export TESTSUITEFLAGS="-j$NIX_BUILD_CORES" From 3fdb462a11c7a34f885ef7081898f4e31a1d9fd9 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Thu, 11 Sep 2025 20:31:44 -0400 Subject: [PATCH 4/9] ovn: remove explicit gnused check dependency It's part of stdenv. --- pkgs/by-name/ov/ovn/package.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/by-name/ov/ovn/package.nix b/pkgs/by-name/ov/ovn/package.nix index bf08bb388996..f75291ab4fe0 100644 --- a/pkgs/by-name/ov/ovn/package.nix +++ b/pkgs/by-name/ov/ovn/package.nix @@ -3,7 +3,6 @@ stdenv, fetchFromGitHub, autoreconfHook, - gnused, libbpf, libcap_ng, nix-update-script, @@ -78,7 +77,6 @@ stdenv.mkDerivation rec { doCheck = true; nativeCheckInputs = [ - gnused procps ]; From fe8004aed59cc42a332b7bad3dfa72127cbd395e Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Thu, 11 Sep 2025 20:35:08 -0400 Subject: [PATCH 5/9] ovn: modernize --- pkgs/by-name/ov/ovn/package.nix | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/ov/ovn/package.nix b/pkgs/by-name/ov/ovn/package.nix index f75291ab4fe0..4c7cec045fc0 100644 --- a/pkgs/by-name/ov/ovn/package.nix +++ b/pkgs/by-name/ov/ovn/package.nix @@ -15,14 +15,14 @@ xdp-tools, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "ovn"; version = "25.09.0"; src = fetchFromGitHub { owner = "ovn-org"; repo = "ovn"; - tag = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-DNaf3vWb6tlzViMEI02+3st/0AiMVAomSaiGplcjkIc="; fetchSubmodules = true; }; @@ -117,15 +117,15 @@ stdenv.mkDerivation rec { passthru.updateScript = nix-update-script { }; - meta = with lib; { + meta = { description = "Open Virtual Network"; longDescription = '' OVN (Open Virtual Network) is a series of daemons that translates virtual network configuration into OpenFlow, and installs them into Open vSwitch. ''; - homepage = "https://github.com/ovn-org/ovn"; - changelog = "https://github.com/ovn-org/ovn/blob/${src.rev}/NEWS"; - license = licenses.asl20; - maintainers = with maintainers; [ adamcstephens ]; - platforms = platforms.linux; + homepage = "https://www.ovn.org"; + changelog = "https://github.com/ovn-org/ovn/blob/refs/tags/${finalAttrs.src.tag}/NEWS"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ adamcstephens ]; + platforms = lib.platforms.linux; }; -} +}) From 05fa15c83afb82a7115c07ffc9918b84c746f098 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Thu, 11 Sep 2025 20:35:38 -0400 Subject: [PATCH 6/9] ovn: add booxter as maintainer I'm interested in maintaining the package, and I'm a long time contributor to the upstream project and know how to deal with build system, test suite etc. --- pkgs/by-name/ov/ovn/package.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/ov/ovn/package.nix b/pkgs/by-name/ov/ovn/package.nix index 4c7cec045fc0..f73fccecb873 100644 --- a/pkgs/by-name/ov/ovn/package.nix +++ b/pkgs/by-name/ov/ovn/package.nix @@ -125,7 +125,10 @@ stdenv.mkDerivation (finalAttrs: { homepage = "https://www.ovn.org"; changelog = "https://github.com/ovn-org/ovn/blob/refs/tags/${finalAttrs.src.tag}/NEWS"; license = lib.licenses.asl20; - maintainers = with lib.maintainers; [ adamcstephens ]; + maintainers = with lib.maintainers; [ + adamcstephens + booxter + ]; platforms = lib.platforms.linux; }; }) From 18f2b735d37f70f56b8d5e34afcd9c00776b9379 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Thu, 11 Sep 2025 23:01:25 -0400 Subject: [PATCH 7/9] pkgsStatic.ovn: add openssl to check deps openssl is used to generate certificates for test services. --- pkgs/by-name/ov/ovn/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/by-name/ov/ovn/package.nix b/pkgs/by-name/ov/ovn/package.nix index f73fccecb873..867fb1a5ae04 100644 --- a/pkgs/by-name/ov/ovn/package.nix +++ b/pkgs/by-name/ov/ovn/package.nix @@ -77,6 +77,7 @@ stdenv.mkDerivation (finalAttrs: { doCheck = true; nativeCheckInputs = [ + openssl # used to generate certificates used for test services procps ]; From 22d8b2d665cecee1a45f250d239e164888ae7663 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Fri, 12 Sep 2025 03:21:49 +0000 Subject: [PATCH 8/9] pkgsStatic.ovn: build ovs lib with ssl support Before the patch, ovs lib was built without ssl support. It became apparent once we enabled tests - which now fail due to lack of ssl support in ovs services. --- pkgs/by-name/ov/ovn/package.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/ov/ovn/package.nix b/pkgs/by-name/ov/ovn/package.nix index 867fb1a5ae04..ab38619a3ba9 100644 --- a/pkgs/by-name/ov/ovn/package.nix +++ b/pkgs/by-name/ov/ovn/package.nix @@ -14,7 +14,9 @@ unbound, xdp-tools, }: - +let + withOpensslConfigureFlag = "--with-openssl=${lib.getLib openssl.dev}"; +in stdenv.mkDerivation (finalAttrs: { pname = "ovn"; version = "25.09.0"; @@ -58,7 +60,7 @@ stdenv.mkDerivation (finalAttrs: { preConfigure = '' pushd ovs ./boot.sh - ./configure --with-dbdir=/var/lib/openvswitch + ./configure --with-dbdir=/var/lib/openvswitch ${lib.optionalString stdenv.hostPlatform.isStatic withOpensslConfigureFlag} make -j $NIX_BUILD_CORES popd ''; @@ -70,7 +72,7 @@ stdenv.mkDerivation (finalAttrs: { "--sbindir=$(out)/bin" "--enable-ssl" ] - ++ lib.optional stdenv.hostPlatform.isStatic "--with-openssl=${lib.getLib openssl.dev}"; + ++ lib.optional stdenv.hostPlatform.isStatic withOpensslConfigureFlag; enableParallelBuilding = true; From c87bf086885c14f53736469fb65d1a69954abbdc Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Thu, 11 Sep 2025 23:57:27 -0400 Subject: [PATCH 9/9] pkgsStatic.ovn: fix test failure; replace postPatch with a real patch --- ...pect-musl-error-string-for-EIO-errno.patch | 31 ++++++++++++++++ ...alhost-when-setting-wrong-ovn-remote.patch | 37 +++++++++++++++++++ pkgs/by-name/ov/ovn/package.nix | 19 +++++----- 3 files changed, 77 insertions(+), 10 deletions(-) create mode 100644 pkgs/by-name/ov/ovn/0001-tests-Expect-musl-error-string-for-EIO-errno.patch create mode 100644 pkgs/by-name/ov/ovn/0002-tests-Use-localhost-when-setting-wrong-ovn-remote.patch diff --git a/pkgs/by-name/ov/ovn/0001-tests-Expect-musl-error-string-for-EIO-errno.patch b/pkgs/by-name/ov/ovn/0001-tests-Expect-musl-error-string-for-EIO-errno.patch new file mode 100644 index 000000000000..174421236802 --- /dev/null +++ b/pkgs/by-name/ov/ovn/0001-tests-Expect-musl-error-string-for-EIO-errno.patch @@ -0,0 +1,31 @@ +From d4ead86b2184d1fc2748ed2b6fae8c0dceaf76c8 Mon Sep 17 00:00:00 2001 +From: Ihar Hrachyshka +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 +--- + 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 + diff --git a/pkgs/by-name/ov/ovn/0002-tests-Use-localhost-when-setting-wrong-ovn-remote.patch b/pkgs/by-name/ov/ovn/0002-tests-Use-localhost-when-setting-wrong-ovn-remote.patch new file mode 100644 index 000000000000..11efc948e361 --- /dev/null +++ b/pkgs/by-name/ov/ovn/0002-tests-Use-localhost-when-setting-wrong-ovn-remote.patch @@ -0,0 +1,37 @@ +From 44d9d58461e15314edf507d0379bff991d7e9964 Mon Sep 17 00:00:00 2001 +From: Ihar Hrachyshka +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 +--- + 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 + diff --git a/pkgs/by-name/ov/ovn/package.nix b/pkgs/by-name/ov/ovn/package.nix index ab38619a3ba9..286a3d54caf5 100644 --- a/pkgs/by-name/ov/ovn/package.nix +++ b/pkgs/by-name/ov/ovn/package.nix @@ -29,6 +29,15 @@ stdenv.mkDerivation (finalAttrs: { fetchSubmodules = true; }; + 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 + # 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 + ]; + nativeBuildInputs = [ autoreconfHook pkg-config @@ -46,16 +55,6 @@ stdenv.mkDerivation (finalAttrs: { xdp-tools ]; - postPatch = '' - # One test assumes that the test environment has a network route to - # 192.168.0.10 and fails in sandbox. Replace it with localhost. - # - # The test case checks behavior when the configured ovn-remote is down, so - # we can pick any "free" port here. - substituteInPlace tests/ovn-controller.at \ - --replace-fail 192.168.0.10:6642 127.0.0.1:9999 - ''; - # need to build the ovs submodule first preConfigure = '' pushd ovs