From 862e669fcfe02b49c0e24af210d6466197962b97 Mon Sep 17 00:00:00 2001
From: Gris Ge <fge@redhat.com>
Date: Mon, 3 Aug 2020 11:34:44 +0800
Subject: [PATCH] ovs: Fix bug when adding bond to existing bridge
When adding OVS bond/link aggregation interface to existing OVS bridge,
nmstate will fail with error:
> self._ifaces[slave_name].mark_as_changed()
E KeyError: 'bond1'
This is because ovs bond interface does not require a interface entry in
desire state.
Fixed by check before adding dict.
Integration test case added.
Signed-off-by: Gris Ge <fge@redhat.com>
---
libnmstate/ifaces/ifaces.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libnmstate/ifaces/ifaces.py b/libnmstate/ifaces/ifaces.py
index a400712..1c2ffd5 100644
--- a/libnmstate/ifaces/ifaces.py
+++ b/libnmstate/ifaces/ifaces.py
@@ -217,7 +217,8 @@ class Ifaces:
self._ifaces[iface_name].mark_as_changed()
if cur_iface:
for slave_name in iface.config_changed_slaves(cur_iface):
- self._ifaces[slave_name].mark_as_changed()
+ if slave_name in self._ifaces:
+ self._ifaces[slave_name].mark_as_changed()
def _match_child_iface_state_with_parent(self):
"""
--
2.28.0