mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-22 22:03:43 +03:00
test-network: also set custom altternative name for netdevsim interface
Due to the bug in kernel 6.9 caused by
8debcf5832
,
the net_id udev builtin does not work for netdevsim interface.
So, eni99np1 cannot be used with kernel 6.9 anymore.
Workaround for #32910.
(cherry picked from commit f1f1be71feacb3b5d2fb89e2f6421c23b9320fbd)
(cherry picked from commit 221b2783ba305f4e7c7c8ea8b32cbd2106499c65)
(cherry picked from commit 64719b545fe1a199cdec8cf890d7d6f46883da6c)
This commit is contained in:
parent
284aaa075f
commit
5e30bb38d0
11
test/test-network/conf/25-netdevsim.link
Normal file
11
test/test-network/conf/25-netdevsim.link
Normal file
@ -0,0 +1,11 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
[Match]
|
||||
Driver=netdevsim
|
||||
|
||||
[Link]
|
||||
NamePolicy=keep kernel database onboard slot path
|
||||
AlternativeNamesPolicy=database onboard slot path mac
|
||||
# Also set a fixed name. Workaround for bug in kernel 6.9:
|
||||
# https://github.com/torvalds/linux/commit/8debcf5832c3e8a6baaea27c75ad8a6ba5077beb
|
||||
AlternativeName=sim99
|
||||
MACAddressPolicy=persistent
|
@ -1,6 +1,6 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
[Match]
|
||||
Name=eni99np1
|
||||
Name=sim99
|
||||
|
||||
[Network]
|
||||
Address=192.168.100.100/24
|
||||
|
@ -5,6 +5,9 @@ Driver=netdevsim
|
||||
[Link]
|
||||
NamePolicy=keep kernel database onboard slot path
|
||||
AlternativeNamesPolicy=database onboard slot path mac
|
||||
# Also set a fixed name. Workaround for bug in kernel 6.9:
|
||||
# https://github.com/torvalds/linux/commit/8debcf5832c3e8a6baaea27c75ad8a6ba5077beb
|
||||
AlternativeName=sim99
|
||||
MACAddressPolicy=persistent
|
||||
|
||||
[SR-IOV]
|
||||
|
@ -1,6 +1,6 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
[Match]
|
||||
Name=eni99np1
|
||||
Name=sim99
|
||||
|
||||
[Network]
|
||||
Address=192.168.100.100/24
|
||||
|
@ -429,7 +429,7 @@ def link_exists(link):
|
||||
return call_quiet(f'ip link show {link}') == 0
|
||||
|
||||
def link_resolve(link):
|
||||
return check_output(f'ip link show {link}').split(':')[1].strip()
|
||||
return check_output(f'ip link show {link}').split(':')[1].strip().split('@')[0]
|
||||
|
||||
def remove_link(*links, protect=False):
|
||||
for link in links:
|
||||
@ -4341,14 +4341,14 @@ class NetworkdSRIOVTests(unittest.TestCase, Utilities):
|
||||
|
||||
@expectedFailureIfNetdevsimWithSRIOVIsNotAvailable()
|
||||
def test_sriov(self):
|
||||
copy_network_unit('25-default.link', '25-sriov.network')
|
||||
copy_network_unit('25-netdevsim.link', '25-sriov.network')
|
||||
|
||||
self.setup_netdevsim(num_vfs=3)
|
||||
|
||||
start_networkd()
|
||||
self.wait_online(['eni99np1:routable'])
|
||||
self.wait_online(['sim99:routable'])
|
||||
|
||||
output = check_output('ip link show dev eni99np1')
|
||||
output = check_output('ip link show dev sim99')
|
||||
print(output)
|
||||
self.assertRegex(output,
|
||||
'vf 0 .*00:11:22:33:44:55.*vlan 5, qos 1, vlan protocol 802.1ad, spoof checking on, link-state enable, trust on, query_rss on\n *'
|
||||
@ -4363,12 +4363,12 @@ class NetworkdSRIOVTests(unittest.TestCase, Utilities):
|
||||
self.setup_netdevsim()
|
||||
|
||||
start_networkd()
|
||||
self.wait_online(['eni99np1:routable'])
|
||||
self.wait_online(['sim99:routable'])
|
||||
|
||||
# the name eni99np1 may be an alternative name.
|
||||
ifname = link_resolve('eni99np1')
|
||||
# The name sim99 is an alternative name, and cannot be used by udevadm below.
|
||||
ifname = link_resolve('sim99')
|
||||
|
||||
output = check_output('ip link show dev eni99np1')
|
||||
output = check_output('ip link show dev sim99')
|
||||
print(output)
|
||||
self.assertRegex(output,
|
||||
'vf 0 .*00:11:22:33:44:55.*vlan 5, qos 1, vlan protocol 802.1ad, spoof checking on, link-state enable, trust on, query_rss on\n *'
|
||||
@ -4384,7 +4384,7 @@ class NetworkdSRIOVTests(unittest.TestCase, Utilities):
|
||||
udev_reload()
|
||||
check_output(*udevadm_cmd, 'trigger', '--action=add', '--settle', f'/sys/devices/netdevsim99/net/{ifname}')
|
||||
|
||||
output = check_output('ip link show dev eni99np1')
|
||||
output = check_output('ip link show dev sim99')
|
||||
print(output)
|
||||
self.assertRegex(output,
|
||||
'vf 0 .*00:11:22:33:44:55.*vlan 5, qos 1, vlan protocol 802.1ad, spoof checking on, link-state enable, trust on, query_rss on\n *'
|
||||
@ -4400,7 +4400,7 @@ class NetworkdSRIOVTests(unittest.TestCase, Utilities):
|
||||
udev_reload()
|
||||
check_output(*udevadm_cmd, 'trigger', '--action=add', '--settle', f'/sys/devices/netdevsim99/net/{ifname}')
|
||||
|
||||
output = check_output('ip link show dev eni99np1')
|
||||
output = check_output('ip link show dev sim99')
|
||||
print(output)
|
||||
self.assertRegex(output,
|
||||
'vf 0 .*00:11:22:33:44:55.*vlan 5, qos 1, vlan protocol 802.1ad, spoof checking on, link-state enable, trust on, query_rss on\n *'
|
||||
@ -4416,7 +4416,7 @@ class NetworkdSRIOVTests(unittest.TestCase, Utilities):
|
||||
udev_reload()
|
||||
check_output(*udevadm_cmd, 'trigger', '--action=add', '--settle', f'/sys/devices/netdevsim99/net/{ifname}')
|
||||
|
||||
output = check_output('ip link show dev eni99np1')
|
||||
output = check_output('ip link show dev sim99')
|
||||
print(output)
|
||||
self.assertRegex(output,
|
||||
'vf 0 .*00:11:22:33:44:55.*vlan 5, qos 1, vlan protocol 802.1ad, spoof checking on, link-state enable, trust on, query_rss on\n *'
|
||||
@ -4432,7 +4432,7 @@ class NetworkdSRIOVTests(unittest.TestCase, Utilities):
|
||||
udev_reload()
|
||||
check_output(*udevadm_cmd, 'trigger', '--action=add', '--settle', f'/sys/devices/netdevsim99/net/{ifname}')
|
||||
|
||||
output = check_output('ip link show dev eni99np1')
|
||||
output = check_output('ip link show dev sim99')
|
||||
print(output)
|
||||
self.assertRegex(output,
|
||||
'vf 0 .*00:11:22:33:44:55.*vlan 5, qos 1, vlan protocol 802.1ad, spoof checking on, link-state enable, trust on, query_rss on\n *'
|
||||
|
Loading…
x
Reference in New Issue
Block a user