ovsdb_datum has an important invariant (documented in the large comment
on the declaration of struct ovsdb_datum) that a lot of code relies upon:
keys must be unique and in sorted order. Most code that creates or
modifies ovsdb_datum structures maintains this invariant. However, the
"set" functions generated by ovsdb-idlc.in do not check or restore it.
This commit adds that checking.
This might fix an actual bug or two--none have been reported--but mostly it
is just to add some additional checking to avoid future subtle bugs.
if type.value:
print " " + type.value.copyCValue("datum.values[i].%s" % type.value.type, "%s[i]" % valueVar)
print " }"
+ if type.value:
+ valueType = type.value.toAtomicType()
+ else:
+ valueType = "OVSDB_TYPE_VOID"
+ print " ovsdb_datum_sort_unique(&datum, %s, %s);" % (
+ type.key.toAtomicType(), valueType)
print " ovsdb_idl_txn_write(&row->header_, &%(s)s_columns[%(S)s_COL_%(C)s], &datum);" \
% {'s': structName,
'S': structName.upper(),