From 6ccd5cbb22b01a178075e33d681da2b615a7e869 Mon Sep 17 00:00:00 2001 From: Dave Tucker Date: Tue, 5 Oct 2021 19:58:43 +0100 Subject: [PATCH] server: Fix diff of non-normalized fields Since there are many valid ways of notating a Set with min: 0 and max: 1 we could encounter values in the diff function that aren't OvsSet. It's easier to convert this to a normalized value using NativeToOvs than to update the diff logic. Signed-off-by: Dave Tucker --- server/transact.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/transact.go b/server/transact.go index 21d3d1bc..a3f9575b 100644 --- a/server/transact.go +++ b/server/transact.go @@ -251,7 +251,13 @@ func (o *OvsdbServer) Update(database, table string, where []ovsdb.Condition, ro if err != nil { panic(err) } - rowDelta[column] = diff(oldValue, value) + // convert the native to an ovs value + // since the value in the RowUpdate hasn't been normalized + newValue, err := ovsdb.NativeToOvs(colSchema, native) + if err != nil { + panic(err) + } + rowDelta[column] = diff(oldValue, newValue) } newRow, err := m.NewRow(table, new)