|
|
245567 |
From 38a8e719f93a0e6157f4d788856e34fcf6cbe089 Mon Sep 17 00:00:00 2001
|
|
|
245567 |
From: Edward Haas <edwardh@redhat.com>
|
|
|
245567 |
Date: Wed, 31 Jul 2019 12:35:37 +0300
|
|
|
245567 |
Subject: [PATCH] nm.device: Exclude ipv6 changes from reapply
|
|
|
245567 |
|
|
|
245567 |
If ipv6 is changed, fallback from reapply to activate.
|
|
|
245567 |
|
|
|
245567 |
Ref: https://bugzilla.redhat.com/1734470
|
|
|
245567 |
|
|
|
245567 |
Signed-off-by: Edward Haas <edwardh@redhat.com>
|
|
|
245567 |
Signed-off-by: Gris Ge <fge@redhat.com>
|
|
|
245567 |
---
|
|
|
245567 |
libnmstate/nm/device.py | 38 +++++++++++++++++++++++++++++++-------
|
|
|
245567 |
1 file changed, 31 insertions(+), 7 deletions(-)
|
|
|
245567 |
|
|
|
245567 |
diff --git a/libnmstate/nm/device.py b/libnmstate/nm/device.py
|
|
|
245567 |
index 35f18b1..31ba298 100644
|
|
|
245567 |
--- a/libnmstate/nm/device.py
|
|
|
245567 |
+++ b/libnmstate/nm/device.py
|
|
|
245567 |
@@ -186,18 +186,42 @@ def _modify_callback(src_object, result, user_data):
|
|
|
245567 |
|
|
|
245567 |
|
|
|
245567 |
def _requires_activation(dev, connection_profile):
|
|
|
245567 |
+ if _mtu_changed(dev, connection_profile):
|
|
|
245567 |
+ logging.debug(
|
|
|
245567 |
+ 'Device reapply does not support mtu changes, '
|
|
|
245567 |
+ 'fallback to device activation: dev=%s',
|
|
|
245567 |
+ dev.get_iface(),
|
|
|
245567 |
+ )
|
|
|
245567 |
+ return True
|
|
|
245567 |
+ if _ipv6_changed(dev, connection_profile):
|
|
|
245567 |
+ logging.debug(
|
|
|
245567 |
+ 'Device reapply does not support ipv6 changes, '
|
|
|
245567 |
+ 'fallback to device activation: dev=%s',
|
|
|
245567 |
+ dev.get_iface(),
|
|
|
245567 |
+ )
|
|
|
245567 |
+ return True
|
|
|
245567 |
+ return False
|
|
|
245567 |
+
|
|
|
245567 |
+
|
|
|
245567 |
+def _mtu_changed(dev, connection_profile):
|
|
|
245567 |
wired_setting = connection_profile.get_setting_wired()
|
|
|
245567 |
configured_mtu = wired_setting.props.mtu if wired_setting else None
|
|
|
245567 |
if configured_mtu:
|
|
|
245567 |
current_mtu = int(dev.get_mtu())
|
|
|
245567 |
- if configured_mtu != current_mtu:
|
|
|
245567 |
- logging.debug(
|
|
|
245567 |
- 'Device reapply does not support mtu changes, '
|
|
|
245567 |
- 'fallback to device activation: dev=%s',
|
|
|
245567 |
- dev.get_iface(),
|
|
|
245567 |
- )
|
|
|
245567 |
- return True
|
|
|
245567 |
+ return configured_mtu != current_mtu
|
|
|
245567 |
+ return False
|
|
|
245567 |
|
|
|
245567 |
+
|
|
|
245567 |
+def _ipv6_changed(dev, connection_profile):
|
|
|
245567 |
+ """
|
|
|
245567 |
+ Detecting that the IPv6 method changed is not possible at this stage,
|
|
|
245567 |
+ therefore, if IPv6 is defined (i.e. the method if not 'ignore'), IPv6 is
|
|
|
245567 |
+ considered as changed.
|
|
|
245567 |
+ """
|
|
|
245567 |
+ ipv6_setting = connection_profile.get_setting_ip6_config()
|
|
|
245567 |
+ if ipv6_setting:
|
|
|
245567 |
+ ignore = nmclient.NM.SETTING_IP6_CONFIG_METHOD_IGNORE
|
|
|
245567 |
+ return ipv6_setting.props.method != ignore
|
|
|
245567 |
return False
|
|
|
245567 |
|
|
|
245567 |
|
|
|
245567 |
--
|
|
|
245567 |
2.22.0
|
|
|
245567 |
|