nmcli: add transport_mode configuration for Infiniband devices (#5361)

* Adds transport_mode configuration for Infiniband devices

Adds transport_mode configuration for Infiniband based ipoib devices,
which is one of:
  - datagram (default)
  - connected

* Remove trailing whitespace

* Add changelog fragment

* Update changelogs/fragments/5361-nmcli-add-infiniband-transport-mode.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/net_tools/nmcli.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/net_tools/nmcli.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Remove default for transport_mode

* Add test for changing Infiniband transport_mode

* remove blank line at end of file

Co-authored-by: Thomas Gebert <thomas.gebert@atos.net>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
ThomasGebert 2022-10-23 11:30:48 +02:00 committed by GitHub
parent 8072d11d06
commit b54483b52e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 129 additions and 0 deletions

View file

@ -67,6 +67,12 @@ options:
type: str
choices: [ 802.3ad, active-backup, balance-alb, balance-rr, balance-tlb, balance-xor, broadcast ]
default: balance-rr
transport_mode:
description:
- This option sets the connection type of Infiniband IPoIB devices.
type: str
choices: [ datagram, connected ]
version_added: 5.8.0
master:
description:
- Master <master (ifname, or connection UUID or conn_name) of bridge, team, bond master connection profile.
@ -1481,6 +1487,7 @@ class Nmcli(object):
self.gsm = module.params['gsm']
self.wireguard = module.params['wireguard']
self.vpn = module.params['vpn']
self.transport_mode = module.params['transport_mode']
if self.method4:
self.ipv4_method = self.method4
@ -1693,6 +1700,11 @@ class Nmcli(object):
options.update({
'vpn.data': vpn_data_values,
})
elif self.type == 'infiniband':
options.update({
'infiniband.transport-mode': self.transport_mode,
})
# Convert settings values based on the situation.
for setting, value in options.items():
setting_type = self.settings_type(setting)
@ -2285,6 +2297,7 @@ def main():
gsm=dict(type='dict'),
wireguard=dict(type='dict'),
vpn=dict(type='dict'),
transport_mode=dict(type='str', choices=['datagram', 'connected']),
),
mutually_exclusive=[['never_default4', 'gw4'],
['routes4_extended', 'routes4'],