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

Validate interface in desired port list of controller #2693

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

liangwen12year
Copy link
Collaborator

When the last port of the controller is absent, the port list of the controller becomes empty, in the situaiton of applying the controller and port settings again, before generating the port config, we should not validate if interface is in the port list of controller when port is empty.

Resolves: https://issues.redhat.com/browse/RHEL-31977

Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/nmstate-nmstate-2693
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

Copy link
Member

@cathay4t cathay4t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of checking whether it is empty, you should check whether the port list is desired or not.

With your current path, you incorrectly allows this YAML:

---
interfaces:
- name: br0
  type: linux-bridge
  bridge:
    ports: []
- name: bond99
  type: bond
  state: up
  controller: br0
  link-aggregation:
    mode: balance-rr
    port:
    - eth2
    - eth1

@liangwen12year liangwen12year changed the title Do not validate interface in port list of controller if port is empty Validate interface in desired port list of controller Jun 7, 2024
@liangwen12year
Copy link
Collaborator Author

Instead of checking whether it is empty, you should check whether the port list is desired or not.

With your current path, you incorrectly allows this YAML:

---
interfaces:
- name: br0
  type: linux-bridge
  bridge:
    ports: []
- name: bond99
  type: bond
  state: up
  controller: br0
  link-aggregation:
    mode: balance-rr
    port:
    - eth2
    - eth1

Thanks for the comment, I updated the patch.

Copy link
Member

@cathay4t cathay4t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include unit test case for

---
interfaces:
- name: br0
  type: linux-bridge
  bridge:
    ports: []
- name: bond99
  type: bond
  state: up
  controller: br0
  link-aggregation:
    mode: balance-rr
    port:
    - eth2
    - eth1

Copy link
Member

@cathay4t cathay4t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your integration test case test_port_remove_and_validate_port_controller has no clean up. Please introduce a fixture and do the clean up no matter test case passed or not.

@liangwen12year liangwen12year force-pushed the port_controller_fix branch 4 times, most recently from c7a4459 to 6ab993a Compare June 11, 2024 15:50
@liangwen12year
Copy link
Collaborator Author

Please include unit test case for

---
interfaces:
- name: br0
  type: linux-bridge
  bridge:
    ports: []
- name: bond99
  type: bond
  state: up
  controller: br0
  link-aggregation:
    mode: balance-rr
    port:
    - eth2
    - eth1

I added the unit test.

@liangwen12year
Copy link
Collaborator Author

Your integration test case test_port_remove_and_validate_port_controller has no clean up. Please introduce a fixture and do the clean up no matter test case passed or not.

I updated the code to reuse the existing fixture for proper cleanup, thanks.

tests/integration/linux_bridge_test.py Outdated Show resolved Hide resolved
When the last port of the controller is absent, the port list of the
controller becomes empty, in the situaiton of applying the controller
and port settings again, before generating the port config, we should
only validate if interface is in the desired port list of controller.

Resolves: https://issues.redhat.com/browse/RHEL-31977

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
@cathay4t cathay4t merged commit 1867722 into nmstate:base Jun 13, 2024
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants