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 f5ccc3485ba9..286a3d54caf5 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, @@ -15,19 +14,30 @@ unbound, xdp-tools, }: - -stdenv.mkDerivation rec { +let + withOpensslConfigureFlag = "--with-openssl=${lib.getLib openssl.dev}"; +in +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; }; + 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 @@ -49,7 +59,7 @@ stdenv.mkDerivation rec { 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 ''; @@ -61,15 +71,14 @@ stdenv.mkDerivation rec { "--sbindir=$(out)/bin" "--enable-ssl" ] - ++ lib.optional stdenv.hostPlatform.isStatic "--with-openssl=${lib.getLib openssl.dev}"; + ++ lib.optional stdenv.hostPlatform.isStatic withOpensslConfigureFlag; enableParallelBuilding = true; - # disable tests due to networking issues and because individual tests can't be skipped easily - doCheck = false; + doCheck = true; nativeCheckInputs = [ - gnused + openssl # used to generate certificates used for test services procps ]; @@ -93,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" @@ -106,15 +119,18 @@ 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 + booxter + ]; + platforms = lib.platforms.linux; }; -} +})