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

Subscribers

People subscribed via source and target branches