Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nm: Fix the incorrect change indication when apply the same config twice
When applying the same network connections twice, the second apply still shows `changed: true`. The root cause: * When user never asked about ethtool configuration, network-role will generate an all-default `NM.SettingEthtool` and pass it to NetworkManager daemon. But NetworkManager discard it when saving to ifcfg plugin as ifcfg plugin will not keep empty ethtool option. * During second apply, the `NM.SimpleConnection.compare` will return False indicating configuration changed because of on-disk connection has no ethtool setting while pending connection does. To fix it, we just remove the all-default `NM.SettingEthtool`. Signed-off-by: Gris Ge <fge@redhat.com>
- Loading branch information
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# This file was generated by ensure_provider_tests.py | ||
--- | ||
- hosts: all | ||
vars: | ||
interface: testnic1 | ||
type: veth | ||
name: Test change indication on repeat run | ||
tasks: | ||
- include_tasks: tasks/manage_test_interface.yml | ||
vars: | ||
state: present | ||
- include_tasks: tasks/assert_device_present.yml | ||
- block: | ||
- import_role: | ||
name: linux-system-roles.network | ||
vars: | ||
network_connections: | ||
- name: "{{ interface }}" | ||
state: up | ||
type: ethernet | ||
ip: | ||
dhcp4: "no" | ||
auto6: "no" | ||
register: __network_connections_result | ||
- name: Assert change:true | ||
assert: | ||
that: __network_connections_result.changed | ||
- import_role: | ||
name: linux-system-roles.network | ||
vars: | ||
network_connections: | ||
- name: "{{ interface }}" | ||
state: up | ||
type: ethernet | ||
ip: | ||
dhcp4: "no" | ||
auto6: "no" | ||
register: __network_connections_result | ||
- name: Assert change:false | ||
assert: | ||
that: not __network_connections_result.changed | ||
always: | ||
- block: | ||
- import_role: | ||
name: linux-system-roles.network | ||
vars: | ||
network_connections: | ||
- name: "{{ interface }}" | ||
persistent_state: absent | ||
state: down | ||
ignore_errors: true | ||
- include_tasks: tasks/manage_test_interface.yml | ||
vars: | ||
state: absent | ||
tags: | ||
- "tests::cleanup" |