Blob Blame History Raw
From 913b739c8fea8e9b14d3785371c8e4f48723dbd6 Mon Sep 17 00:00:00 2001
From: Gris Ge <fge@redhat.com>
Date: Tue, 18 Aug 2020 17:55:12 +0800
Subject: [PATCH] ovsdb: Allowing remove all ports from OVS bridge

When removing all ports from OVS bridge, the OVSDB will have no
information regarding this bridge, which cause OVSDB failed to find
the correct row.

Silently ignore row not found failure and let verification stage do the
work.

Signed-off-by: Gris Ge <fge@redhat.com>
---
 libnmstate/plugins/nmstate_plugin_ovsdb.py | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/libnmstate/plugins/nmstate_plugin_ovsdb.py b/libnmstate/plugins/nmstate_plugin_ovsdb.py
index 12ab10d..f667e8f 100644
--- a/libnmstate/plugins/nmstate_plugin_ovsdb.py
+++ b/libnmstate/plugins/nmstate_plugin_ovsdb.py
@@ -222,19 +222,11 @@ class NmstateOvsdbPlugin(NmstatePlugin):
     def _db_write(self, changes):
         changes_index = {change.row_name: change for change in changes}
         changed_tables = set(change.table_name for change in changes)
-        updated_names = []
         for changed_table in changed_tables:
             for row in self._idl.tables[changed_table].rows.values():
                 if row.name in changes_index:
                     change = changes_index[row.name]
                     setattr(row, change.column_name, change.column_value)
-                    updated_names.append(change.row_name)
-        new_rows = set(changes_index.keys()) - set(updated_names)
-        if new_rows:
-            raise NmstatePluginError(
-                f"BUG: row {new_rows} does not exists in OVS DB "
-                "and currently we don't create new row"
-            )
 
     def _start_transaction(self):
         self._transaction = Transaction(self._idl)
-- 
2.28.0