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

T5941: Migration policy delete orphaned interface policy #2890

Merged
merged 1 commit into from Feb 1, 2024

Conversation

sever-sever
Copy link
Member

@sever-sever sever-sever commented Jan 24, 2024

Change Summary

We can get an orphaned interface policy when the policy name is removed from the interface, but the node policy is still attached to the interface.

For example we have orphaned node policy on an interface:

set interfaces bonding bond0 vif 995 policy

This causes of incorrect migration and we do not see VLANs on the bonding interface after update.

Delete policy from all interfaces if the policy does not exist.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

The similar PR #2892

Component(s) name

Proposed changes

How to test

To reproduce:

set interfaces bonding bond0 member interface 'eth1'
set interfaces bonding bond0 vif 995 policy

After update, we do not have interface bond0.995 but it is present in the /config/config.boot:
Example:

vyos@r1# cat tmp.txt 
interfaces {
    bonding bond0 {
        member {
            interface eth1
        }
        vif 995 {
            policy {
            }
        }
    }

Show interface before fix (do not see bond0.995):

vyos@r1:~$ show int
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface    IP Address         MAC                VRF        MTU  S/L    Description
-----------  -----------------  -----------------  -------  -----  -----  -------------
bond0        -                  6e:8c:13:0e:d0:79  default   1500  u/u
dum0         203.0.113.1/32     c6:d3:03:b3:98:c2  default   1500  u/u
eth0         192.168.122.11/24  52:54:00:ed:60:b3  default   1500  u/u    WAN
eth1         -                  6e:8c:13:0e:d0:79  default   1500  u/u    LAN

Smoketest result

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

We can get orphaned interface policy when the policy name was
removed from the interface but the node `policy` still attached
to the interface

For exmaple we have orphaned node policy on interface:
```
set interfaces bonding bond0 vif 995 policy
```

This causes of incorrect migration and we do not see VLANs on
the bonding interface after update.

Delete policy from all interfaces if policy does not exist
@sarthurdev
Copy link
Member

I think it would be cleaner to just remove these lines from the migrator:

if not config.exists(base4) and not config.exists(base6):
    # Nothing to do
    exit(0)

It will still iterate and remove the policy nodes from interfaces regardless of base node existing.

@sever-sever
Copy link
Member Author

I think it would be cleaner to just remove these lines from the migrator:

if not config.exists(base4) and not config.exists(base6):
    # Nothing to do
    exit(0)

It will still iterate and remove the policy nodes from interfaces regardless of base node existing.

I though about it and even tested before any change, looks like also safe solution

@c-po c-po merged commit 53f65ee into vyos:current Feb 1, 2024
7 checks passed
@c-po
Copy link
Member

c-po commented Feb 1, 2024

@Mergifyio backport sagitta

Copy link

mergify bot commented Feb 1, 2024

backport sagitta

✅ Backports have been created

c-po added a commit that referenced this pull request Feb 1, 2024
T5941: Migration policy delete orphaned interface policy (backport #2890)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 participants