From 7dc1fa9ccf00ce83cf241525285b2413a15defd9 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 12 Jan 2024 15:05:13 -0500 Subject: [PATCH 01/13] tests/main-testflinger: enable gpu-{container,mig} tests Signed-off-by: Simon Deziel --- tests/main-testflinger | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/main-testflinger b/tests/main-testflinger index d58e7f001..400a6f516 100755 --- a/tests/main-testflinger +++ b/tests/main-testflinger @@ -50,11 +50,10 @@ run_test jammy default tests/devlxd-vm "${lxd_snap_channel}" #run_test jammy default tests/docker "${lxd_snap_channel}" # gpu -# XXX: requires nvidia graphic card to be present in the host and to -# know which PCI address it has -#run_test jammy default tests/gpu-container "${lxd_snap_channel}" +# XXX: requires nvidia graphic card to be present in the host +run_test jammy default tests/gpu-container "${lxd_snap_channel}" # XXX: requires a specific nvidia graphic card to be present in the host -#run_test jammy default tests/gpu-mig "${lxd_snap_channel}" +run_test jammy default tests/gpu-mig "${lxd_snap_channel}" # XXX: requires nvidia graphic card to be present in the host and a # compatible driver to be installed #run_test jammy default tests/gpu-vm "${lxd_snap_channel}" nvidia From fa92a75d88bafb55c18100af7e8ece00bafaabc3 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 12 Jan 2024 15:02:30 -0500 Subject: [PATCH 02/13] tests/network-sriov: set -x Signed-off-by: Simon Deziel --- tests/network-sriov | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/network-sriov b/tests/network-sriov index 1bb9f4ddf..ede037871 100755 --- a/tests/network-sriov +++ b/tests/network-sriov @@ -1,5 +1,5 @@ #!/bin/sh -set -eu +set -eux # Install LXD install_lxd From 93702bb91893cfb0c689cd7293f0886b4f8dc519 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 12 Jan 2024 15:03:20 -0500 Subject: [PATCH 03/13] tests/network-sriov: testflinger's luma has SR-IOV capable NICs Signed-off-by: Simon Deziel --- tests/network-sriov | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/network-sriov b/tests/network-sriov index ede037871..41c6c4c94 100755 --- a/tests/network-sriov +++ b/tests/network-sriov @@ -1,6 +1,8 @@ #!/bin/sh set -eux +# testflinger_queue: luma + # Install LXD install_lxd From fb8ad6ef46897b09cf9516a24884a51b3960989c Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 12 Jan 2024 15:04:11 -0500 Subject: [PATCH 04/13] tests/network-sriov: jq is required Signed-off-by: Simon Deziel --- tests/network-sriov | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/network-sriov b/tests/network-sriov index 41c6c4c94..8e1daec69 100755 --- a/tests/network-sriov +++ b/tests/network-sriov @@ -6,6 +6,9 @@ set -eux # Install LXD install_lxd +# Install dependencies +install_deps jq + parentNIC="${1}" # Enable SR-IOV on nic and bring up From 0d475de6411821a65cf980f5c77af559d51e49d4 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 12 Jan 2024 16:36:13 -0500 Subject: [PATCH 05/13] tests/network-sriov: use the first SR-IOV NIC if no parent NIC is provided Signed-off-by: Simon Deziel --- tests/network-sriov | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/network-sriov b/tests/network-sriov index 8e1daec69..713374255 100755 --- a/tests/network-sriov +++ b/tests/network-sriov @@ -9,7 +9,13 @@ install_lxd # Install dependencies install_deps jq -parentNIC="${1}" +parentNIC="${1:-}" + +if [ -z "${parentNIC}" ]; then + # Consult available resources + first_sriov_nic="$(lxc query /1.0/resources | jq -r '[.network.cards | .[] | select(.sriov != null) | .ports][0] | .[0].id')" + parentNIC="${first_sriov_nic}" +fi # Enable SR-IOV on nic and bring up enableNICSRIOV "${parentNIC}" From 068acddc3e7a2e88e8e18bc0c0e19a5c194fa69e Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 12 Jan 2024 17:20:32 -0500 Subject: [PATCH 06/13] tests/network-sriov: error out if system not IOMMU ready Signed-off-by: Simon Deziel --- tests/network-sriov | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/network-sriov b/tests/network-sriov index 713374255..8c1d97feb 100755 --- a/tests/network-sriov +++ b/tests/network-sriov @@ -3,6 +3,12 @@ set -eux # testflinger_queue: luma +# Check if IOMMU is configured +if [ -n "$(find /sys/kernel/iommu_groups/ -empty)" ]; then + echo "System not IOMMU ready, hint: \"./bin/custom-kernel iommu\"" >&2 + exit 1 +fi + # Install LXD install_lxd From 4e31d356b9383eba80a72187b519c5676123d4e7 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 12 Jan 2024 17:46:45 -0500 Subject: [PATCH 07/13] tests/network-sriov: replace sleep by waitInstanceReady() Signed-off-by: Simon Deziel --- tests/network-sriov | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/network-sriov b/tests/network-sriov index 8c1d97feb..2af2b0030 100755 --- a/tests/network-sriov +++ b/tests/network-sriov @@ -145,7 +145,10 @@ lxc config device override c4 eth0 vlan=4000 security.mac_filtering=true lxc start c4 # Wait for containers to start. -sleep 30s +waitInstanceReady c1 +waitInstanceReady c2 +waitInstanceReady c3 +waitInstanceReady c4 lxc list networkTests From 73f632e53c6be40b3257b77d0462524b3ae84548 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 12 Jan 2024 17:22:14 -0500 Subject: [PATCH 08/13] tests/network-sriov: test DNS with archive.ubuntu.com Signed-off-by: Simon Deziel --- tests/network-sriov | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/network-sriov b/tests/network-sriov index 2af2b0030..1a5221128 100755 --- a/tests/network-sriov +++ b/tests/network-sriov @@ -70,7 +70,7 @@ networkTests() { fi # DNS resolution - if lxc exec "${name}" -- getent hosts linuxcontainers.org >/dev/null 2>&1 || lxc exec "${name}" -- ping -c1 -W1 linuxcontainers.org >/dev/null 2>&1; then + if lxc exec "${name}" -- getent hosts archive.ubuntu.com >/dev/null 2>&1; then echo "PASS: DNS resolution: ${name}" else echo "FAIL: DNS resolution: ${name}" From 17fd007ddeba89c34c240b093911b9cc3301f15d Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 12 Jan 2024 17:23:17 -0500 Subject: [PATCH 09/13] tests/network-sriov: add TCP connectivity test to archive.ubuntu.com:80 Signed-off-by: Simon Deziel --- tests/network-sriov | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/network-sriov b/tests/network-sriov index 1a5221128..0f9c99713 100755 --- a/tests/network-sriov +++ b/tests/network-sriov @@ -76,6 +76,14 @@ networkTests() { echo "FAIL: DNS resolution: ${name}" FAIL=1 fi + + # TCP connectivity + if lxc exec "${name}" -- nc -zv archive.ubuntu.com 80 >/dev/null 2>&1; then + echo "PASS: TCP connectivity: ${name}" + else + echo "FAIL: TCP connectivity: ${name}" + FAIL=1 + fi done if [ "${FAIL}" = "1" ]; then From 80a01d2a149f859b3a0af19341dce3541788a7f1 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 12 Jan 2024 17:32:47 -0500 Subject: [PATCH 10/13] tests/network-sriov: make IPv6 test warn instead of fail Signed-off-by: Simon Deziel --- tests/network-sriov | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/network-sriov b/tests/network-sriov index 0f9c99713..b7018c396 100755 --- a/tests/network-sriov +++ b/tests/network-sriov @@ -65,8 +65,8 @@ networkTests() { if echo "${address}" | grep ":" -q; then echo "PASS: IPv6 address: ${name}" else - echo "FAIL: IPv6 address: ${name}" - FAIL=1 + echo "WARN: IPv6 address: ${name}" + #FAIL=1 fi # DNS resolution From b47176af91a7dc3b357ce07159cbdfbfaf539e07 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 12 Jan 2024 17:33:05 -0500 Subject: [PATCH 11/13] tests/network-sriov: simplify grep Signed-off-by: Simon Deziel --- tests/network-sriov | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/network-sriov b/tests/network-sriov index b7018c396..427d79647 100755 --- a/tests/network-sriov +++ b/tests/network-sriov @@ -54,7 +54,7 @@ networkTests() { fi # IPv4 address - if echo "${address}" | grep "\." -q; then + if echo "${address}" | grep -qF "."; then echo "PASS: IPv4 address: ${name}" else echo "FAIL: IPv4 address: ${name}" @@ -62,7 +62,7 @@ networkTests() { fi # IPv6 address - if echo "${address}" | grep ":" -q; then + if echo "${address}" | grep -qF ":"; then echo "PASS: IPv6 address: ${name}" else echo "WARN: IPv6 address: ${name}" From 9b191099d5901a595ecd4e2e8bc288592c3e5e22 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 12 Jan 2024 17:37:12 -0500 Subject: [PATCH 12/13] tests/network-sriov: use 24.04 for VMs Signed-off-by: Simon Deziel --- tests/network-sriov | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/network-sriov b/tests/network-sriov index 427d79647..09c9ca485 100755 --- a/tests/network-sriov +++ b/tests/network-sriov @@ -101,21 +101,21 @@ lxc profile device add default eth0 nic nictype=sriov parent="${parentNIC}" name # Launch a few VMs. # Do this first before containers to ensure VF free search handles VFs unbound from host. echo "==> VM on default VLAN" -lxc init ubuntu-daily:23.10 v1 --vm +lxc init ubuntu-daily:24.04 v1 --vm lxc start v1 echo "==> VM on default VLAN with filtering" -lxc init ubuntu-daily:23.10 v2 --vm +lxc init ubuntu-daily:24.04 v2 --vm lxc config device override v2 eth0 security.mac_filtering=true lxc start v2 echo "==> VM on alternate VLAN" -lxc init ubuntu-daily:23.10 v3 --vm +lxc init ubuntu-daily:24.04 v3 --vm lxc config device override v3 eth0 vlan=4000 lxc start v3 echo "==> VM on alternate VLAN with filtering" -lxc init ubuntu-daily:23.10 v4 --vm +lxc init ubuntu-daily:24.04 v4 --vm lxc config device override v4 eth0 vlan=4000 security.mac_filtering=true lxc start v4 From f0465e3dcd062e5937195a2d34af6c2b78af1d03 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 12 Jan 2024 17:24:42 -0500 Subject: [PATCH 13/13] tests/main-testflinger: enable network-sriov test Signed-off-by: Simon Deziel --- tests/main-testflinger | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/main-testflinger b/tests/main-testflinger index 400a6f516..ab5ca2862 100755 --- a/tests/main-testflinger +++ b/tests/main-testflinger @@ -71,7 +71,7 @@ run_test jammy hwe tests/network-bridge-firewall "${lxd_snap_channel}" run_test jammy default tests/network-ovn "${lxd_snap_channel}" run_test jammy default tests/network-routed "${lxd_snap_channel}" # XXX: requires SR-IOV capable NIC -#run_test jammy default tests/network-sriov "${lxd_snap_channel}" +run_test jammy default tests/network-sriov "${lxd_snap_channel}" # pylxd run_test jammy default tests/pylxd "${lxd_snap_channel}"