Merge ~ogayot/ubuntu/+source/nvme-stas:2045690 into ubuntu/+source/nvme-stas:ubuntu/devel

Proposed by Olivier Gayot
Status: Merged
Merged at revision: e76aa337cc2b177cd6c0f42ead216abdbb4b9fc1
Proposed branch: ~ogayot/ubuntu/+source/nvme-stas:2045690
Merge into: ubuntu/+source/nvme-stas:ubuntu/devel
Diff against target: 134 lines (+106/-0)
4 files modified
debian/changelog (+7/-0)
debian/patches/fix-test-udev-with-dummy-interfaces.patch (+26/-0)
debian/patches/series (+2/-0)
debian/patches/skip-mac2iface-test-for-esoteric-interfaces.patch (+71/-0)
Reviewer Review Type Date Requested Status
Graham Inggs (community) Approve
git-ubuntu import Pending
Review via email: mp+456913@code.launchpad.net

Description of the change

Fixes autopkgtest on armhf where the runners are configured with esoteric types of network interfaces.

Patches were sent to Debian in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1057530 and upstream in https://github.com/linux-nvme/nvme-stas/pull/411

To post a comment you must log in.
Revision history for this message
Graham Inggs (ginggs) wrote :

Looks good to me, sponsoring

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index 1a95dbb..b6d470c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
1nvme-stas (2.3-1ubuntu3) noble; urgency=medium
2
3 * Skip mac2iface test for esoteric network interfaces (LP: #2045690)
4 * Add upstream patch to fix udev test for esoteric network interfaces
5
6 -- Olivier Gayot <olivier.gayot@canonical.com> Tue, 05 Dec 2023 21:04:32 +0100
7
1nvme-stas (2.3-1ubuntu2) noble; urgency=medium8nvme-stas (2.3-1ubuntu2) noble; urgency=medium
29
3 * Fix endianness issues in staslib.iputil causing hangs on s390x.10 * Fix endianness issues in staslib.iputil causing hangs on s390x.
diff --git a/debian/patches/fix-test-udev-with-dummy-interfaces.patch b/debian/patches/fix-test-udev-with-dummy-interfaces.patch
4new file mode 10064411new file mode 100644
index 0000000..55ec133
--- /dev/null
+++ b/debian/patches/fix-test-udev-with-dummy-interfaces.patch
@@ -0,0 +1,26 @@
1Description: Fix test-udev with dummy interfaces
2Author: Martin Belanger <martin.belanger@dell.com>
3Origin: upstream, https://github.com/linux-nvme/nvme-stas/commit/371c1e875a9a660adca241265e4cd460ee7e5e5c
4Bug: https://github.com/linux-nvme/nvme-stas/issues/407
5Last-Update: 2023-12-05
6---
7This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
8diff --git a/test/test-udev.py b/test/test-udev.py
9index ba484e0..9621edc 100755
10--- a/test/test-udev.py
11+++ b/test/test-udev.py
12@@ -295,6 +295,11 @@ class Test(unittest.TestCase):
13 def test__cid_matches_tid(self):
14 ifaces = iputil.net_if_addrs()
15 for ifname, addrs in self.ifaces.items():
16+ # <ifaces> contains a subset of the interfaces found in <self.ifaces>.
17+ # So, let's make sure that we only test with the interfaces found in both.
18+ if ifname not in ifaces:
19+ continue
20+
21 ##############################################
22 # IPV4
23
24--
252.40.1
26
diff --git a/debian/patches/series b/debian/patches/series
index 94de61d..77f0830 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,5 @@
1fix-test-libnvme-version.patch1fix-test-libnvme-version.patch
2fix-test-udev-failing-multiple-IPv6.patch2fix-test-udev-failing-multiple-IPv6.patch
3fix-iputil-endianness-issue.patch3fix-iputil-endianness-issue.patch
4skip-mac2iface-test-for-esoteric-interfaces.patch
5fix-test-udev-with-dummy-interfaces.patch
diff --git a/debian/patches/skip-mac2iface-test-for-esoteric-interfaces.patch b/debian/patches/skip-mac2iface-test-for-esoteric-interfaces.patch
4new file mode 1006446new file mode 100644
index 0000000..589b969
--- /dev/null
+++ b/debian/patches/skip-mac2iface-test-for-esoteric-interfaces.patch
@@ -0,0 +1,71 @@
1Description: Skip mac2iface test for esoteric interfaces
2 mac2iface takes a MAC address as argument and returns the corresponding
3 interface (if any).
4 The mac2iface tests will however invoke mac2iface with invalid MAC addresses
5 when esoteric network interfaces are present on the system. As an example,
6 armhf autopkgtest runners in Ubuntu have gre interfaces configured so the
7 test-suite fails.
8 .
9 We now ensure that the test-suite calls mac2iface with only valid MAC
10 addresses.
11 .
12 Furthermore, sometimes the same MAC address is assigned to more than one
13 interface on the system (this is true for VLAN interfaces for instance). This
14 confuses mac2iface, which returns only the first match. This scenario is
15 possibly more of a nvme-stas bug than a test-suite bug, but for now we will
16 just skip the interfaces that have a duplicate MAC address.
17Author: Olivier Gayot <olivier.gayot@canonical.com>
18Bug-Ubuntu: https://launchpad.net/bugs/2045690
19Bug-Debian: https://bugs.debian.org/1057530
20Forwarded: https://github.com/linux-nvme/nvme-stas/pull/411
21Last-Update: 2023-12-05
22---
23This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
24--- a/test/test-iputil.py
25+++ b/test/test-iputil.py
26@@ -43,11 +43,41 @@
27 self.assertEqual('', iputil.get_interface(ifaces, ''))
28 self.assertEqual('', iputil.get_interface(ifaces, None))
29
30+ @staticmethod
31+ def _is_ok_for_mac2iface(iface) -> bool:
32+ ''' mac2iface can only work with interfaces that have a proper MAC
33+ address. One can use this function to filter out other interfaces
34+ configured on the system. '''
35+ if iface['link_type'] != 'ether':
36+ # Some esoteric interface types (e.g., gre) use the address
37+ # field to store something that is not a MAC address. Skip
38+ # them.
39+ return False
40+ if 'address' not in iface:
41+ return False
42+ if iface['address'] == '00:00:00:00:00:00':
43+ # All 0's is an invalid MAC address so do not bother.
44+ # In practice, it often appears as the address of the loopback
45+ # interface but it can also appear for other things like a gretap
46+ # or erspan interface.
47+ return False
48+ return True
49+
50 def test_mac2iface(self):
51- for iface in self.ifaces:
52- address = iface.get('address', None)
53- if address:
54- self.assertEqual(iface['ifname'], iputil.mac2iface(address))
55+ # We only test the interfaces that have a MAC address, and a valid one.
56+ candidate_ifaces = [iface for iface in self.ifaces if self._is_ok_for_mac2iface(iface)]
57+
58+ for iface in candidate_ifaces:
59+ if len([x for x in candidate_ifaces if x['address'] == iface['address']]) >= 2:
60+ # We need to be careful, sometimes we can have the same MAC address
61+ # on multiple interfaces. This happens with VLAN interfaces for
62+ # instance. mac2iface will obviously be confused when dealing with
63+ # those so let's skip the interfaces that have duplicate MAC.
64+ logging.warning('[%s] is not the only interface with address [%s]',
65+ iface['ifname'], iface['address'])
66+ continue
67+
68+ self.assertEqual(iface['ifname'], iputil.mac2iface(iface['address']))
69
70 def test_remove_invalid_addresses(self):
71 good_tcp = trid.TID({'transport': 'tcp', 'traddr': '1.1.1.1', 'subsysnqn': '', 'trsvcid': '8009'})

Subscribers

People subscribed via source and target branches