Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2128545

Summary: os-net-config should configure ethtool_opts for SRIOV-VF
Product: Red Hat OpenStack Reporter: Keigo Noha <knoha>
Component: os-net-configAssignee: Karthik Sundaravel <ksundara>
Status: CLOSED ERRATA QA Contact: Eran Kuris <ekuris>
Severity: medium Docs Contact:
Priority: medium    
Version: 16.1 (Train)CC: bfournie, cfontain, gurpsing, hakhande, hbrock, jslagle, ksundara, mburns, mnietoji, vcandapp
Target Milestone: zstreamKeywords: RFE, Triaged
Target Release: 16.2 (Train on RHEL 8.4)   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: os-net-config-11.5.1-2.20230728005156.8a89b94.el8ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-08 19:18:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2222869    

Description Keigo Noha 2022-09-21 00:37:12 UTC
Description of problem:
os-net-config should configure ethtool_opts for SRIOV-VF.

The current os-net-config in OSP16.x and upstream don't have the implementation of ethtool_opts for SRIOV VF.

In the discussion with SBR-Networking, the VF's option configured by ethtool should work separately from SRIOV PF.

Due to that, os-net-config should accept ethtool_opts for SRIOV VF.

~~~
   1362 class SriovVF(_BaseOpts):
   1363     """Base class for SR-IOV VF."""
   1364 
   1365     def __init__(self, device, vfid, use_dhcp=False, use_dhcpv6=False,
   1366                  addresses=None, routes=None, rules=None, mtu=None,
   1367                  primary=False, nic_mapping=None, persist_mapping=False,
   1368                  defroute=True, dhclient_args=None, dns_servers=None,
   1369                  nm_controlled=False, onboot=True, domain=None, vlan_id=0,
   1370                  qos=0, spoofcheck=None, trust=None, state=None, macaddr=None,
   1371                  promisc=None, min_tx_rate=0, max_tx_rate=0):
   1372         addresses = addresses or []
   1373         routes = routes or []
   1374         rules = rules or []
   1375         dns_servers = dns_servers or []
   1376         mapped_nic_names = mapped_nics(nic_mapping)
   1377         if device in mapped_nic_names:
   1378             device = mapped_nic_names[device]
   1379         # Empty strings are set for the name field.
   1380         # The provider shall identify the VF name from the PF device name
   1381         # (device) and the VF id.
   1382         name = utils.get_vf_devname(device, vfid)
   1383         super(SriovVF, self).__init__(name, use_dhcp, use_dhcpv6, addresses,
   1384                                       routes, rules, mtu, primary, nic_mapping,
   1385                                       persist_mapping, defroute,
   1386                                       dhclient_args, dns_servers,
   1387                                       nm_controlled, onboot, domain)
   1388         self.vfid = int(vfid)
   1389         self.device = device
   1390         self.vlan_id = int(vlan_id)
   1391         self.qos = int(qos)
   1392         self.min_tx_rate = int(min_tx_rate)
   1393         self.max_tx_rate = int(max_tx_rate)
   1394         self.spoofcheck = spoofcheck
   1395         self.trust = trust
   1396         self.state = state
   1397         pci_address = utils.get_pci_address(name, False)
   1398         if pci_address is None:
   1399             pci_address = utils.get_stored_pci_address(name, False)
   1400         self.macaddr = macaddr
   1401         self.promisc = promisc
   1402         self.pci_address = pci_address
   1403         utils.update_sriov_vf_map(device, self.vfid, name,
   1404                                   vlan_id=self.vlan_id,
   1405                                   qos=self.qos,
   1406                                   spoofcheck=spoofcheck,
   1407                                   trust=trust,
   1408                                   state=state,
   1409                                   macaddr=macaddr,
   1410                                   promisc=promisc,
   1411                                   pci_address=pci_address,
   1412                                   min_tx_rate=min_tx_rate,
   1413                                   max_tx_rate=max_tx_rate)
   1414 
~~~
~~~
   1457 class SriovPF(_BaseOpts):
   1458     """Base class for SR-IOV PF."""
   1459 
   1460     def __init__(self, name, numvfs, use_dhcp=False, use_dhcpv6=False,
   1461                  addresses=None, routes=None, rules=None, mtu=None,
   1462                  primary=False, nic_mapping=None, persist_mapping=False,
   1463                  defroute=True, dhclient_args=None, dns_servers=None,
   1464                  nm_controlled=False, onboot=True, domain=None, members=None,
   1465                  promisc=None, link_mode='legacy', ethtool_opts=None):
   1466         addresses = addresses or []
   1467         routes = routes or []
   1468         rules = rules or []
   1469         dns_servers = dns_servers or []
   1470         super(SriovPF, self).__init__(name, use_dhcp, use_dhcpv6, addresses,
   1471                                       routes, rules, mtu, primary, nic_mapping,
   1472                                       persist_mapping, defroute,
   1473                                       dhclient_args, dns_servers,
   1474                                       nm_controlled, onboot, domain)
   1475         self.numvfs = int(numvfs)
   1476         mapped_nic_names = mapped_nics(nic_mapping)
   1477         if name in mapped_nic_names:
   1478             self.name = mapped_nic_names[name]
   1479         else:
   1480             self.name = name
   1481         self.promisc = promisc
   1482         self.link_mode = link_mode
   1483         self.ethtool_opts = ethtool_opts
