Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devices/Device.py: Fix for broken cleanup() with missing tc tool #362

Merged
merged 1 commit into from
Feb 21, 2024

Conversation

SirPhuttel
Copy link
Contributor

If no tc utility is present on the agent system, exec_cmd() raises an exception. If uncaught, the previous address flush request will also not complete. The address remaining in place will cause an EEXIST error upon next test run, requiring manual intervention to resolve the situation.

Fixes: 49e523d ("Slave: Add basic support for tc.")

If no tc utility is present on the agent system, exec_cmd() raises an
exception. If uncaught, the previous address flush request will also not
complete. The address remaining in place will cause an EEXIST error upon
next test run, requiring manual intervention to resolve the situation.

Fixes: 49e523d ("Slave: Add basic support for tc.")
Signed-off-by: Phil Sutter <[email protected]>
@SirPhuttel
Copy link
Contributor Author

@jtluka my bet was right, this fixes the problem. Could you please review?

@jtluka
Copy link
Collaborator

jtluka commented Feb 21, 2024

The fix looks ok in general, however I'd like to enhance it a bit so that we don't silently discard potential issues when iproute-tc is installed but fails when executed.

In particular I'd like to have error message check for "command not found" similar to what we have in

except ExecCmdFail as e:

Maybe using function decorator similar to sriov_capable, would be best. Decorator definition is here

Anyway, I'm ok with the patch as is, @olichtne what's your opinion?

@olichtne
Copy link
Collaborator

Anyway, I'm ok with the patch as is, @olichtne what's your opinion?

i'm it should be ok to simply do

except ExecCmdFail:
    logging.exception("tc command error during cleanup")

this will log both the traceback and some basic message instead of silently passing the exception.

@jtluka
Copy link
Collaborator

jtluka commented Feb 21, 2024

Anyway, I'm ok with the patch as is, @olichtne what's your opinion?

i'm it should be ok to simply do

except ExecCmdFail:
    logging.exception("tc command error during cleanup")

this will log both the traceback and some basic message instead of silently passing the exception.

The exception is already logged in the exec_cmd code, so this is not necessary.

@olichtne
Copy link
Collaborator

ah, fair point, in that case this should be ok as is.

wrt. sriov_capable i'm not sure what that would add in this case?

@jtluka
Copy link
Collaborator

jtluka commented Feb 21, 2024

wrt. sriov_capable i'm not sure what that would add in this case?

Avoiding duplication of the code. If we were to add error message parsing, we'd have to include that in both _clear_tc_qdisc and _clear_tc_filters. Using wrapper that would do the check of iproute-tc availability would keep the code at single place.

But it's not worth it. Let's merge this.

@olichtne olichtne merged commit 28d0e16 into LNST-project:master Feb 21, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants