Skip to content

Commit 74d90c2

Browse files
umagohzhou8
authored andcommitted
ovn-controller to no longer monitor Chassis' external_ids
Prior to this patch, the external_ids column from the Chassis table were being used for two purposes: 1. Holding configuration for the OVN (copied by ovn-controller from the local OVS database) 2. Holding information from external systems (the main purpose of the external_ids column across other resources). The problem with mixing these two use cases is that, ovn-controller should be aware of changes to the configuration and it would trigger flow re-computations upon those changes. It shouldn't care tho about the information from external systems but, since these two things were put together, CMSs writing things to the external_ids column of the Chassis were waking up ovn-controller to recompute flows. This patch is separating these two things by creating another column in the Chassis table called "other_config". This new table holds the OVN configuration that is copied over from the local OVS db leaving the external_ids column unmonitored and free for other systems to make use of it. This change also keeps things backward compatible by continuing to write the OVN configuration to the external_ids column for external systems that may be reading them from there but, that column is no longer monitored so it won't generate any events. This behavior should be temporary and removed in the future. The note in the NEWS file and comments in the code itself points to the future removal of this behavior. Reported-At: https://bugzilla.redhat.com/show_bug.cgi?id=1824220 Signed-off-by: Lucas Alvares Gomes <[email protected]> Acked-by: Dumitru Ceara <[email protected]> Signed-off-by: Han Zhou <[email protected]>
1 parent d9ed450 commit 74d90c2

File tree

14 files changed

+84
-54
lines changed

14 files changed

+84
-54
lines changed

NEWS

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
Post-v20.03.0
22
--------------------------
33
- Added support for external_port_range in NAT table.
4-
4+
- ovn-controller no longer monitor the external_ids column from
5+
the Chassis table. This was done to avoid having to do a flow
6+
recalculation every time external systems wrote to this column. The
7+
chassis configuration has now being moved to a new column called
8+
"other_config". As a note, the configurations are still be written to
9+
the external_ids column (but no longer triggers an alert) to
10+
keep the backward compatibility with current systems that may be
11+
reading it from that column but, this behavior will be removed
12+
in the future.
513

614
OVN v20.03.0 - xx xxx xxxx
715
--------------------------

TODO.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,7 @@ OVN To-do List
149149
* OVN Interconnection
150150

151151
* Packaging for RHEL, Debian, etc.
152+
153+
* ovn-controller: Stop copying the local OVS configuration into the
154+
Chassis external_ids column (same for the "is-remote" configuration from
155+
ovn-ic) a few releases after the 20.06 version (21.06 maybe ?).

