39 lines
1.4 KiB
Diff
39 lines
1.4 KiB
Diff
From d7393d40aaedeea5dd8291519cddeecdfdabc849 Mon Sep 17 00:00:00 2001
|
|
From: Fernando Fernandez Mancera <ffmancera@riseup.net>
|
|
Date: Mon, 7 Dec 2020 00:51:19 +0100
|
|
Subject: [PATCH] ifaces: do not remove unmanaged orphan interfaces
|
|
|
|
If there are unmanaged OVS interface present in the network state, NM
|
|
may report uncomplete information. Therefore, nmstate could consider
|
|
them as orphan and remove it when modifying the network state.
|
|
|
|
In order to fix this, nmstate should not consider it orphan and remove
|
|
it when it is not on desired state or marked as changed.
|
|
|
|
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
|
|
Signed-off-by: Gris Ge <fge@redhat.com>
|
|
---
|
|
libnmstate/ifaces/ifaces.py | 6 ++++--
|
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/libnmstate/ifaces/ifaces.py b/libnmstate/ifaces/ifaces.py
|
|
index 1c2ffd5..703e672 100644
|
|
--- a/libnmstate/ifaces/ifaces.py
|
|
+++ b/libnmstate/ifaces/ifaces.py
|
|
@@ -242,8 +242,10 @@ class Ifaces:
|
|
|
|
def _mark_orphen_as_absent(self):
|
|
for iface in self._ifaces.values():
|
|
- if iface.need_parent and (
|
|
- not iface.parent or not self._ifaces.get(iface.parent)
|
|
+ if (
|
|
+ iface.need_parent
|
|
+ and (not iface.parent or not self._ifaces.get(iface.parent))
|
|
+ and (iface.is_desired or iface.is_changed)
|
|
):
|
|
iface.mark_as_changed()
|
|
iface.state = InterfaceState.ABSENT
|
|
--
|
|
2.18.4
|
|
|