Blob Blame History Raw
From cb4cbff0da01bb1e6546c2b28ef2760ec1f89f74 Mon Sep 17 00:00:00 2001
From: Fernando Fernandez Mancera <ffmancera@riseup.net>
Date: Wed, 24 Feb 2021 17:12:13 +0100
Subject: [PATCH 5/5] bridge: do not bring up existing ports

Nmstate should not try to bring up existing ports on a bridge when
modifying it. The ports will be bring up when being added to the it, if
the bridge is being modified later, the ports are not going to be
automatically up.

Ref: https://bugzilla.redhat.com/1932247

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
---
 libnmstate/ifaces/ifaces.py               |   5 +
 tests/integration/nm/linux_bridge_test.py | 112 +++++++++++++++++++++-
 2 files changed, 116 insertions(+), 1 deletion(-)

diff --git a/libnmstate/ifaces/ifaces.py b/libnmstate/ifaces/ifaces.py
index 1d30d0c6..5f1f548d 100644
--- a/libnmstate/ifaces/ifaces.py
+++ b/libnmstate/ifaces/ifaces.py
@@ -194,7 +194,12 @@ class Ifaces:
         """
         for iface in self._ifaces.values():
             if iface.is_up and iface.is_master:
+                cur_iface = self.current_ifaces.get(iface.name)
                 for slave_name in iface.slaves:
+                    if cur_iface and slave_name in cur_iface.slaves:
+                        # Nmstate should not touch the port interface which has
+                        # already been included in current interface.
+                        continue
                     slave_iface = self._ifaces[slave_name]
                     if not slave_iface.is_desired and not slave_iface.is_up:
                         slave_iface.mark_as_up()
-- 
2.29.2