~~~

Version-Release number of selected component (if applicable):
os-net-config in OSP16.x and upstream.

How reproducible:
Everytime

Steps to Reproduce:
1. Add ethtool_opts option to sriov vf
2.
3.

Actual results:
os-net-config exited with an error.

Expected results:
os-net-config can handle ethtool_opts for SRIOV VF.

Additional info:

Comment 8 Karthik Sundaravel 2023-09-26 06:21:59 UTC
Yes Gurpreet, the patch is available in upstream and downstream.

Comment 9 Miguel Angel Nieto 2023-10-17 10:21:50 UTC
Using this config:
    {
      "name": "nic12",
      "numvfs": 10,
      "promisc": false,
      "type": "sriov_pf",
      "use_dhcp": false,
      "ethtool_opts": "autoneg on"
    },
    {
      "type": "sriov_vf",
      "device": "nic12",
      "vfid": 5,
      "addresses": [
        {
          "ip_netmask": "192.0.55.1/24"
        }
      ],
      "vlan_id": 100,
      "spoofcheck": true,
      "macaddr": "00:78:91:81:cc:30",
      "trust": true,
      "state": "auto",
      "promisc": false,
      "ethtool_opts": "autoneg on"
    }

Executing:
os-net-config -d -c /etc/os-net-config/config.json

I can see that the following commands are executed:
[2023/10/17 10:10:32 AM] [DEBUG] Running cmd (subprocess): /sbin/ethtool -s enp4s0f1 autoneg on                                                                                                                   
[2023/10/17 10:10:32 AM] [DEBUG] CMD "/sbin/ethtool -s enp4s0f1 autoneg on" returned: 0 in 0.008s  
[2023/10/17 10:10:33 AM] [DEBUG] Running cmd (subprocess): /sbin/ethtool -s enp4s0f1v5 autoneg on
[2023/10/17 10:10:33 AM] [DEBUG] CMD "/sbin/ethtool -s enp4s0f1v5 autoneg on" returned: 0 in 0.004s

I change the config to the following one:
    {
      "name": "nic12",
      "numvfs": 10,
      "promisc": false,
      "type": "sriov_pf",
      "use_dhcp": false,
      "ethtool_opts": "autoneg off speed 1000 duplex full"
    },
    {
      "type": "sriov_vf",
      "device": "nic12",
      "vfid": 5,
      "addresses": [
        {
          "ip_netmask": "192.0.55.1/24"
        }
      ],
      "vlan_id": 100,
      "spoofcheck": true,
      "macaddr": "00:78:91:81:cc:30",
      "trust": true,
      "state": "auto",
      "promisc": false,
      "ethtool_opts": "autoneg off speed 1000 duplex full"
    }

I get the following logs:
os-net-config -d -c /etc/os-net-config/config.json

[2023/10/17 10:18:20 AM] [INFO] Running ethtool -s enp4s0f1 autoneg off speed 1000 duplex full
[2023/10/17 10:18:20 AM] [DEBUG] Running cmd (subprocess): /sbin/ethtool -s enp4s0f1 autoneg off speed 1000 duplex full  
[2023/10/17 10:10:33 AM] [INFO] Running ethtool -s enp4s0f1v5 autoneg on
[2023/10/17 10:10:33 AM] [DEBUG] Running cmd (subprocess): /sbin/ethtool -s enp4s0f1v5 autoneg on

We can see that ethtool_opts is configured in the nic by os-net-config

Comment 10 Miguel Angel Nieto 2023-10-17 10:26:30 UTC
I pasted wrong lines in the os-net-config output, the second time i run os-net-config, i get:

[2023/10/17 10:10:33 AM] [DEBUG] Running cmd (subprocess): /sbin/ethtool -s enp4s0f1v5 autoneg on
[2023/10/17 10:10:33 AM] [DEBUG] CMD "/sbin/ethtool -s enp4s0f1v5 autoneg on" returned: 0 in 0.004s

[2023/10/17 10:18:20 AM] [DEBUG] Running cmd (subprocess): /sbin/ethtool -s enp4s0f1v5 autoneg off speed 1000 duplex full
[2023/10/17 10:18:20 AM] [DEBUG] CMD "/sbin/ethtool -s enp4s0f1v5 autoneg off speed 1000 duplex full" returned: 0 in 0.004s

Comment 11 Miguel Angel Nieto 2023-10-17 10:36:20 UTC
Verified with the following versions
os-net-config-11.5.1-2.20230728005156.8a89b94.el8ost.noarch
RHOS-16.2-RHEL-8-20231005.n.3

Comment 16 errata-xmlrpc 2023-11-08 19:18:30 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Red Hat OpenStack Platform 16.2.6 (Train) bug fix and enhancement advisory), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:6307