controller/bfd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ bfd_calculate_chassis(
152152
/* It's an HA chassis. So add the ref_chassis to the bfd set. */
153153
for (size_t i = 0; i < ha_chassis_grp->n_ref_chassis; i++) {
154154
struct sbrec_chassis *ref_ch = ha_chassis_grp->ref_chassis[i];
155-
if (smap_get_bool(&ref_ch->external_ids, "is-remote", false)) {
155+
if (smap_get_bool(&ref_ch->other_config, "is-remote", false)) {
156156
continue;
157157
}
158158
sset_add(&grp_chassis, ref_ch->name);

controller/chassis.c

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -299,24 +299,24 @@ chassis_parse_ovs_config(const struct ovsrec_open_vswitch_table *ovs_table,
299299
}
300300

301301
static void
302-
chassis_build_external_ids(struct smap *ext_ids, const char *bridge_mappings,
302+
chassis_build_other_config(struct smap *config, const char *bridge_mappings,
303303
const char *datapath_type, const char *cms_options,
304304
const char *chassis_macs, const char *iface_types,
305305
bool is_interconn)
306306
{
307-
smap_replace(ext_ids, "ovn-bridge-mappings", bridge_mappings);
308-
smap_replace(ext_ids, "datapath-type", datapath_type);
309-
smap_replace(ext_ids, "ovn-cms-options", cms_options);
310-
smap_replace(ext_ids, "iface-types", iface_types);
311-
smap_replace(ext_ids, "ovn-chassis-mac-mappings", chassis_macs);
312-
smap_replace(ext_ids, "is-interconn", is_interconn ? "true" : "false");
307+
smap_replace(config, "ovn-bridge-mappings", bridge_mappings);
308+
smap_replace(config, "datapath-type", datapath_type);
309+
smap_replace(config, "ovn-cms-options", cms_options);
310+
smap_replace(config, "iface-types", iface_types);
311+
smap_replace(config, "ovn-chassis-mac-mappings", chassis_macs);
312+
smap_replace(config, "is-interconn", is_interconn ? "true" : "false");
313313
}
314314

315315
/*
316316
* Returns true if any external-id doesn't match the values in 'chassis-rec'.
317317
*/
318318
static bool
319-
chassis_external_ids_changed(const char *bridge_mappings,
319+
chassis_other_config_changed(const char *bridge_mappings,
320320
const char *datapath_type,
321321
const char *cms_options,
322322
const char *chassis_macs,
@@ -325,41 +325,41 @@ chassis_external_ids_changed(const char *bridge_mappings,
325325
const struct sbrec_chassis *chassis_rec)
326326
{
327327
const char *chassis_bridge_mappings =
328-
get_bridge_mappings(&chassis_rec->external_ids);
328+
get_bridge_mappings(&chassis_rec->other_config);
329329

330330
if (strcmp(bridge_mappings, chassis_bridge_mappings)) {
331331
return true;
332332
}
333333

334334
const char *chassis_datapath_type =
335-
smap_get_def(&chassis_rec->external_ids, "datapath-type", "");
335+
smap_get_def(&chassis_rec->other_config, "datapath-type", "");
336336

337337
if (strcmp(datapath_type, chassis_datapath_type)) {
338338
return true;
339339
}
340340

341341
const char *chassis_cms_options =
342-
get_cms_options(&chassis_rec->external_ids);
342+
get_cms_options(&chassis_rec->other_config);
343343

344344
if (strcmp(cms_options, chassis_cms_options)) {
345345
return true;
346346
}
347347

348348
const char *chassis_mac_mappings =
349-
get_chassis_mac_mappings(&chassis_rec->external_ids);
349+
get_chassis_mac_mappings(&chassis_rec->other_config);
350350
if (strcmp(chassis_macs, chassis_mac_mappings)) {
351351
return true;
352352
}
353353

354354
const char *chassis_iface_types =
355-
smap_get_def(&chassis_rec->external_ids, "iface-types", "");
355+
smap_get_def(&chassis_rec->other_config, "iface-types", "");
356356

357357
if (strcmp(ds_cstr_ro(iface_types), chassis_iface_types)) {
358358
return true;
359359
}
360360

361361
bool chassis_is_interconn =
362-
smap_get_bool(&chassis_rec->external_ids, "is-interconn", false);
362+
smap_get_bool(&chassis_rec->other_config, "is-interconn", false);
363363
if (chassis_is_interconn != is_interconn) {
364364
return true;
365365
}
@@ -538,25 +538,29 @@ chassis_update(const struct sbrec_chassis *chassis_rec,
538538
sbrec_chassis_set_hostname(chassis_rec, ovs_cfg->hostname);
539539
}
540540

541-
if (chassis_external_ids_changed(ovs_cfg->bridge_mappings,
541+
if (chassis_other_config_changed(ovs_cfg->bridge_mappings,
542542
ovs_cfg->datapath_type,
543543
ovs_cfg->cms_options,
544544
ovs_cfg->chassis_macs,
545545
&ovs_cfg->iface_types,
546546
ovs_cfg->is_interconn,
547547
chassis_rec)) {
548-
struct smap ext_ids;
548+
struct smap other_config;
549549

550-
smap_clone(&ext_ids, &chassis_rec->external_ids);
551-
chassis_build_external_ids(&ext_ids, ovs_cfg->bridge_mappings,
550+
smap_clone(&other_config, &chassis_rec->other_config);
551+
chassis_build_other_config(&other_config, ovs_cfg->bridge_mappings,
552552
ovs_cfg->datapath_type,
553553
ovs_cfg->cms_options,
554554
ovs_cfg->chassis_macs,
555555
ds_cstr_ro(&ovs_cfg->iface_types),
556556
ovs_cfg->is_interconn);
557-
sbrec_chassis_verify_external_ids(chassis_rec);
558-
sbrec_chassis_set_external_ids(chassis_rec, &ext_ids);
559-
smap_destroy(&ext_ids);
557+
sbrec_chassis_verify_other_config(chassis_rec);
558+
sbrec_chassis_set_other_config(chassis_rec, &other_config);
559+
/* TODO(lucasagomes): Continue writing the configuration to the
560+
* external_ids column for backward compatibility with the current
561+
* systems, this behavior should be removed in the future. */
562+
sbrec_chassis_set_external_ids(chassis_rec, &other_config);
563+
smap_destroy(&other_config);
560564
}
561565

562566
update_chassis_transport_zones(transport_zones, chassis_rec);
@@ -626,7 +630,7 @@ chassis_get_mac(const struct sbrec_chassis *chassis_rec,
626630
struct eth_addr *chassis_mac)
627631
{
628632
const char *tokens
629-
= get_chassis_mac_mappings(&chassis_rec->external_ids);
633+
= get_chassis_mac_mappings(&chassis_rec->other_config);
630634
if (!tokens[0]) {
631635
return false;
632636
}

controller/encaps.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ encaps_run(struct ovsdb_idl_txn *ovs_idl_txn,
357357
continue;
358358
}
359359

360-
if (smap_get_bool(&chassis_rec->external_ids, "is-remote", false)
361-
&& !smap_get_bool(&this_chassis->external_ids, "is-interconn",
360+
if (smap_get_bool(&chassis_rec->other_config, "is-remote", false)
361+
&& !smap_get_bool(&this_chassis->other_config, "is-interconn",
362362
false)) {
363363
VLOG_DBG("Skipping encap creation for Chassis '%s' because "
364364
"it is remote but this chassis is not interconn.",

controller/ovn-controller.8.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@
245245
<dd>
246246
This value is read from local OVS integration bridge row of
247247
<ref table="Bridge" db="Open_vSwitch"/> table and populated in
248-
<ref key="datapath-type" table="Chassis" column="external_ids"
248+
<ref key="datapath-type" table="Chassis" column="other_config"
249249
db="OVN_Southbound"/> of the <ref table="Chassis" db="OVN_Southbound"/>
250250
table in the OVN_Southbound database.
251251
</dd>

controller/ovn-controller.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,10 +1811,6 @@ main(int argc, char *argv[])
18111811
* - DNS. pinctrl.c uses the external_ids column of DNS,
18121812
* which it shouldn't. This should be removed.
18131813
*
1814-
* - Chassis - chassis.c copies the chassis configuration from
1815-
* local open_vswitch table to the external_ids of
1816-
* chassis.
1817-
*
18181814
* - Datapath_binding - lflow.c is using this to check if the datapath
18191815
* is switch or not. This should be removed.
18201816
* */
@@ -1841,6 +1837,11 @@ main(int argc, char *argv[])
18411837
ovsdb_idl_omit(ovnsb_idl_loop.idl, &sbrec_connection_col_status);
18421838
ovsdb_idl_omit(ovnsb_idl_loop.idl, &sbrec_connection_col_target);
18431839

1840+
/* Omit alerts to the Chassis external_ids column, the configuration
1841+
* from the local open_vswitch table has now being moved to the
1842+
* other_config column so we no longer need to monitor it */
1843+
ovsdb_idl_omit_alert(ovnsb_idl_loop.idl, &sbrec_chassis_col_external_ids);
1844+
18441845
update_sb_monitors(ovnsb_idl_loop.idl, NULL, NULL, NULL, false);
18451846

18461847
stopwatch_create(CONTROLLER_LOOP_STOPWATCH_NAME, SW_MS);

controller/physical.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ populate_remote_chassis_macs(const struct sbrec_chassis *my_chassis,
424424
}
425425

426426
const char *tokens
427-
= get_chassis_mac_mappings(&chassis->external_ids);
427+
= get_chassis_mac_mappings(&chassis->other_config);
428428

429429
if (!strlen(tokens)) {
430430
continue;
@@ -1517,7 +1517,7 @@ physical_run(struct physical_ctx *p_ctx,
15171517
/*
15181518
* We split the tunnel_id to get the chassis-id
15191519
* and hash the tunnel list on the chassis-id. The
1520-
* reason to use the chassis-id alone is because
1520+
* reason to use the chassis-id alone is because
15211521
* there might be cases (multicast, gateway chassis)
15221522
* where we need to tunnel to the chassis, but won't
15231523
* have the encap-ip specifically.

ic/ovn-ic.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@ sync_isb_gw_to_sb(struct ic_context *ctx,
295295
const struct sbrec_chassis *chassis)
296296
{
297297
sbrec_chassis_set_hostname(chassis, gw->hostname);
298+
sbrec_chassis_update_other_config_setkey(chassis, "is-remote", "true");
299+
/* TODO(lucasagomes): Continue writing the configuration to the
300+
* external_ids column for backward compatibility with the current
301+
* systems, this behavior should be removed in the future. */
298302
sbrec_chassis_update_external_ids_setkey(chassis, "is-remote", "true");
299303

300304
/* Sync encaps used by this gateway. */
@@ -362,7 +366,7 @@ gateway_run(struct ic_context *ctx, const struct icsbrec_availability_zone *az)
362366

363367
const struct sbrec_chassis *chassis;
364368
SBREC_CHASSIS_FOR_EACH (chassis, ctx->ovnsb_idl) {
365-
if (smap_get_bool(&chassis->external_ids, "is-interconn", false)) {
369+
if (smap_get_bool(&chassis->other_config, "is-interconn", false)) {
366370
gw = shash_find_and_delete(&local_gws, chassis->name);
367371
if (!gw) {
368372
gw = icsbrec_gateway_insert(ctx->ovnisb_txn);
@@ -372,7 +376,7 @@ gateway_run(struct ic_context *ctx, const struct icsbrec_availability_zone *az)
372376
} else if (is_gateway_data_changed(gw, chassis)) {
373377
sync_sb_gw_to_isb(ctx, chassis, gw);
374378
}
375-
} else if (smap_get_bool(&chassis->external_ids, "is-remote", false)) {
379+
} else if (smap_get_bool(&chassis->other_config, "is-remote", false)) {
376380
gw = shash_find_and_delete(&remote_gws, chassis->name);
377381
if (!gw) {
378382
sbrec_chassis_delete(chassis);

northd/ovn-northd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11616,7 +11616,7 @@ update_northbound_cfg(struct northd_context *ctx,
1161611616
const struct sbrec_chassis *chassis;
1161711617
int64_t hv_cfg = nbg->nb_cfg;
1161811618
SBREC_CHASSIS_FOR_EACH (chassis, ctx->ovnsb_idl) {
11619-
if (!smap_get_bool(&chassis->external_ids, "is-remote", false) &&
11619+
if (!smap_get_bool(&chassis->other_config, "is-remote", false) &&
1162011620
chassis->nb_cfg < hv_cfg) {
1162111621
hv_cfg = chassis->nb_cfg;
1162211622
}
@@ -11901,7 +11901,7 @@ main(int argc, char *argv[])
1190111901
ovsdb_idl_add_table(ovnsb_idl_loop.idl, &sbrec_table_chassis);
1190211902
ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_chassis_col_nb_cfg);
1190311903
ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_chassis_col_name);
11904-
ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_chassis_col_external_ids);
11904+
ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_chassis_col_other_config);
1190511905

1190611906
ovsdb_idl_add_table(ovnsb_idl_loop.idl, &sbrec_table_ha_chassis);
1190711907
add_column_noalert(ovnsb_idl_loop.idl,

0 commit comments

Comments
 (0)