-
Notifications
You must be signed in to change notification settings - Fork 884
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 metric setting of nmconnection for rhel #5878
base: main
Are you sure you want to change the base?
Conversation
Most RHEL systems use network manager to bring up manage network connections. Network Manager uses route-metric for the default route and route/plen[,gateway,metric] for the additional static routes, please see https://networkmanager.dev/docs/api/latest/nm-settings-nmcli.html https://networkmanager.dev/docs/api/latest/nm-settings-keyfile.html This changes ensures that cloud-init generates nmconnection files with route metric settings that are compatible with RHEL and network manager. Fixes: canonicalGH-5877 Signed-off-by: Amy Chen <xiachen@redhat.com>
Hi @ani-sinha, could you please help to take a review? |
@@ -420,6 +421,7 @@ | |||
[ipv4] | |||
method=auto | |||
may-fail=false | |||
route-metric=10000 | |||
route1=0.0.0.0/0,65.61.151.37 |
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.
If the metric value were added here, it would have been the same effect since it also specifies default route. I think we should do it this way instead of adding route-metric
. In other words, there is no need to check for default route and add route-metric
. All matric values can be added as a comma separated value.
@@ -245,6 +249,11 @@ def _add_route(self, route): | |||
value = f'{route["network"]}/{route["prefix"]}' | |||
if "gateway" in route: | |||
value += f',{route["gateway"]}' | |||
if "metric" in route: | |||
if self._is_default_route(route): | |||
self.config[family]["route-metric"] = f'{route["metric"]}' |
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 if we really want to add route-metric
separately.
Most RHEL systems use network manager to bring up manage network connections.
Network Manager uses route-metric for the default route and route/plen[,gateway,metric] for the additional static routes, please see
https://networkmanager.dev/docs/api/latest/nm-settings-nmcli.html
https://networkmanager.dev/docs/api/latest/nm-settings-keyfile.html
This changes ensures that cloud-init generates nmconnection files with route metric settings that are compatible with RHEL and network manager.
Fixes: GH-5877
Test steps
For the config data
After this changes the nmconnetion file looks as below
and the routes are configured with metric
Merge type