On 8/9/24 21:09, Ilya Maximets wrote:
> On 8/9/24 20:06, Rosemarie O'Riorden wrote:
>> Static_MAC_Binding (SMB) records are only deleted from the
>> southbound-db via ovn-northd when there is no such SMB found in the
>> northbound-db. This leads to problems when a port becomes stale (ex.
>> through lr deletion), because the Logical_Router and Logical_Router_Port
>> records are removed from the nb-db, but not the Static_MAC_Binding record.
>>
>> So, when ovn-northd attempts to remove the corresponding
>> Datapath_Binding and Port_Binding records from sb-db, it fails because
>> of a referential integrity violation: the Static_MAC_Binding record
>> contains a reference to Datapath_Binding.
>>
>> The corrected behavior is that SMB's are now deleted:
>> 1. when there's no such SMB in the nb-db, and
>> 2. when there is no port in the nb-db with the SMB's associated port name.
>> Thus, all three records, Datapath_Binding, Port_Binding, and
>> Static_MAC_Binding, are removed within the same transaction.
>>
>> Also added a unit test to verify correct behavior.
>>
>> Fixes: b22684d4e37c ("Add a northbound interface to program MAC_Binding 
>> table")
>> Reported-at: https://issues.redhat.com/browse/FDP-723
>> Signed-off-by: Rosemarie O'Riorden <[email protected]>
>> ---
>> v3:
>>  - Fixed checkpatch errors.
>> v2:
>>  - Simplified/neatened code in northd/northd.c, kept logic the same.
>> ---
>>  northd/northd.c     |  9 ++++++++-
>>  tests/ovn-northd.at | 13 +++++++++++++
>>  2 files changed, 21 insertions(+), 1 deletion(-)
>>
>> diff --git a/northd/northd.c b/northd/northd.c
>> index 0c73e70df..c0773c2c4 100644
>> --- a/northd/northd.c
>> +++ b/northd/northd.c
>> @@ -18336,7 +18336,8 @@ build_static_mac_binding_table(
>>      struct hmap *lr_ports)
>>  {
>>      /* Cleanup SB Static_MAC_Binding entries which do not have corresponding
>> -     * NB Static_MAC_Binding entries. */
>> +     * NB Static_MAC_Binding entries, and SB Static_MAC_Binding entries for
>> +     * which there is not a NB Port_Binding of the same name. */
> 
> NB doesn't have a Port_Binding table, so it should probably be
> Logical_Router_Port instead.
> 
> Maybe maintainers can fix this up while applying the change.
> 

Done, I fixed it up.

> The rest looks good to me.  Thanks!
> 
> Acked-by: Ilya Maximets <[email protected]>
> 

Thanks Rosemarie and Ilya!  Applied to main and backported to all stable
branches down to 23.06.

Regards,
Dumitru


_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to