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

nmcli module unexpectedly changes bonding mode of existing interface #9201

Open
1 task done
LukWe99 opened this issue Nov 27, 2024 · 5 comments
Open
1 task done

nmcli module unexpectedly changes bonding mode of existing interface #9201

LukWe99 opened this issue Nov 27, 2024 · 5 comments
Labels
feature This issue/PR relates to a feature request module module plugins plugin (any type)

Comments

@LukWe99
Copy link

LukWe99 commented Nov 27, 2024

Summary

When I try to set dns4 searching domains for an existing bond interface, bonding mode gets unexpectedly changed from "802.3ad" to "balance-rr" which results in a broken connection.

I assume the bug does not only occur on changing dns4 searching domains but for every change caused by a module invocation for that interface but unfortunately I have no possibility to verify that.

Issue Type

Feature Idea

Component Name

nmcli

Ansible Version

$ ansible --version
ansible [core 2.15.12]
  config file = None
  configured module search path = ['/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.19 (main, Jun 11 2024, 00:00:00) [GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] (/usr/bin/python3)
  jinja version = 3.1.4
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general

# /usr/share/ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 10.0.1

Configuration

$ ansible-config dump --only-changed
CONFIG_FILE() = None

OS / Environment

Target is a hardware server running RHEL 8.

Steps to Reproduce

---
- name: Set DNS search domains
  nmcli:
    conn_name: bond0
    state: present
    dns4_search:
      - example1.com
      - example2.com
      - example3.com

Expected Results

I expected the module to only update the dns4 search domains of the existing bond interface (if necessary) and not to touch any other settings of the interface. If no "mode" is given and the bond interface is already existing, I expect the module to keep the "mode" setting (e.g. "802.3ad") and not to set it to the default value of "balanced-rr".

Actual Results

 {
-    "802-3-ethernet.mtu": null,
+    "802-3-ethernet.mtu": "auto",
     "connection.autoconnect": "yes",
     "ipv4.dns-search": [
         "example1.com",
@@ -12,5 +12,5 @@
     "ipv4.never-default": "no",
     "ipv6.ignore-auto-dns": "no",
     "ipv6.ignore-auto-routes": "no",
-    "mode": "802.3ad"
+    "mode": "balance-rr"
 }

Although the dns4 search domains are already set correctly, the module reports "changed" and changes the "mode" parameter from "802.3ad" (which would be the correct setting) to "balance-rr" (which seems to be the default for "mode" as "mode" is not explicitly set in the module invocation). This breaks the bonded network connection.

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module plugins plugin (any type) labels Nov 27, 2024
@russoz
Copy link
Collaborator

russoz commented Dec 3, 2024

hi @LukWe99 thanks for the report. Technically this is not a bug report but rather a feature request. The default mode for the module is balance-rr, which might be arguably not the best choice, but the module does what it promises to do.

@LukWe99
Copy link
Author

LukWe99 commented Dec 10, 2024

Hi @russoz, thank you for your comment. I agree that it's documented that balance-rr is the default mode for the module. But let me compare it to the file module.

With the file module, the following applies:

  • File does not exist and no mode is specified => Default value is used
  • File exists and no mode is specified => Mode remains unchanged

Accordingly, I would expect the following from the nmcli module:

  • Connection does not exist and no mode is specified => Default value balance-rr is used
  • Connection exists and no mode is specified => Mode remains unchanged

Feel free to convert the bug ticket into a feature request ticket if it supports the implementation of the behavior described above.

@russoz
Copy link
Collaborator

russoz commented Dec 12, 2024

@LukWe99 the main difference is that bug fixes are backported (to fix previous releases), whilst features are applied forward-only.

I have just changed the type to "Feature Idea"

@ansibullbot ansibullbot added the feature This issue/PR relates to a feature request label Dec 12, 2024
@felixfontein felixfontein removed the bug This issue/PR relates to a bug label Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request module module plugins plugin (any type)
Projects
None yet
Development

No branches or pull requests

4 participants