-
Couldn't load subscription status.
- Fork 18
Fix error Deleting network interface #731
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #731 +/- ##
==========================================
- Coverage 62.49% 62.38% -0.11%
==========================================
Files 70 70
Lines 6231 6235 +4
Branches 506 507 +1
==========================================
- Hits 3894 3890 -4
- Misses 2179 2187 +8
Partials 158 158 ☔ View full report in Codecov by Sentry. |
JIRA: ALEPH-115 **Problem**: When reusing an existing stale network interface, the following error would occasionally occur: ``` Unknown exception while deleting address 2a01:4f8:171:787:1:63fa:f8b5:db10/124 to interface vmtap... ``` See details in Sentry: [https://alephim.sentry.io/issues/5993120643/?project=4506303231819776](https://alephim.sentry.io/issues/5993120643/?project=4506303231819776) **Analysis**: This error occurred during the process of cleaning up an old interface (that was not deleted after usage for various possible reasons). The code was attempting to delete the IP addresses associated with this interface (as calculated in the code). However, when these IP addresses did not exist, an error was raised. **Solution**: Our initial approach was to use the `IPRoute` module to list the IP addresses associated with the network interface and then delete them instead of calculating their names in the Python code as is done presently. After experimentation, we determined that deleting the interface directly also removes the associated IP addresses. Therefore, it is unnecessary to delete them manually, which simplifies the code. **To test**: Create and stop Program Create network interface ```bash sudo ip tuntap add dev vmtap4 mode tap ``` and attach ip to them ```bash sudo ip addr add 1.1.1.1/30 dev vmtap4 ``` Try different combinaison and validate that everything still work correctly To check the networks interfaces use the following command to list them ```bash sudo ip link ``` and to list the ip address use: ``` sudo ip addr ```
mainly to improve code coverage
5340348 to
67101e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot remove that method because it is needed to avoid having different interfaces with the same IP addresses. Instead, we need to handle the error or maybe ensure that the interface have the address before trying to delete it.
|
After discussion with @nesitor he told me he had to add the ip deleting code a while back to fix some corner cases issue. Thus I modified the PR to instead list all the ip linked to the interface and delete them, which will prevent trying to delete inexsiting addresses. |
JIRA: ALEPH-115
Problem:
When reusing an existing stale network interface, the following error would occasionally occur:
See details in Sentry: https://alephim.sentry.io/issues/5993120643/?project=4506303231819776
Analysis:
This error occurred during the process of cleaning up an old interface (that was not deleted after usage for various possible reasons). The code was attempting to delete the IP addresses associated with this interface (as calculated in the code). However, when these IP addresses did not exist, an error was raised.
Solution:
Our initial approach was to use the
IPRoutemodule to list the IP addresses associated with the network interface and then delete them instead of calculating their names in the Python code as is done presently.After experimentation, we determined that deleting the interface directly also removes the associated IP addresses. Therefore, it is unnecessary to delete them manually, which simplifies the code.
To test:
Create and stop Program
Create network interface
and attach ip to them
Try different combinaison and validate that everything still work correctly
To check the networks interfaces use the following command to list them
and to list the ip address use: