Skip to content

Commit

Permalink
Add SR-IOV support to nmcli module (#9168)
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
ianb-mp committed Nov 21, 2024
1 parent 1c10e3c commit 7db7604
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 23 deletions.
31 changes: 8 additions & 23 deletions plugins/modules/nmcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,30 +1064,30 @@
- 'An up-to-date list of supported attributes can be found here:
U(https://networkmanager.pages.freedesktop.org/NetworkManager/NetworkManager/settings-sriov.html).'
type: dict
version_added: 10.0.2
version_added: 10.0.0
suboptions:
autoprobe_drivers:
autoprobe-drivers:
description:
- Whether to autoprobe virtual functions by a compatible driver.
type: int
eswitch_encap_mode:
eswitch-encap-mode:
description:
- Select the eswitch encapsulation support.
type: int
eswitch_inline_mode:
eswitch-inline-mode:
description:
- Select the eswitch inline-mode of the device.
type: int
eswitch_mode:
eswitch-mode:
description:
- Select the eswitch mode of the device.
type: int
total_vfs:
total-vfs:
description: Number of virtual functions to create. Consult your NIC documentation for the maximum number of VFs supported.
type: int
vfs:
description:
- Virtual function descriptors in the form: "INDEX [ATTR=VALUE[ ATTR=VALUE]...]".
- 'Virtual function descriptors in the form: "INDEX [ATTR=VALUE[ ATTR=VALUE]...]".'
- Multiple VFs can be specified using a comma as separator e.g. "2 mac=00:11:22:33:44:55 spoof-check=true,3 vlan=100".
type: str
'''
Expand Down Expand Up @@ -1985,12 +1985,6 @@ def connection_options(self, detect_change=False):
'infiniband.transport-mode': self.transport_mode,
})

if self.sriov:
for name, value in self.sriov.items():
options.update({
'%s' % re.sub('_','-',name): value,
})

# Convert settings values based on the situation.
for setting, value in options.items():
setting_type = self.settings_type(setting)
Expand Down Expand Up @@ -2646,16 +2640,7 @@ def main():
wireguard=dict(type='dict'),
vpn=dict(type='dict'),
transport_mode=dict(type='str', choices=['datagram', 'connected']),
sriov=dict(type='list',
elements='dict',
options=dict(
autoprobe_drivers=dict(type='int'),
eswitch_encap_mode=dict(type='int'),
eswitch_inline_mode=dict(type='int'),
eswitch_mode=dict(type='int'),
total_vfs=dict(type='int'),
vfs=dict(type='str'),
)),
sriov=dict(type='dict'),
),
mutually_exclusive=[['never_default4', 'gw4'],
['routes4_extended', 'routes4'],
Expand Down
1 change: 1 addition & 0 deletions tests/unit/plugins/modules/test_nmcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4384,6 +4384,7 @@ def test_bond_connection_unchanged(mocked_generic_connection_diff_check, capfd):
wireguard=dict(type='dict'),
vpn=dict(type='dict'),
transport_mode=dict(type='str', choices=['datagram', 'connected']),
sriov=dict(type='dict'),
),
mutually_exclusive=[['never_default4', 'gw4'],
['routes4_extended', 'routes4'],
Expand Down

0 comments on commit 7db7604

Please sign in to comment.