On Fri, Feb 19, 2021 at 6:07 AM Mark Michelson <[email protected]> wrote: > > Acked-by: Mark Michelson <[email protected]>
Thanks for the review. I applied the patch to master and backported to all the branches. Numan > > On 2/12/21 2:21 AM, [email protected] wrote: > > From: Numan Siddique <[email protected]> > > > > If an external logical port 'sw0-p1' is associated with an > > ha_chassis_group and later CMS runs a command to clear the > > ha_chassis_group and set the type to normal in the same > > transaction, i.e > > > > ovn-nbctl clear logical_switch_port sw0-p1 ha_chassis_group -- \ > > set logical_switch_port sw0-p1 'type=""' > > > > then, ovn-northd goes into a continous loop trying to delete the > > ha_chassis_group in SB DB . ovn-northd doesn't clear the > > ha_chassis_group of the port binding sw0-p1 in the SB DB and > > hence the constraint violation is seen. > > > > This issue is seen when lport sw0-p1 is the only one referencing > > the ha_chassis_group in SB DB. This patch fixes this issue. > > > > Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1927369 > > Reported-by: Jakub Libosvar <[email protected]> > > Signed-off-by: Numan Siddique <[email protected]> > > --- > > northd/ovn-northd.c | 6 ++++++ > > tests/ovn-northd.at | 47 ++++++++++++++++++++++++++++++++++++++++++--- > > 2 files changed, 50 insertions(+), 3 deletions(-) > > > > diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c > > index b2b5f6a1b..83af4464c 100644 > > --- a/northd/ovn-northd.c > > +++ b/northd/ovn-northd.c > > @@ -2976,6 +2976,12 @@ ovn_port_update_sbrec(struct northd_context *ctx, > > } else { > > sbrec_port_binding_set_ha_chassis_group(op->sb, NULL); > > } > > + } else if (op->sb->ha_chassis_group) { > > + /* Clear the port bindings ha_chassis_group if the type is > > + * not external and if this column is set. This can happen > > + * when an external port is reset to type normal and > > + * ha_chassis_group cleared in the same transaction. */ > > + sbrec_port_binding_set_ha_chassis_group(op->sb, NULL); > > } > > } else { > > const char *chassis = NULL; > > diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at > > index 64a788067..5af77470a 100644 > > --- a/tests/ovn-northd.at > > +++ b/tests/ovn-northd.at > > @@ -605,11 +605,12 @@ wait_row_count Port_Binding 0 logical_port=sw0-pext1 > > 'chassis!=[[]]' > > wait_row_count HA_Chassis_Group 1 name=hagrp1 > > wait_row_count HA_Chassis 3 > > > > -# Clear ha_chassis_group for sw0-pext2 > > -ovn-nbctl --wait=sb clear logical_switch_port sw0-pext2 ha_chassis_group > > +AS_BOX([Clear ha_chassis_group for sw0-pext2 and reset port type to normal > > in the same txn]) > > > > -wait_row_count Port_Binding 0 logical_port=sw0-pext2 'chassis!=[[]]' > > +check ovn-nbctl --wait=sb clear logical_switch_port sw0-pext2 \ > > +ha_chassis_group -- set logical_switch_port sw0-pext2 'type=""' > > wait_row_count HA_Chassis_Group 0 > > +wait_row_count Port_Binding 0 logical_port=sw0-pext2 'chassis!=[[]]' > > check_row_count HA_Chassis 0 > > > > as ovn-sb > > @@ -2520,3 +2521,43 @@ check ovn-sbctl set chassis hv1 > > other_config:port-up-notif=true > > wait_row_count nb:Logical_Switch_Port 1 up=false name=lsp1 > > > > AT_CLEANUP > > + > > +AT_SETUP([ovn -- HA chassis group cleanup for external port ]) > > +ovn_start > > + > > +check ovn-nbctl ls-add sw0 > > +check ovn-nbctl lsp-add sw0 sw0-p1 > > +check ovn-nbctl lsp-set-type sw0-p1 external > > + > > +check ovn-sbctl chassis-add ch1 geneve 127.0.0.1 > > +check ovn-sbctl chassis-add ch2 geneve 127.0.0.2 > > + > > +check ovn-nbctl ha-chassis-group-add hagrp1 > > +check ovn-nbctl ha-chassis-group-add-chassis hagrp1 ch1 20 > > +check ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch2 10 > > + > > +ha_grp1_uuid=$(fetch_column nb:ha_chassis_group _uuid) > > +echo "ha grp1 uuid = $ha_grp1_uuid" > > +ovn-nbctl list ha_chassis_group > > +check ovn-nbctl set logical_switch_port sw0-p1 > > ha_chassis_group=$ha_grp1_uuid > > + > > +wait_row_count ha_chassis_group 1 > > +check ovn-nbctl clear logical_switch_port sw0-p1 ha_chassis_group > > +wait_row_count ha_chassis_group 0 > > + > > +check ovn-nbctl set logical_switch_port sw0-p1 > > ha_chassis_group=$ha_grp1_uuid > > +wait_row_count ha_chassis_group 1 > > +sb_ha_grp1_uuid=$(fetch_column ha_chassis_group _uuid) > > + > > +echo > > +echo "__file__:__line__:Check that port_binding sw0-p1 has > > ha_chassis_group set" > > + > > +check_column "$sb_ha_grp1_uuid" Port_Binding ha_chassis_group > > logical_port=sw0-p1 > > + > > +AS_BOX([Clear ha_chassis_group for sw0-p1 and reset port type to normal > > port in the same txn]) > > + > > +check ovn-nbctl clear logical_switch_port sw0-p1 ha_chassis_group -- set > > logical_switch_port sw0-p1 'type=""' > > +wait_row_count ha_chassis_group 0 > > +check_column "" Port_Binding chassis logical_port=sw0-p1 > > + > > +AT_CLEANUP > > > > _______________________________________________ > dev mailing list > [email protected] > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
