LNST-project / lnst

Linux Network Stack Test
GNU General Public License v2.0
72 stars 33 forks source link

Fix veth device move #368

Closed jtluka closed 4 months ago

jtluka commented 4 months ago

Description

Resolves an issue when moving a veth device to a namespace. The device will have _nl_link_update populated with data from generic Device creation (device appears in the namespace). This data may cause issues for certain device operations like setting the link up.

To avoid this, clearing the _nl_link_update while remapping the device solves the issue.

Fixes #367

Tests

Tested with the reproducer from the issue both in container setup and normal setup.

I scheduled test run in RH labs that include a single run of each recipe type, beaker job id J:9261245

Reviews

@olichtne

jtluka commented 4 months ago

I hit an issue when running SRIOVNetnsTcRecipe:

LNST Controller crashed with an exception:
Traceback (most recent call last):
  File "/mnt/tests/data.lnst.anl.eng.rdu2.dc.redhat.com/data-server-content/gitlab-tasks/beaker-lnst-tasks/master.tar.gz/lnst/test-runner/test-runner/./do-my-test", line 35, in main
    ctl.run(recipe, multimatch=bool(params.get("MULTIMATCH", False)))
  File "/root/virtualenvs/rhextensions-lnst-Xo1BSm3a-py3.9/lib/python3.9/site-packages/lnst/Controller/Controller.py", line 172, in run
    recipe.test()
  File "/root/rhextensions-lnst/lnst/RHExtensions/RHRecipeMixin.py", line 109, in test
    super(RHRecipeMixin, self).test()
  File "/root/virtualenvs/rhextensions-lnst-Xo1BSm3a-py3.9/lib/python3.9/site-packages/lnst/Recipes/ENRT/BaseEnrtRecipe.py", line 207, in test
    with self._test_wide_context() as main_config:
  File "/usr/lib64/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/root/virtualenvs/rhextensions-lnst-Xo1BSm3a-py3.9/lib/python3.9/site-packages/lnst/Recipes/ENRT/BaseEnrtRecipe.py", line 214, in _test_wide_context
    config = self.test_wide_configuration()
  File "/root/virtualenvs/rhextensions-lnst-Xo1BSm3a-py3.9/lib/python3.9/site-packages/lnst/Recipes/ENRT/BaseSRIOVNetnsTcRecipe.py", line 170, in test_wide_configuration
    host.newns.vf_eth0 = vf_dev
  File "/root/virtualenvs/rhextensions-lnst-Xo1BSm3a-py3.9/lib/python3.9/site-packages/lnst/Controller/Namespace.py", line 221, in __setattr__
    if not self._custom_setattr(name, value):
  File "/root/virtualenvs/rhextensions-lnst-Xo1BSm3a-py3.9/lib/python3.9/site-packages/lnst/Controller/Namespace.py", line 170, in _custom_setattr
    self._machine.remote_device_set_netns(value, self, old_ns)
  File "/root/virtualenvs/rhextensions-lnst-Xo1BSm3a-py3.9/lib/python3.9/site-packages/lnst/Controller/Machine.py", line 138, in remote_device_set_netns
    if dev.peer_name:
  File "/root/virtualenvs/rhextensions-lnst-Xo1BSm3a-py3.9/lib/python3.9/site-packages/lnst/Devices/RemoteDevice.py", line 129, in __getattr__
    attr = getattr(self._dev_cls, name)
AttributeError: type object 'Device' has no attribute 'peer_name'

I will add try/except block to catch this.

SirPhuttel commented 4 months ago

@jtluka, @olichtne, the fix works for me, thanks for the quick help!