On Wed, Apr 12, 2023 at 8:01 AM <[email protected]> wrote:
>
> From: Lucas Alvares Gomes <[email protected]>
>
> In order for the CMS to know which Chassis a distributed gateway port
> is bond to, this patch updates the ovn-northd daemon to populate the
> Logical_Router_Port table with that information.
>
> To avoid changing the database schema, ovn-northd is setting a new key
> called "hosting-chassis" in the options column from the LRP table. This
> key value points to the name of the Chassis that is currently hosting
> the distributed port.
>
> Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2107515
> Signed-off-by: Lucas Alvares Gomes <[email protected]>
Thanks Lucas for the patch. However, in my opinion the chassis binding
information belongs to SB and should stay there, otherwise we would make it
consistent for LSPs and update the chassis information for them, too, which
I think is not good in terms of clarity and extra control plane load. We'd
better keep the separation between NB and SB clear and avoid propagating
data between them back-and-forth.
For the problem mentioned in the bugzilla, it seems to me already a scale
challenge that something other than ovn-controller is connecting to OVN SB
from every node (if I understand correctly). Moving all these connections
from SB to NB may just make it much worse, because NB DB is usually more
heavily/frequently updated by the CMS. (For small scale, this may not
matter, even if the agent connects to both NB and SB.)
Thanks,
Han
> ---
> northd/northd.c | 28 ++++++++++++++++++++++++++++
> ovn-nb.xml | 15 +++++++++++++++
> tests/ovn-northd.at | 34 ++++++++++++++++++++++++++++++++++
> 3 files changed, 77 insertions(+)
>
> diff --git a/northd/northd.c b/northd/northd.c
> index fda02c324..667d8358c 100644
> --- a/northd/northd.c
> +++ b/northd/northd.c
> @@ -16440,6 +16440,34 @@ handle_port_binding_changes(struct northd_input
*input_data,
>
> SBREC_PORT_BINDING_TABLE_FOR_EACH (sb,
>
input_data->sbrec_port_binding_table) {
> +
> + /* Look for a chassisredirect binding and set the
"active-chassis"
> + * option in the NBDB logical_router_port table indicating on
which
> + * chassis the distributed port is bond to. */
> + if (!strcmp(sb->type, "chassisredirect")) {
> + const char *dist_port =
> + smap_get(&sb->options, "distributed-port");
> + if (dist_port) {
> + struct ovn_port *router_port =
> + ovn_port_find(ports, dist_port);
> + if (router_port) {
> + struct smap options;
> + smap_clone(&options, &router_port->nbrp->options);
> + if (sb->chassis) {
> + smap_replace(&options, "hosting-chassis",
> + sb->chassis->name);
> + } else {
> + smap_remove(&options, "hosting-chassis");
> + }
> +
nbrec_logical_router_port_set_options(router_port->nbrp,
> + &options);
> + }
> + }
> + /* Continue since there are no matching logical port for
> + * chassisredirect bindings */
> + continue;
> + }
> +
> struct ovn_port *op = ovn_port_find(ports, sb->logical_port);
>
> if (!op || !op->nbsp) {
> diff --git a/ovn-nb.xml b/ovn-nb.xml
> index 73f707aa0..fcb03a5c6 100644
> --- a/ovn-nb.xml
> +++ b/ovn-nb.xml
> @@ -2993,6 +2993,21 @@ or
> port on the logical router. It is otherwise ignored.
> </p>
> </column>
> +
> + <column name="options" key="hosting-chassis">
> + <p>
> + This option is populated by <code>ovn-northd</code>, rather
> + than by the CMS plugin.
> + </p>
> +
> + <p>
> + When a distributed gateway port is bound to a location in
> + the OVN Southbound database
> + <ref db="OVN_Southbound" table="Port_Binding"/>
> + <code>ovn-northd</code> will populate this option with the
> + name of the Chassis that is currently hosting this port.
> + </p>
> + </column>
> </group>
> </group>
>
> diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
> index ef29233db..578a42eaf 100644
> --- a/tests/ovn-northd.at
> +++ b/tests/ovn-northd.at
> @@ -144,6 +144,40 @@ AT_CHECK([test x`ovn-nbctl lsp-get-up S1-R1` = xup])
> AT_CLEANUP
> ])
>
> +OVN_FOR_EACH_NORTHD_NO_HV([
> +AT_SETUP([check Logical Router Port hosting-chassis option])
> +ovn_start
> +
> +check ovn-sbctl chassis-add ch1 geneve 127.0.0.2
> +
> +check ovn-nbctl lr-add lr1
> +check ovn-nbctl lrp-add lr1 lrp1 00:00:00:00:00:01 10.0.0.1/24
> +check ovn-nbctl ls-add ls1
> +check ovn-nbctl lsp-add ls1 lsp1 -- \
> + lsp-set-addresses lsp1 router -- \
> + lsp-set-type lsp1 router -- \
> + lsp-set-options lsp1 router-port=lrp1
> +
> +# make lrp a cr-port
> +check ovn-nbctl lrp-set-gateway-chassis lrp1 ch1
> +
> +ovn-nbctl --wait=sb sync
> +
> +wait_row_count Port_Binding 1 logical_port=cr-lrp1 \
> + options:always-redirect="true" options:distributed-port="lrp1"
> +
> +# Simulate cr-port being bound to ch1
> +ch1_uuid=`ovn-sbctl --bare --columns _uuid find Chassis name="ch1"`
> +ovn-sbctl set Port_Binding cr-lrp1 chassis=${ch1_uuid}
> +
> +ovn-nbctl --wait=sb sync
> +
> +# check for ther hosting-chassis option being set by northd
> +wait_row_count nb:Logical_Router_Port 1 name=lrp1
options:hosting-chassis=ch1
> +
> +AT_CLEANUP
> +])
> +
> OVN_FOR_EACH_NORTHD_NO_HV([
> AT_SETUP([check LRP external id propagation to SBDB])
> ovn_start
> --
> 2.40.0
>
> _______________________________________________
> 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