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

fix: Allow network to restart when wireless or team connection is specified #675

Merged

Conversation

liangwen12year
Copy link
Collaborator

@liangwen12year liangwen12year commented Feb 18, 2024

Enhancement: Ask user's consent to restart NM due to wireless or team interfaces when the updates for network packages are available.

Reason: When wireless or team connections are specified and the updates for network packages are available, NetworkManager must be restarted, the role requires user's consent to restart NetworkManager. Otherwise, there
might be property conflicts between NetworkManager daemon and plugin, or
NetworkManager plugin is not taking effect.

Result: When wireless or team connections are specified and the updates for network packages are available, NetworkManager must be restarted, the role will ask user's explicit consent to restart NetworkManager.

Issue Tracker Tickets (Jira or BZ if any):

Resolves: https://issues.redhat.com/browse/NMT-1039

@liangwen12year
Copy link
Collaborator Author

[citest]

Copy link

codecov bot commented Feb 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 20.50%. Comparing base (b90e123) to head (0fca710).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #675   +/-   ##
=======================================
  Coverage   20.50%   20.50%           
=======================================
  Files          10       10           
  Lines        1478     1478           
  Branches      433      433           
=======================================
  Hits          303      303           
  Misses       1174     1174           
  Partials        1        1           
Flag Coverage Δ
sanity 20.50% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@liangwen12year
Copy link
Collaborator Author

[citest]

@liangwen12year
Copy link
Collaborator Author

[citest]

richm
richm previously approved these changes Feb 19, 2024
@tyll
Copy link
Member

tyll commented Feb 19, 2024

This seems to be wrong. The role needs to handle this scenario properly (or the NM packages need to be changed).

Copy link
Member

@tyll tyll left a comment

Choose a reason for hiding this comment

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

The role should handle the scenario instead of doctoring the tests.

@liangwen12year liangwen12year changed the title tests: Install newest NM to match NM plugin version fix: Allow network to restart when wireless or team connection is specified Feb 19, 2024
@liangwen12year
Copy link
Collaborator Author

[citest]

@liangwen12year
Copy link
Collaborator Author

[citest]

Copy link
Member

@tyll tyll left a comment

Choose a reason for hiding this comment

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

This does not seem to be correct.

@liangwen12year
Copy link
Collaborator Author

[citest]

@liangwen12year liangwen12year force-pushed the nm_plugin_hotfix branch 2 times, most recently from d8d2e33 to 2160db2 Compare February 22, 2024 02:30
@liangwen12year
Copy link
Collaborator Author

[citest]

@liangwen12year
Copy link
Collaborator Author

The PR description is missing the text for Enhancement/Reason/Result.

I added it.

@liangwen12year
Copy link
Collaborator Author

[citest]

Comment on lines 26 to 29
- name: Check if rpm ostree system - cannot test
meta: end_host
when: __network_is_ostree | d(false)
Copy link
Member

Choose a reason for hiding this comment

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

What's the reason this cannot be tested on an rpm ostree system?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

https://github.com/linux-system-roles/network/blob/main/README-ostree.md#rpm-ostree, " the /usr filesystem is read-only, and the role cannot install packages".

Copy link
Contributor

Choose a reason for hiding this comment

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

The problem is that we don't have a good way currently to pass in the custom yum repos/copr repos that are used by these tests. If you could build an image with all of the repos and packages, then I think the tests should work.

Copy link
Member

Choose a reason for hiding this comment

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

main/README-ostree.md#rpm-ostree, " the /usr filesystem is read-only, and the role cannot install packages".

This is not a sufficient explanation. Because this still leaves the question what's the reason that this cannot be tested? The role needs to have a defined behavior when running against ostree systems.

The problem is that we don't have a good way currently to pass in the custom yum repos/copr repos that are used by these tests. If you could build an image with all of the repos and packages, then I think the tests should work.

Maybe I am missing something. If an ostree system is missing the wifi or team subpackage (or even some NM or Nmstate package), then the role needs to handle this with a proper error message (if we intend to support ostree targets). If the role handles this correctly.

Copy link
Contributor

Choose a reason for hiding this comment

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

The problem is that the test wants to remove the package NetworkManager-wifi then reinstall it later - packages cannot be removed from an ostree system - the only thing package management can do at runtime is to verify that the given package exists (or is absent).

If the test needs to verify the package NetworkManager-wifi is absent, then call the role to install it, then verify that the package NetworkManager-wifi is present, then at least this part of the test is not applicable for ostree systems. If we really want this test to be run on ostree systems, then we need to modify the test such that the testing of the package absence and presence is skipped on ostree systems. I don't know if that will substantially change what this test is doing.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking of changing name: Check if rpm ostree system - cannot test to something like name: Cannot test ostree systems because ...

ok. note that there are a few places in tests/ other than this that would require such a change. If @liangwen12year would like to take care of that in this PR, that's fine. But, perhaps since that change would be unrelated to this PR, I can create a separate PR after this one is merged to add such a descriptive name: to the other places in the code where test is skipped due to ostree.

Copy link
Member

Choose a reason for hiding this comment

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

If there are multiple places, maybe it is also worth to write this in one file and include it in all places. Doing this in a follow-up PR is fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

tracked by #681

Copy link
Member

Choose a reason for hiding this comment

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

I meant doing this at other places and/or using a task file for all those places is something to do in a different PR. The task in this PR needs a good name, still.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I renamed the task into following.

    - name: Cannot test ostree systems because the package can not be removed
        or installed - 'NetworkManager-wifi'

@liangwen12year
Copy link
Collaborator Author

[citest]

@liangwen12year
Copy link
Collaborator Author

[citest]

@liangwen12year liangwen12year requested review from tyll and richm March 15, 2024 02:18
If updates for network packages are available and wireless or team
connections are specified, NetworkManager must be restarted, the role
requires user's consent to restart NetworkManager. Otherwise, there
might be property conflicts between NetworkManager daemon and plugin, or
NetworkManager plugin is not taking effect.

`update_cache` is enabled in the module tasks to check if updates for
network packages are available due to wireless or team interfaces, in
that case, NetworkManager needs user's explicit consent to be restarted
after the network package updates. And using `state: latest` for
checking the network package updates because we have to guarantee that
NetworkManager and its plugin have the same and most recent version for
configuring the network connections settings in the backend. It is
worthwhile to mention that we have both tasks using dnf and yum module
for checking available updates for network packages. Because checking
package cache update is not supported in Ansible package module, Fedora
and RHEL8+ use DNF package manager by default, RHEL7 uses yum package
manager by default.

This commit will address the situation that users forget to explicitly
specify `network_allow_restart: true` when specifying wireless or team
connections.

Signed-off-by: Wen Liang <[email protected]>
- always

- name: Cannot test ostree systems because the package can not be removed
or installed - 'NetworkManager-wifi'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we are using the jinja2 syntax for the '{{ package }}', the {{ package }}' should be appeared at the end of the task name.

Copy link
Member

Choose a reason for hiding this comment

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

FWIW, cannot is more common than can not.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, thanks for pointing it out, I will address it in another PR.

@liangwen12year
Copy link
Collaborator Author

@tyll , if you agree, then I will proceed to merge this PR.

@liangwen12year
Copy link
Collaborator Author

[citest]

Copy link
Member

@tyll tyll left a comment

Choose a reason for hiding this comment

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

Thank you, LGTM

@liangwen12year liangwen12year merged commit 44f937d into linux-system-roles:main Mar 15, 2024
33 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.

4 participants