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
nm: Fix the incorrect change indication when apply the same config twice #396
Conversation
Pull Request Test Coverage Report for Build 1000358175
💛 - Coveralls |
fix in NM here: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/905 (the workaround here is of course still necessary) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice patch.
It would be great to have a test for this that applies a certain profile twice that triggered this error and asserts that the module does not report "changed" for the second time the profile is applied. What do you think? |
4feeac3
to
adf68bd
Compare
network_connections: | ||
- name: "{{ interface }}" | ||
state: up | ||
type: ethernet | ||
ip: | ||
dhcp4: "no" | ||
auto6: "no" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable can be set in line 5 for the playbook then it does not need to be repeated and it would ensure that the profiles are always the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had trouble on this. Could you provide an example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable
Which variable?
I had trouble on this.
What did you try, and what was the result?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to place the network_connections
at the host level variable, and then remove that from import_role
task. Not work.
Even with this in import_role
task will not work:
- block:
- import_role:
name: linux-system-roles.network
vars:
- network_connections: " {{ network_connections }} "
register: __network_connections_result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what the problem is - here is an example playbook calling a role with a variable defined at the host level - https://gist.github.com/richm/e9d338d8b39254b84b90fd2bf0b0b0a1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. The code is working now.
4a8a093
to
b2e1a8d
Compare
new patch added.
@liangwen12year @thom311 I have included another patch fixing the DNS option change indication problem. Please review it again. |
5ab784d
to
1cb331e
Compare
d041e89
to
4e65cc4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
[citest bad] |
1 similar comment
[citest bad] |
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>
When applying with `dhcp4: "no"` or `auto6: "no"`, we get incorrect change indication even when network connection was not changed. The root cause is the `NM.SettingIPConfig.clear_dns_options(True)` will create an empty list which will be discard by ifcfg plugin. The follow up `NM.Connection.compare()` will show configuration changed as dns option entry missing. Fixed by remove dns option completely before appending. Signed-off-by: Gris Ge <fge@redhat.com>
[citest bad] |
The CI failure is unrelated. Force merging. |
Patch 1
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 toNetworkManager 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 returnFalse 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
.Patch 2
Fix the incorrect change indication for dns option
When applying with
dhcp4: "no"
orauto6: "no"
, we get incorrectchange indication even when network connection was not changed.
The root cause is the
NM.SettingIPConfig.clear_dns_options(True)
willcreate an empty list which will be discard by ifcfg plugin.
The follow up
NM.Connection.compare()
will show configuration changedas dns option entry missing.
Fixed by remove dns option completely before appending.