From 04d7c3a4829384957d542b7e89f1294a31e74fd3 Mon Sep 17 00:00:00 2001 From: Open vSwitch CI Date: Mar 31 2021 15:33:52 +0000 Subject: Import openvswitch2.11-2.11.3-87 from Fast DataPath --- diff --git a/SOURCES/openvswitch-2.11.3.patch b/SOURCES/openvswitch-2.11.3.patch index ad2b9db..491494f 100644 --- a/SOURCES/openvswitch-2.11.3.patch +++ b/SOURCES/openvswitch-2.11.3.patch @@ -20184,6 +20184,140 @@ index 1f9c32fa74..c45f33e262 100644 char *set_blacklist_tables(const char *blacklist, bool dryrun) OVS_WARN_UNUSED_RESULT; +diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py +index 250e89756c..53ebb5cc0c 100644 +--- a/python/ovs/db/idl.py ++++ b/python/ovs/db/idl.py +@@ -12,6 +12,7 @@ + # See the License for the specific language governing permissions and + # limitations under the License. + ++import collections + import functools + import uuid + +@@ -39,6 +40,10 @@ OVSDB_UPDATE = 0 + OVSDB_UPDATE2 = 1 + + ++Notice = collections.namedtuple('Notice', ('event', 'row', 'updates')) ++Notice.__new__.__defaults__ = (None,) # default updates=None ++ ++ + class Idl(object): + """Open vSwitch Database Interface Definition Language (OVSDB IDL). + +@@ -479,6 +484,7 @@ class Idl(object): + raise error.Error(" is not an object", + table_updates) + ++ notices = [] + for table_name, table_update in six.iteritems(table_updates): + table = self.tables.get(table_name) + if not table: +@@ -504,7 +510,9 @@ class Idl(object): + % (table_name, uuid_string)) + + if version == OVSDB_UPDATE2: +- if self.__process_update2(table, uuid, row_update): ++ changes = self.__process_update2(table, uuid, row_update) ++ if changes: ++ notices.append(changes) + self.change_seqno += 1 + continue + +@@ -517,17 +525,20 @@ class Idl(object): + raise error.Error(' missing "old" and ' + '"new" members', row_update) + +- if self.__process_update(table, uuid, old, new): ++ changes = self.__process_update(table, uuid, old, new) ++ if changes: ++ notices.append(changes) + self.change_seqno += 1 ++ for notice in notices: ++ self.notify(*notice) + + def __process_update2(self, table, uuid, row_update): ++ """Returns Notice if a column changed, False otherwise.""" + row = table.rows.get(uuid) +- changed = False + if "delete" in row_update: + if row: + del table.rows[uuid] +- self.notify(ROW_DELETE, row) +- changed = True ++ return Notice(ROW_DELETE, row) + else: + # XXX rate-limit + vlog.warn("cannot delete missing row %s from table" +@@ -546,29 +557,27 @@ class Idl(object): + changed = self.__row_update(table, row, row_update) + table.rows[uuid] = row + if changed: +- self.notify(ROW_CREATE, row) ++ return Notice(ROW_CREATE, row) + elif "modify" in row_update: + if not row: + raise error.Error('Modify non-existing row') + + old_row = self.__apply_diff(table, row, row_update['modify']) +- self.notify(ROW_UPDATE, row, Row(self, table, uuid, old_row)) +- changed = True ++ return Notice(ROW_UPDATE, row, Row(self, table, uuid, old_row)) + else: + raise error.Error(' unknown operation', + row_update) +- return changed ++ return False + + def __process_update(self, table, uuid, old, new): +- """Returns True if a column changed, False otherwise.""" ++ """Returns Notice if a column changed, False otherwise.""" + row = table.rows.get(uuid) + changed = False + if not new: + # Delete row. + if row: + del table.rows[uuid] +- changed = True +- self.notify(ROW_DELETE, row) ++ return Notice(ROW_DELETE, row) + else: + # XXX rate-limit + vlog.warn("cannot delete missing row %s from table %s" +@@ -588,7 +597,7 @@ class Idl(object): + if op == ROW_CREATE: + table.rows[uuid] = row + if changed: +- self.notify(ROW_CREATE, row) ++ return Notice(ROW_CREATE, row) + else: + op = ROW_UPDATE + if not row: +@@ -602,8 +611,8 @@ class Idl(object): + if op == ROW_CREATE: + table.rows[uuid] = row + if changed: +- self.notify(op, row, Row.from_json(self, table, uuid, old)) +- return changed ++ return Notice(op, row, Row.from_json(self, table, uuid, old)) ++ return False + + def __column_name(self, column): + if column.type.key.type == ovs.db.types.UuidType: +@@ -1374,10 +1383,9 @@ class Transaction(object): + for col, val in six.iteritems(row._mutations['_inserts']): + column = row._table.columns[col] + if column.type.is_map(): +- opdat = ["map"] + datum = data.Datum.from_python(column.type, val, + _row_to_uuid) +- opdat.append(datum.as_list()) ++ opdat = self._substitute_uuids(datum.to_json()) + else: + opdat = ["set"] + inner_opdat = [] diff --git a/python/ovs/stream.py b/python/ovs/stream.py index c15be4b3e5..73aa993da3 100644 --- a/python/ovs/stream.py @@ -20675,6 +20809,32 @@ index e3173fb88f..2347c690ef 100644 diff --git a/tests/fuzz-regression/ofp_print_fuzzer-6540965472632832 b/tests/fuzz-regression/ofp_print_fuzzer-6540965472632832 new file mode 100644 index 0000000000..e69de29bb2 +diff --git a/tests/idltest.ovsschema b/tests/idltest.ovsschema +index bee79fc50f..e02b975bc5 100644 +--- a/tests/idltest.ovsschema ++++ b/tests/idltest.ovsschema +@@ -171,6 +171,21 @@ + }, + "isRoot" : false + }, ++ "simple5": { ++ "columns" : { ++ "name": {"type": "string"}, ++ "irefmap": { ++ "type": { ++ "key": {"type": "integer"}, ++ "value": {"type": "uuid", ++ "refTable": "simple3"}, ++ "min": 0, ++ "max": "unlimited" ++ } ++ } ++ }, ++ "isRoot": true ++ }, + "singleton" : { + "columns" : { + "name" : { diff --git a/tests/library.at b/tests/library.at index a30d362e34..49d90f4303 100644 --- a/tests/library.at @@ -21180,10 +21340,18 @@ index c7f1e344c9..115c9f7978 100644 done=0 for j in $(seq 0 $(expr $n1 - 1)); do diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at -index 8981b5e2f9..3661816f6d 100644 +index 8981b5e2f9..c41723dc61 100644 --- a/tests/ovsdb-idl.at +++ b/tests/ovsdb-idl.at -@@ -1193,6 +1193,7 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated], +@@ -983,6 +983,7 @@ AT_CHECK([sort stdout | uuidfilt], [0], + # Check that ovsdb-idl figured out that table link2 and column l2 are missing. + AT_CHECK([grep ovsdb_idl stderr | sort], [0], [dnl + test-ovsdb|ovsdb_idl|idltest database lacks link2 table (database needs upgrade?) ++test-ovsdb|ovsdb_idl|idltest database lacks simple5 table (database needs upgrade?) + test-ovsdb|ovsdb_idl|idltest database lacks singleton table (database needs upgrade?) + test-ovsdb|ovsdb_idl|link1 table in idltest database lacks l2 column (database needs upgrade?) + ]) +@@ -1193,6 +1194,7 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated], "where": [], "row": {"b": true}}]']], [[000: i=1 r=2 b=true s=mystring u=<0> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<1> <2>] uuid=<3> @@ -21191,7 +21359,7 @@ index 8981b5e2f9..3661816f6d 100644 000: updated columns: b ba i ia r ra s sa u ua 001: {"error":null,"result":[{"count":2}]} 002: i=0 r=0 b=true s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<5> -@@ -1255,6 +1256,7 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops], +@@ -1255,6 +1257,7 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops], [[000: empty 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} 002: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<0> @@ -21199,7 +21367,7 @@ index 8981b5e2f9..3661816f6d 100644 002: updated columns: b ba i ia r ra s sa u ua 003: {"error":null,"result":[{"count":2}]} 004: i=0 r=0 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -@@ -1266,6 +1268,7 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops], +@@ -1266,6 +1269,7 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops], 006: updated columns: r 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} 008: i=-1 r=125 b=false s= u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> @@ -21207,7 +21375,7 @@ index 8981b5e2f9..3661816f6d 100644 008: updated columns: ba i ia r ra 009: {"error":null,"result":[{"count":2}]} 010: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> -@@ -1273,7 +1276,7 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops], +@@ -1273,7 +1277,7 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops], 010: updated columns: s 010: updated columns: s 011: {"error":null,"result":[{"count":1}]} @@ -21216,6 +21384,52 @@ index 8981b5e2f9..3661816f6d 100644 013: reconnect 014: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> 014: i=1 r=123.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<0> +@@ -1331,6 +1335,18 @@ OVSDB_CHECK_IDL_PY([partial-map idl], + 009: done + ]]) + ++OVSDB_CHECK_IDL_PY([partial-map update set refmap idl], ++[['["idltest", {"op":"insert", "table":"simple3", "row":{"name":"myString1"}}, ++ {"op":"insert", "table":"simple5", "row":{"name":"myString2"}}]']], ++['partialmapmutateirefmap'], ++[[000: name=myString1 uset=[] ++000: name=myString2 irefmap=[] ++001: commit, status=success ++002: name=myString1 uset=[] ++002: name=myString2 irefmap=[(1 <0>)] ++003: done ++]]) ++ + m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN], + [AT_SETUP([$1 - C]) + AT_KEYWORDS([ovsdb server idl partial update set column positive $5]) +@@ -1414,6 +1430,26 @@ m4_define([OVSDB_CHECK_IDL_NOTIFY], + [OVSDB_CHECK_IDL_NOTIFY_PY($@) + OVSDB_CHECK_IDL_NOTIFY_SSL_PY($@)]) + ++OVSDB_CHECK_IDL_NOTIFY([simple link idl verify notify], ++ [['track-notify' \ ++ '["idltest", ++ {"op": "insert", ++ "table": "link1", ++ "row": {"i": 1, "k": ["named-uuid", "l1row"], "l2": ["set", [["named-uuid", "l2row"]]]}, ++ "uuid-name": "l1row"}, ++ {"op": "insert", ++ "table": "link2", ++ "uuid-name": "l2row", ++ "row": {"i": 2, "l1": ["set", [["named-uuid", "l1row"]]]}}]']], ++[[000: empty ++001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} ++002: event:create, row={i=1 uuid=<0> l2=[<1>]}, updates=None ++002: event:create, row={i=2 uuid=<1> l1=[<0>]}, updates=None ++002: i=1 k=1 ka=[] l2=2 uuid=<0> ++002: i=2 l1=1 uuid=<1> ++003: done ++]]) ++ + OVSDB_CHECK_IDL_NOTIFY([simple idl verify notify], + [['track-notify' \ + '["idltest", diff --git a/tests/ovsdb-replication.at b/tests/ovsdb-replication.at index f81381bdb3..82c4160529 100644 --- a/tests/ovsdb-replication.at @@ -21648,6 +21862,92 @@ index 187eb28671..c49f084b5f 100644 ovsdb_idl_track_clear(idl); } else { print_idl(idl, step++); +diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py +index 1d7c023da2..4e6cfb6eb5 100644 +--- a/tests/test-ovsdb.py ++++ b/tests/test-ovsdb.py +@@ -30,6 +30,7 @@ import ovs.util + import ovs.vlog + from ovs.db import data + from ovs.db import error ++from ovs.db.idl import _row_to_uuid as row_to_uuid + from ovs.fatal_signal import signal_alarm + + import six +@@ -163,7 +164,10 @@ def get_simple_printable_row_string(row, columns): + is ovs.db.data.Atom): + value = getattr(row, column) + if isinstance(value, dict): +- value = sorted(value.items()) ++ value = sorted((row_to_uuid(k), row_to_uuid(v)) ++ for k, v in value.items()) ++ if isinstance(value, (list, tuple)): ++ value = sorted((row_to_uuid(v) for v in value)) + s += "%s=%s " % (column, value) + s = s.strip() + s = re.sub('""|,|u?\'', "", s) +@@ -174,9 +178,10 @@ def get_simple_printable_row_string(row, columns): + return s + + +-def get_simple_table_printable_row(row): ++def get_simple_table_printable_row(row, *additional_columns): + simple_columns = ["i", "r", "b", "s", "u", "ia", + "ra", "ba", "sa", "ua", "uuid"] ++ simple_columns.extend(additional_columns) + return get_simple_printable_row_string(row, simple_columns) + + +@@ -216,6 +221,14 @@ def print_idl(idl, step): + print(s) + n += 1 + ++ if "simple5" in idl.tables: ++ simple5 = idl.tables["simple5"].rows ++ for row in simple5.values(): ++ s = "%03d: " % step ++ s += get_simple_printable_row_string(row, ["name", "irefmap"]) ++ print(s) ++ n += 1 ++ + if "link1" in idl.tables: + l1 = idl.tables["link1"].rows + for row in six.itervalues(l1): +@@ -307,6 +320,11 @@ def idltest_find_simple3(idl, i): + return next(idl.index_equal("simple3", "simple3_by_name", i), None) + + ++def idltest_find(idl, table, col, match): ++ return next((r for r in idl.tables[table].rows.values() if ++ getattr(r, col) == match), None) ++ ++ + def idl_set(idl, commands, step): + txn = ovs.db.idl.Transaction(idl) + increment = False +@@ -531,6 +549,12 @@ def idl_set(idl, commands, step): + setattr(new_row3, 'name', 'String3') + new_row3.addvalue('uset', new_row41.uuid) + assert len(getattr(new_row3, 'uset', [])) == 1 ++ elif name == 'partialmapmutateirefmap': ++ row3 = idltest_find_simple3(idl, "myString1") ++ row5 = idltest_find(idl, "simple5", "name", "myString2") ++ row5.setkey('irefmap', 1, row3.uuid) ++ maplen = len(row5.irefmap) ++ assert maplen == 1, "expected 1, got %d" % maplen + else: + sys.stderr.write("unknown command %s\n" % name) + sys.exit(1) +@@ -623,7 +647,8 @@ def do_idl(schema_file, remote, *commands): + def mock_notify(event, row, updates=None): + output = "%03d: " % step + output += "event:" + str(event) + ", row={" +- output += get_simple_table_printable_row(row) + "}, updates=" ++ output += get_simple_table_printable_row(row, ++ 'l2', 'l1') + "}, updates=" + if updates is None: + output += "None" + else: diff --git a/tests/test-sha1.c b/tests/test-sha1.c index b7279db6aa..cc80888a7d 100644 --- a/tests/test-sha1.c diff --git a/SPECS/openvswitch2.11.spec b/SPECS/openvswitch2.11.spec index 6387b95..310917e 100644 --- a/SPECS/openvswitch2.11.spec +++ b/SPECS/openvswitch2.11.spec @@ -66,7 +66,7 @@ Summary: Open vSwitch Group: System Environment/Daemons daemon/database/utilities URL: http://www.openvswitch.org/ Version: 2.11.3 -Release: 86%{?dist} +Release: 87%{?dist} # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the # lib/sflow*.[ch] files are SISSL @@ -745,6 +745,10 @@ exit 0 %changelog +* Wed Mar 17 2021 Open vSwitch CI - 2.11.3-87 +- Merging upstream branch-2.11 + [560df0228cb3c4cdc19c5d670e6708fe28f09f11] + * Tue Mar 16 2021 Open vSwitch CI - 2.11.3-86 - Merging upstream branch-2.11 [67070c0625be3ba1bb178a4003512da416076a84]