Skip to content

Fix removal of defunct vlan interfaces (LP #1959147) #256

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

Merged
merged 6 commits into from
Feb 7, 2022
Merged

Fix removal of defunct vlan interfaces (LP #1959147) #256

merged 6 commits into from
Feb 7, 2022

Conversation

Caligatio
Copy link
Contributor

Description

From my Launchpad bug report:

netplan fails to delete OVS vlan interfaces that were previously defined but were then removed from the configuration. The underlying problem appears to be that the ovs-vsctl iface-to-br command used to test whether an interface is bonded or a vlan fails on "fake bridges" (this is how OVS defines vlans) which then causes it be treated incorrectly as a bonded interface. My testing seems to indicate the ovs-vsctl br-exists command may be a better choice for this test.

Checklist

  • Runs make check successfully.
  • Retains 100% code coverage (make check-coverage). - Looks like there is a pre-existing lack of coverage on netplan/cli/commands/generate.py
  • New/changed keys in YAML format are documented.
  • (Optional) Adds example YAML for new feature.
  • (Optional) Closes an open bug in Launchpad.

@schopin-pro
Copy link
Contributor

Hi!

Thanks for the patch, it looks good for me. Don't worry about the autopkgtest suite failing, I'll run them manually.

However, could you perhaps add a new integration test running the scenario outlined in the LP issue?

@Caligatio
Copy link
Contributor Author

I'll see if I can come up with a decent test tomorrow. The OVS tests are rather sparse so I'll have to figure out how to mock a network config change.

@schopin-pro
Copy link
Contributor

schopin-pro commented Feb 1, 2022 via email

@codecov-commenter
Copy link

codecov-commenter commented Feb 1, 2022

Codecov Report

Merging #256 (889c1cd) into main (ba88341) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #256   +/-   ##
=======================================
  Coverage   99.14%   99.14%           
=======================================
  Files          60       60           
  Lines       10511    10511           
=======================================
  Hits        10421    10421           
  Misses         90       90           
Impacted Files Coverage Δ
netplan/cli/ovs.py 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba88341...889c1cd. Read the comment docs.

@Caligatio
Copy link
Contributor Author

You wrote integration test but I saw unit test :)

I added a test that I have moderate confidence should work. I don't have your integration test setup so I can't make sure it's working as I intended.

On a side note: I think the removal of VLAN interfaces doesn't work for non-OVS interfaces as well (this is with including the -state flag on netplan apply). I need to play around a bit more to confirm but don't be surprised if another bug+PR is created.

@schopin-pro
Copy link
Contributor

schopin-pro commented Feb 1, 2022 via email

@schopin-pro schopin-pro self-assigned this Feb 2, 2022
@Caligatio
Copy link
Contributor Author

Anything else I can do to help this along?

The potential problem I referenced earlier is a directory structure "bug" (https://bugs.launchpad.net/netplan/+bug/1959706) and completely distinct from this patch.

@schopin-pro
Copy link
Contributor

Sorry for the delay. I've finally managed to take the time to run the new test, and it fails early, as it seems the VLAN interface is never created:

test_bridge_vlan_deletion (__main__.TestOVS) ... eth42 br-eth42 ...br-eth42.100 eth42 br-eth42 br-eth42.100 Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
.Interface "br-eth42.100" not found.
FAIL

I couldn't really look further into it.

@Caligatio
Copy link
Contributor Author

I blindly copied and pasted the boilerplate test setup without really understanding what it all did; I inadvertently had it waiting for the just deleted network interface to settle which, as it no longer exists, failed.

If you don't mind running the tests one more time, I believe it should work this time. Sorry about that!

@schopin-pro
Copy link
Contributor

I ran the tests anew, they work now :). I also checked that they do fail on main.

As soon as the CI passes against the rebased branch I'll merge. Thanks for your contribution :)

@schopin-pro schopin-pro merged commit ed7550d into canonical:main Feb 7, 2022
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