@@ -18,17 +18,21 @@
#include <stdlib.h>
#include <stdio.h>
+/* OVS includes. */
#include "lib/svec.h"
#include "openvswitch/util.h"
+/* OVN includes. */
#include "en-lr-nat.h"
#include "en-lr-stateful.h"
#include "en-sync-sb.h"
+#include "lb.h"
#include "lib/inc-proc-eng.h"
#include "lib/lb.h"
#include "lib/ovn-nb-idl.h"
#include "lib/ovn-sb-idl.h"
#include "lib/ovn-util.h"
+#include "lflow-mgr.h"
#include "northd.h"
#include "openvswitch/vlog.h"
@@ -51,6 +55,40 @@ static void build_port_group_address_set(const struct nbrec_port_group *,
struct svec *ipv4_addrs,
struct svec *ipv6_addrs);
+struct sb_lb_table;
+struct sb_lb_record;
+static void sb_lb_table_init(struct sb_lb_table *);
+static void sb_lb_table_clear(struct sb_lb_table *);
+static void sb_lb_table_destroy(struct sb_lb_table *);
+
+static struct sb_lb_record *sb_lb_table_find(struct hmap *sb_lbs,
+ const struct uuid *);
+static void sb_lb_table_build_and_sync(struct sb_lb_table *,
+ struct ovsdb_idl_txn *ovnsb_txn,
+ const struct sbrec_load_balancer_table *,
+ const struct sbrec_logical_dp_group_table *,
+ struct hmap *lb_dps_map,
+ struct ovn_datapaths *ls_datapaths,
+ struct ovn_datapaths *lr_datapaths,
+ struct chassis_features *);
+static void sync_sb_lb_record(struct sb_lb_record *,
+ const struct sbrec_load_balancer *,
+ const struct sbrec_logical_dp_group_table *,
+ struct sb_lb_table *,
+ struct ovsdb_idl_txn *ovnsb_txn,
+ struct ovn_datapaths *ls_datapaths,
+ struct ovn_datapaths *lr_datapaths,
+ struct chassis_features *);
+static void sync_changed_lbs(struct sb_lb_table *,
+ struct ovsdb_idl_txn *ovnsb_txn,
+ const struct sbrec_load_balancer_table *,
+ const struct sbrec_logical_dp_group_table *,
+ struct tracked_lbs *,
+ struct ovn_datapaths *ls_datapaths,
+ struct ovn_datapaths *lr_datapaths,
+ struct chassis_features *);
+static bool check_sb_lb_duplicates(const struct sbrec_load_balancer_table *);
+
void *
en_sync_to_sb_init(struct engine_node *node OVS_UNUSED,
struct engine_arg *arg OVS_UNUSED)
@@ -206,49 +244,97 @@ sync_to_sb_addr_set_nb_port_group_handler(struct engine_node *node,
/* sync_to_sb_lb engine node functions.
* This engine node syncs the SB load balancers.
*/
+struct sb_lb_record {
+ struct hmap_node key_node; /* Index on 'nblb->header_.uuid'. */
+
+ struct ovn_lb_datapaths *lb_dps;
+ const struct sbrec_load_balancer *sbrec_lb;
+ struct ovn_dp_group *ls_dpg;
+ struct ovn_dp_group *lr_dpg;
+ struct uuid sb_uuid;
+};
+
+struct sb_lb_table {
+ struct hmap entries; /* Stores struct sb_lb_record. */
+ struct hmap ls_dp_groups;
+ struct hmap lr_dp_groups;
+};
+
+struct ed_type_sync_to_sb_lb_data {
+ struct sb_lb_table sb_lbs;
+};
+
void *
en_sync_to_sb_lb_init(struct engine_node *node OVS_UNUSED,
struct engine_arg *arg OVS_UNUSED)
{
- return NULL;
+ struct ed_type_sync_to_sb_lb_data *data = xzalloc(sizeof *data);
+ sb_lb_table_init(&data->sb_lbs);
+
+ return data;
}
void
-en_sync_to_sb_lb_run(struct engine_node *node, void *data OVS_UNUSED)
+en_sync_to_sb_lb_run(struct engine_node *node, void *data_)
{
+ struct northd_data *northd_data = engine_get_input_data("northd", node);
const struct sbrec_load_balancer_table *sb_load_balancer_table =
EN_OVSDB_GET(engine_get_input("SB_load_balancer", node));
+ const struct sbrec_logical_dp_group_table *sb_dpgrp_table =
+ EN_OVSDB_GET(engine_get_input("SB_logical_dp_group", node));
const struct engine_context *eng_ctx = engine_get_context();
- struct northd_data *northd_data = engine_get_input_data("northd", node);
+ struct ed_type_sync_to_sb_lb_data *data = data_;
+
+ sb_lb_table_clear(&data->sb_lbs);
+ sb_lb_table_build_and_sync(&data->sb_lbs, eng_ctx->ovnsb_idl_txn,
+ sb_load_balancer_table,
+ sb_dpgrp_table,
+ &northd_data->lb_datapaths_map,
+ &northd_data->ls_datapaths,
+ &northd_data->lr_datapaths,
+ &northd_data->features);
- sync_lbs(eng_ctx->ovnsb_idl_txn, sb_load_balancer_table,
- &northd_data->ls_datapaths, &northd_data->lr_datapaths,
- &northd_data->lb_datapaths_map, &northd_data->features);
engine_set_node_state(node, EN_UPDATED);
}
void
-en_sync_to_sb_lb_cleanup(void *data OVS_UNUSED)
+en_sync_to_sb_lb_cleanup(void *data_)
{
-
+ struct ed_type_sync_to_sb_lb_data *data = data_;
+ sb_lb_table_destroy(&data->sb_lbs);
}
bool
-sync_to_sb_lb_northd_handler(struct engine_node *node, void *data OVS_UNUSED)
+sync_to_sb_lb_northd_handler(struct engine_node *node, void *data_)
{
struct northd_data *nd = engine_get_input_data("northd", node);
- if (!northd_has_tracked_data(&nd->trk_data) ||
- northd_has_lbs_in_tracked_data(&nd->trk_data)) {
+ if (!northd_has_tracked_data(&nd->trk_data)) {
/* Return false if no tracking data or if lbs changed. */
return false;
}
+ if (!northd_has_lbs_in_tracked_data(&nd->trk_data)) {
+ return true;
+ }
- /* There are only NB LSP related changes and these can be safely
- * ignore and returned true. However in case the northd engine
- * tracking data includes other changes, we need to do additional
- * checks before safely ignoring. */
+ const struct engine_context *eng_ctx = engine_get_context();
+ if (!eng_ctx->ovnsb_idl_txn) {
+ return false;
+ }
+
+ const struct sbrec_logical_dp_group_table *sb_dpgrp_table =
+ EN_OVSDB_GET(engine_get_input("SB_logical_dp_group", node));
+ const struct sbrec_load_balancer_table *sb_lb_table =
+ EN_OVSDB_GET(engine_get_input("SB_load_balancer", node));
+ struct ed_type_sync_to_sb_lb_data *data = data_;
+
+ sync_changed_lbs(&data->sb_lbs, eng_ctx->ovnsb_idl_txn, sb_lb_table,
+ sb_dpgrp_table, &nd->trk_data.trk_lbs,
+ &nd->ls_datapaths, &nd->lr_datapaths,
+ &nd->features);
+
+ engine_set_node_state(node, EN_UPDATED);
return true;
}
@@ -519,3 +605,341 @@ sb_address_set_lookup_by_name(struct ovsdb_idl_index *sbrec_addr_set_by_name,
return retval;
}
+
+/* static functions related to sync_to_sb_lb */
+
+static void
+sb_lb_table_init(struct sb_lb_table *sb_lbs)
+{
+ hmap_init(&sb_lbs->entries);
+ ovn_dp_groups_init(&sb_lbs->ls_dp_groups);
+ ovn_dp_groups_init(&sb_lbs->lr_dp_groups);
+}
+
+static void
+sb_lb_table_clear(struct sb_lb_table *sb_lbs)
+{
+ struct sb_lb_record *sb_lb;
+ HMAP_FOR_EACH_POP (sb_lb, key_node, &sb_lbs->entries) {
+ free(sb_lb);
+ }
+
+ ovn_dp_groups_clear(&sb_lbs->ls_dp_groups);
+ ovn_dp_groups_clear(&sb_lbs->lr_dp_groups);
+}
+
+static void
+sb_lb_table_destroy(struct sb_lb_table *sb_lbs)
+{
+ sb_lb_table_clear(sb_lbs);
+ hmap_destroy(&sb_lbs->entries);
+ ovn_dp_groups_destroy(&sb_lbs->ls_dp_groups);
+ ovn_dp_groups_destroy(&sb_lbs->lr_dp_groups);
+}
+
+static struct sb_lb_record *
+sb_lb_table_find(struct hmap *sb_lbs, const struct uuid *lb_uuid)
+{
+ struct sb_lb_record *sb_lb;
+ HMAP_FOR_EACH_WITH_HASH (sb_lb, key_node, uuid_hash(lb_uuid),
+ sb_lbs) {
+ if (uuid_equals(&sb_lb->lb_dps->lb->nlb->header_.uuid, lb_uuid)) {
+ return sb_lb;
+ }
+ }
+
+ return NULL;
+}
+
+static void
+sb_lb_table_build_and_sync(struct sb_lb_table *sb_lbs,
+ struct ovsdb_idl_txn *ovnsb_txn,
+ const struct sbrec_load_balancer_table *sb_lb_table,
+ const struct sbrec_logical_dp_group_table *sb_dpgrp_table,
+ struct hmap *lb_dps_map,
+ struct ovn_datapaths *ls_datapaths,
+ struct ovn_datapaths *lr_datapaths,
+ struct chassis_features *chassis_features)
+{
+ struct hmap tmp_sb_lbs = HMAP_INITIALIZER(&tmp_sb_lbs);
+ struct ovn_lb_datapaths *lb_dps;
+ struct sb_lb_record *sb_lb;
+
+ HMAP_FOR_EACH (lb_dps, hmap_node, lb_dps_map) {
+ if (!lb_dps->n_nb_ls && !lb_dps->n_nb_lr) {
+ continue;
+ }
+
+ sb_lb = xzalloc(sizeof *sb_lb);
+ sb_lb->lb_dps = lb_dps;
+ hmap_insert(&tmp_sb_lbs, &sb_lb->key_node,
+ uuid_hash(&lb_dps->lb->nlb->header_.uuid));
+ }
+
+ const struct sbrec_load_balancer *sbrec_lb;
+ SBREC_LOAD_BALANCER_TABLE_FOR_EACH_SAFE (sbrec_lb,
+ sb_lb_table) {
+ const char *nb_lb_uuid = smap_get(&sbrec_lb->external_ids, "lb_id");
+ struct uuid lb_uuid;
+ if (!nb_lb_uuid || !uuid_from_string(&lb_uuid, nb_lb_uuid)) {
+ sbrec_load_balancer_delete(sbrec_lb);
+ continue;
+ }
+
+ sb_lb = sb_lb_table_find(&tmp_sb_lbs, &lb_uuid);
+ if (sb_lb) {
+ sb_lb->sbrec_lb = sbrec_lb;
+ sync_sb_lb_record(sb_lb, sbrec_lb, sb_dpgrp_table, sb_lbs,
+ ovnsb_txn, ls_datapaths, lr_datapaths,
+ chassis_features);
+
+ hmap_remove(&tmp_sb_lbs, &sb_lb->key_node);
+ hmap_insert(&sb_lbs->entries, &sb_lb->key_node,
+ uuid_hash(&sb_lb->lb_dps->lb->nlb->header_.uuid));
+ } else {
+ sbrec_load_balancer_delete(sbrec_lb);
+ }
+ }
+
+ HMAP_FOR_EACH_POP (sb_lb, key_node, &tmp_sb_lbs) {
+ sync_sb_lb_record(sb_lb, NULL, sb_dpgrp_table, sb_lbs,
+ ovnsb_txn, ls_datapaths, lr_datapaths,
+ chassis_features);
+ hmap_insert(&sb_lbs->entries, &sb_lb->key_node,
+ uuid_hash(&sb_lb->lb_dps->lb->nlb->header_.uuid));
+ }
+
+ hmap_destroy(&tmp_sb_lbs);
+}
+
+static void
+sync_sb_lb_record(struct sb_lb_record *sb_lb,
+ const struct sbrec_load_balancer *sbrec_lb,
+ const struct sbrec_logical_dp_group_table *sb_dpgrp_table,
+ struct sb_lb_table *sb_lbs,
+ struct ovsdb_idl_txn *ovnsb_txn,
+ struct ovn_datapaths *ls_datapaths,
+ struct ovn_datapaths *lr_datapaths,
+ struct chassis_features *chassis_features)
+{
+ struct sbrec_logical_dp_group *sbrec_ls_dp_group = NULL;
+ struct sbrec_logical_dp_group *sbrec_lr_dp_group = NULL;
+ const struct ovn_lb_datapaths *lb_dps;
+ struct ovn_dp_group *pre_sync_ls_dpg;
+ struct ovn_dp_group *pre_sync_lr_dpg;
+
+ lb_dps = sb_lb->lb_dps;
+ pre_sync_ls_dpg = sb_lb->ls_dpg;
+ pre_sync_lr_dpg = sb_lb->lr_dpg;
+
+ if (!sbrec_lb) {
+ sb_lb->sb_uuid = uuid_random();
+ sbrec_lb = sbrec_load_balancer_insert_persist_uuid(ovnsb_txn,
+ &sb_lb->sb_uuid);
+ char *lb_id = xasprintf(
+ UUID_FMT, UUID_ARGS(&lb_dps->lb->nlb->header_.uuid));
+ const struct smap external_ids =
+ SMAP_CONST1(&external_ids, "lb_id", lb_id);
+ sbrec_load_balancer_set_external_ids(sbrec_lb, &external_ids);
+ free(lb_id);
+ } else {
+ sb_lb->sb_uuid = sbrec_lb->header_.uuid;
+ sbrec_ls_dp_group =
+ chassis_features->ls_dpg_column
+ ? sbrec_lb->ls_datapath_group
+ : sbrec_lb->datapath_group; /* deprecated */
+
+ sbrec_lr_dp_group = sbrec_lb->lr_datapath_group;
+ }
+
+ if (lb_dps->n_nb_ls) {
+ sb_lb->ls_dpg = ovn_dp_group_get(&sb_lbs->ls_dp_groups,
+ lb_dps->n_nb_ls,
+ lb_dps->nb_ls_map,
+ ods_size(ls_datapaths));
+ if (sb_lb->ls_dpg) {
+ /* Update the dpg's sb dp_group. */
+ sb_lb->ls_dpg->dp_group =
+ sbrec_logical_dp_group_table_get_for_uuid(sb_dpgrp_table,
+ &sb_lb->ls_dpg->dpg_uuid);
+ ovs_assert(sb_lb->ls_dpg->dp_group);
+ } else {
+ sb_lb->ls_dpg = ovn_dp_group_create(
+ ovnsb_txn, &sb_lbs->ls_dp_groups,
+ sbrec_ls_dp_group,
+ lb_dps->n_nb_ls, lb_dps->nb_ls_map,
+ ods_size(ls_datapaths), true,
+ ls_datapaths,
+ lr_datapaths);
+ }
+
+ if (chassis_features->ls_dpg_column) {
+ sbrec_load_balancer_set_ls_datapath_group(sbrec_lb,
+ sb_lb->ls_dpg->dp_group);
+ sbrec_load_balancer_set_datapath_group(sbrec_lb, NULL);
+ } else {
+ /* datapath_group column is deprecated. */
+ sbrec_load_balancer_set_ls_datapath_group(sbrec_lb, NULL);
+ sbrec_load_balancer_set_datapath_group(sbrec_lb,
+ sb_lb->ls_dpg->dp_group);
+
+ }
+ } else {
+ sbrec_load_balancer_set_ls_datapath_group(sbrec_lb, NULL);
+ sbrec_load_balancer_set_datapath_group(sbrec_lb, NULL);
+ }
+
+
+ if (lb_dps->n_nb_lr) {
+ sb_lb->lr_dpg = ovn_dp_group_get(&sb_lbs->lr_dp_groups,
+ lb_dps->n_nb_lr,
+ lb_dps->nb_lr_map,
+ ods_size(lr_datapaths));
+ if (sb_lb->lr_dpg) {
+ /* Update the dpg's sb dp_group. */
+ sb_lb->lr_dpg->dp_group =
+ sbrec_logical_dp_group_table_get_for_uuid(sb_dpgrp_table,
+ &sb_lb->lr_dpg->dpg_uuid);
+ ovs_assert(sb_lb->lr_dpg->dp_group);
+ } else {
+ sb_lb->lr_dpg = ovn_dp_group_create(
+ ovnsb_txn, &sb_lbs->lr_dp_groups,
+ sbrec_lr_dp_group,
+ lb_dps->n_nb_lr, lb_dps->nb_lr_map,
+ ods_size(lr_datapaths), false,
+ ls_datapaths,
+ lr_datapaths);
+ }
+
+ sbrec_load_balancer_set_lr_datapath_group(sbrec_lb,
+ sb_lb->lr_dpg->dp_group);
+ } else {
+ sbrec_load_balancer_set_lr_datapath_group(sbrec_lb, NULL);
+ }
+
+ if (pre_sync_ls_dpg != sb_lb->ls_dpg) {
+ if (sb_lb->ls_dpg) {
+ inc_ovn_dp_group_ref(sb_lb->ls_dpg);
+ }
+ if (pre_sync_ls_dpg) {
+ dec_ovn_dp_group_ref(&sb_lbs->ls_dp_groups, pre_sync_ls_dpg);
+ }
+ }
+
+ if (pre_sync_lr_dpg != sb_lb->lr_dpg) {
+ if (sb_lb->lr_dpg) {
+ inc_ovn_dp_group_ref(sb_lb->lr_dpg);
+ }
+ if (pre_sync_lr_dpg) {
+ dec_ovn_dp_group_ref(&sb_lbs->lr_dp_groups, pre_sync_lr_dpg);
+ }
+ }
+
+ /* Update columns. */
+ sbrec_load_balancer_set_name(sbrec_lb, lb_dps->lb->nlb->name);
+ sbrec_load_balancer_set_vips(sbrec_lb,
+ ovn_northd_lb_get_vips(lb_dps->lb));
+ sbrec_load_balancer_set_protocol(sbrec_lb, lb_dps->lb->nlb->protocol);
+
+ /* Store the fact that northd provides the original (destination IP +
+ * transport port) tuple.
+ */
+ struct smap options;
+ smap_clone(&options, &lb_dps->lb->nlb->options);
+ smap_replace(&options, "hairpin_orig_tuple", "true");
+ sbrec_load_balancer_set_options(sbrec_lb, &options);
+ /* Clearing 'datapaths' column, since 'dp_group' is in use. */
+ sbrec_load_balancer_set_datapaths(sbrec_lb, NULL, 0);
+ smap_destroy(&options);
+}
+
+static void
+sync_changed_lbs(struct sb_lb_table *sb_lbs,
+ struct ovsdb_idl_txn *ovnsb_txn,
+ const struct sbrec_load_balancer_table *sb_lb_table,
+ const struct sbrec_logical_dp_group_table *sb_dpgrp_table,
+ struct tracked_lbs *trk_lbs,
+ struct ovn_datapaths *ls_datapaths,
+ struct ovn_datapaths *lr_datapaths,
+ struct chassis_features *chassis_features)
+{
+ struct ovn_lb_datapaths *lb_dps;
+ struct hmapx_node *hmapx_node;
+ struct sb_lb_record *sb_lb;
+
+ HMAPX_FOR_EACH (hmapx_node, &trk_lbs->deleted) {
+ lb_dps = hmapx_node->data;
+
+ sb_lb = sb_lb_table_find(&sb_lbs->entries,
+ &lb_dps->lb->nlb->header_.uuid);
+ if (sb_lb) {
+ const struct sbrec_load_balancer *sbrec_lb =
+ sbrec_load_balancer_table_get_for_uuid(sb_lb_table,
+ &sb_lb->sb_uuid);
+ if (sbrec_lb) {
+ sbrec_load_balancer_delete(sbrec_lb);
+ }
+
+ hmap_remove(&sb_lbs->entries, &sb_lb->key_node);
+ free(sb_lb);
+ }
+ }
+
+ HMAPX_FOR_EACH (hmapx_node, &trk_lbs->crupdated) {
+ lb_dps = hmapx_node->data;
+
+ sb_lb = sb_lb_table_find(&sb_lbs->entries,
+ &lb_dps->lb->nlb->header_.uuid);
+
+ if (!sb_lb && !lb_dps->n_nb_ls && !lb_dps->n_nb_lr) {
+ continue;
+ }
+
+ if (!sb_lb) {
+ sb_lb = xzalloc(sizeof *sb_lb);
+ sb_lb->lb_dps = lb_dps;
+ hmap_insert(&sb_lbs->entries, &sb_lb->key_node,
+ uuid_hash(&lb_dps->lb->nlb->header_.uuid));
+ } else {
+ sb_lb->sbrec_lb =
+ sbrec_load_balancer_table_get_for_uuid(sb_lb_table,
+ &sb_lb->sb_uuid);
+ }
+
+ if (sb_lb && !lb_dps->n_nb_ls && !lb_dps->n_nb_lr) {
+ const struct sbrec_load_balancer *sbrec_lb =
+ sbrec_load_balancer_table_get_for_uuid(sb_lb_table,
+ &sb_lb->sb_uuid);
+ if (sbrec_lb) {
+ sbrec_load_balancer_delete(sbrec_lb);
+ }
+
+ hmap_remove(&sb_lbs->entries, &sb_lb->key_node);
+ free(sb_lb);
+ }
+
+ sync_sb_lb_record(sb_lb, sb_lb->sbrec_lb, sb_dpgrp_table, sb_lbs,
+ ovnsb_txn, ls_datapaths, lr_datapaths,
+ chassis_features);
+ }
+}
+
+static bool
+check_sb_lb_duplicates(const struct sbrec_load_balancer_table *table)
+{
+ struct sset existing_nb_lb_uuids =
+ SSET_INITIALIZER(&existing_nb_lb_uuids);
+ const struct sbrec_load_balancer *sbrec_lb;
+ bool duplicates = false;
+
+ SBREC_LOAD_BALANCER_TABLE_FOR_EACH (sbrec_lb, table) {
+ const char *nb_lb_uuid = smap_get(&sbrec_lb->external_ids, "lb_id");
+ if (nb_lb_uuid && !sset_add(&existing_nb_lb_uuids, nb_lb_uuid)) {
+ duplicates = true;
+ break;
+ }
+ }
+
+ sset_destroy(&existing_nb_lb_uuids);
+ return duplicates;
+}
@@ -264,6 +264,7 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
sync_to_sb_lb_northd_handler);
engine_add_input(&en_sync_to_sb_lb, &en_sb_load_balancer,
sync_to_sb_lb_sb_load_balancer);
+ engine_add_input(&en_sync_to_sb_lb, &en_sb_logical_dp_group, NULL);
engine_add_input(&en_sync_to_sb_pb, &en_northd,
sync_to_sb_pb_northd_handler);
@@ -70,21 +70,6 @@ static struct ovs_mutex *lflow_hash_lock(const struct hmap *lflow_table,
uint32_t hash);
static void lflow_hash_unlock(struct ovs_mutex *hash_lock);
-static struct ovn_dp_group *ovn_dp_group_get(
- struct hmap *dp_groups, size_t desired_n,
- const unsigned long *desired_bitmap,
- size_t bitmap_len);
-static struct ovn_dp_group *ovn_dp_group_create(
- struct ovsdb_idl_txn *ovnsb_txn, struct hmap *dp_groups,
- struct sbrec_logical_dp_group *, size_t desired_n,
- const unsigned long *desired_bitmap,
- size_t bitmap_len, bool is_switch,
- const struct ovn_datapaths *ls_datapaths,
- const struct ovn_datapaths *lr_datapaths);
-static struct ovn_dp_group *ovn_dp_group_get(
- struct hmap *dp_groups, size_t desired_n,
- const unsigned long *desired_bitmap,
- size_t bitmap_len);
static struct sbrec_logical_dp_group *ovn_sb_insert_or_update_logical_dp_group(
struct ovsdb_idl_txn *ovnsb_txn,
struct sbrec_logical_dp_group *,
@@ -567,31 +552,81 @@ lflow_table_add_lflow_default_drop(struct lflow_table *lflow_table,
where, lflow_ref);
}
-/* Given a desired bitmap, finds a datapath group in 'dp_groups'. If it
- * doesn't exist, creates a new one and adds it to 'dp_groups'.
+struct ovn_dp_group *
+ovn_dp_group_get(struct hmap *dp_groups, size_t desired_n,
+ const unsigned long *desired_bitmap,
+ size_t bitmap_len)
+{
+ uint32_t hash;
+
+ hash = hash_int(desired_n, 0);
+ return ovn_dp_group_find(dp_groups, desired_bitmap, bitmap_len, hash);
+}
+
+/* Creates a new datapath group and adds it to 'dp_groups'.
* If 'sb_group' is provided, function will try to re-use this group by
- * either taking it directly, or by modifying, if it's not already in use. */
+ * either taking it directly, or by modifying, if it's not already in use.
+ * Caller should first call ovn_dp_group_get() before calling this function. */
struct ovn_dp_group *
-ovn_dp_group_get_or_create(struct ovsdb_idl_txn *ovnsb_txn,
- struct hmap *dp_groups,
- struct sbrec_logical_dp_group *sb_group,
- size_t desired_n,
- const unsigned long *desired_bitmap,
- size_t bitmap_len,
- bool is_switch,
- const struct ovn_datapaths *ls_datapaths,
- const struct ovn_datapaths *lr_datapaths)
+ovn_dp_group_create(struct ovsdb_idl_txn *ovnsb_txn,
+ struct hmap *dp_groups,
+ struct sbrec_logical_dp_group *sb_group,
+ size_t desired_n,
+ const unsigned long *desired_bitmap,
+ size_t bitmap_len,
+ bool is_switch,
+ const struct ovn_datapaths *ls_datapaths,
+ const struct ovn_datapaths *lr_datapaths)
{
struct ovn_dp_group *dpg;
- dpg = ovn_dp_group_get(dp_groups, desired_n, desired_bitmap, bitmap_len);
- if (dpg) {
- return dpg;
+ bool update_dp_group = false, can_modify = false;
+ unsigned long *dpg_bitmap;
+ size_t i, n = 0;
+
+ dpg_bitmap = sb_group ? bitmap_allocate(bitmap_len) : NULL;
+ for (i = 0; sb_group && i < sb_group->n_datapaths; i++) {
+ struct ovn_datapath *datapath_od;
+
+ datapath_od = ovn_datapath_from_sbrec(
+ ls_datapaths ? &ls_datapaths->datapaths : NULL,
+ lr_datapaths ? &lr_datapaths->datapaths : NULL,
+ sb_group->datapaths[i]);
+ if (!datapath_od || ovn_datapath_is_stale(datapath_od)) {
+ break;
+ }
+ bitmap_set1(dpg_bitmap, datapath_od->index);
+ n++;
+ }
+ if (!sb_group || i != sb_group->n_datapaths) {
+ /* No group or stale group. Not going to be used. */
+ update_dp_group = true;
+ can_modify = true;
+ } else if (!bitmap_equal(dpg_bitmap, desired_bitmap, bitmap_len)) {
+ /* The group in Sb is different. */
+ update_dp_group = true;
+ /* We can modify existing group if it's not already in use. */
+ can_modify = !ovn_dp_group_find(dp_groups, dpg_bitmap,
+ bitmap_len, hash_int(n, 0));
}
- return ovn_dp_group_create(ovnsb_txn, dp_groups, sb_group, desired_n,
- desired_bitmap, bitmap_len, is_switch,
- ls_datapaths, lr_datapaths);
+ bitmap_free(dpg_bitmap);
+
+ dpg = xzalloc(sizeof *dpg);
+ dpg->bitmap = bitmap_clone(desired_bitmap, bitmap_len);
+ if (!update_dp_group) {
+ dpg->dp_group = sb_group;
+ } else {
+ dpg->dp_group = ovn_sb_insert_or_update_logical_dp_group(
+ ovnsb_txn,
+ can_modify ? sb_group : NULL,
+ desired_bitmap,
+ is_switch ? ls_datapaths : lr_datapaths);
+ }
+ dpg->dpg_uuid = dpg->dp_group->header_.uuid;
+ hmap_insert(dp_groups, &dpg->node, hash_int(desired_n, 0));
+
+ return dpg;
}
void
@@ -967,24 +1002,6 @@ ovn_dp_group_find(const struct hmap *dp_groups,
return NULL;
}
-static void
-inc_ovn_dp_group_ref(struct ovn_dp_group *dpg)
-{
- dpg->refcnt++;
-}
-
-static void
-dec_ovn_dp_group_ref(struct hmap *dp_groups, struct ovn_dp_group *dpg)
-{
- dpg->refcnt--;
-
- if (!dpg->refcnt) {
- hmap_remove(dp_groups, &dpg->node);
- free(dpg->bitmap);
- free(dpg);
- }
-}
-
static struct sbrec_logical_dp_group *
ovn_sb_insert_or_update_logical_dp_group(
struct ovsdb_idl_txn *ovnsb_txn,
@@ -1011,83 +1028,6 @@ ovn_sb_insert_or_update_logical_dp_group(
return dp_group;
}
-static struct ovn_dp_group *
-ovn_dp_group_get(struct hmap *dp_groups, size_t desired_n,
- const unsigned long *desired_bitmap,
- size_t bitmap_len)
-{
- uint32_t hash;
-
- hash = hash_int(desired_n, 0);
- return ovn_dp_group_find(dp_groups, desired_bitmap, bitmap_len, hash);
-}
-
-/* Creates a new datapath group and adds it to 'dp_groups'.
- * If 'sb_group' is provided, function will try to re-use this group by
- * either taking it directly, or by modifying, if it's not already in use.
- * Caller should first call ovn_dp_group_get() before calling this function. */
-static struct ovn_dp_group *
-ovn_dp_group_create(struct ovsdb_idl_txn *ovnsb_txn,
- struct hmap *dp_groups,
- struct sbrec_logical_dp_group *sb_group,
- size_t desired_n,
- const unsigned long *desired_bitmap,
- size_t bitmap_len,
- bool is_switch,
- const struct ovn_datapaths *ls_datapaths,
- const struct ovn_datapaths *lr_datapaths)
-{
- struct ovn_dp_group *dpg;
-
- bool update_dp_group = false, can_modify = false;
- unsigned long *dpg_bitmap;
- size_t i, n = 0;
-
- dpg_bitmap = sb_group ? bitmap_allocate(bitmap_len) : NULL;
- for (i = 0; sb_group && i < sb_group->n_datapaths; i++) {
- struct ovn_datapath *datapath_od;
-
- datapath_od = ovn_datapath_from_sbrec(
- ls_datapaths ? &ls_datapaths->datapaths : NULL,
- lr_datapaths ? &lr_datapaths->datapaths : NULL,
- sb_group->datapaths[i]);
- if (!datapath_od || ovn_datapath_is_stale(datapath_od)) {
- break;
- }
- bitmap_set1(dpg_bitmap, datapath_od->index);
- n++;
- }
- if (!sb_group || i != sb_group->n_datapaths) {
- /* No group or stale group. Not going to be used. */
- update_dp_group = true;
- can_modify = true;
- } else if (!bitmap_equal(dpg_bitmap, desired_bitmap, bitmap_len)) {
- /* The group in Sb is different. */
- update_dp_group = true;
- /* We can modify existing group if it's not already in use. */
- can_modify = !ovn_dp_group_find(dp_groups, dpg_bitmap,
- bitmap_len, hash_int(n, 0));
- }
-
- bitmap_free(dpg_bitmap);
-
- dpg = xzalloc(sizeof *dpg);
- dpg->bitmap = bitmap_clone(desired_bitmap, bitmap_len);
- if (!update_dp_group) {
- dpg->dp_group = sb_group;
- } else {
- dpg->dp_group = ovn_sb_insert_or_update_logical_dp_group(
- ovnsb_txn,
- can_modify ? sb_group : NULL,
- desired_bitmap,
- is_switch ? ls_datapaths : lr_datapaths);
- }
- dpg->dpg_uuid = dpg->dp_group->header_.uuid;
- hmap_insert(dp_groups, &dpg->node, hash_int(desired_n, 0));
-
- return dpg;
-}
-
/* Adds an OVN datapath to a datapath group of existing logical flow.
* Version to use when hash bucket locking is NOT required or the corresponding
* hash lock is already taken. */
@@ -157,7 +157,10 @@ ovn_dp_groups_init(struct hmap *dp_groups)
void ovn_dp_groups_clear(struct hmap *dp_groups);
void ovn_dp_groups_destroy(struct hmap *dp_groups);
-struct ovn_dp_group *ovn_dp_group_get_or_create(
+struct ovn_dp_group *ovn_dp_group_get(struct hmap *dp_groups, size_t desired_n,
+ const unsigned long *desired_bitmap,
+ size_t bitmap_len);
+struct ovn_dp_group *ovn_dp_group_create(
struct ovsdb_idl_txn *ovnsb_txn, struct hmap *dp_groups,
struct sbrec_logical_dp_group *sb_group,
size_t desired_n, const unsigned long *desired_bitmap,
@@ -165,4 +168,22 @@ struct ovn_dp_group *ovn_dp_group_get_or_create(
const struct ovn_datapaths *ls_datapaths,
const struct ovn_datapaths *lr_datapaths);
+static inline void
+inc_ovn_dp_group_ref(struct ovn_dp_group *dpg)
+{
+ dpg->refcnt++;
+}
+
+static inline void
+dec_ovn_dp_group_ref(struct hmap *dp_groups, struct ovn_dp_group *dpg)
+{
+ dpg->refcnt--;
+
+ if (!dpg->refcnt) {
+ hmap_remove(dp_groups, &dpg->node);
+ free(dpg->bitmap);
+ free(dpg);
+ }
+}
+
#endif /* LFLOW_MGR_H */
\ No newline at end of file
@@ -3739,244 +3739,6 @@ build_lb_port_related_data(
build_lswitch_lbs_from_lrouter(lr_datapaths, lb_dps_map, lb_group_dps_map);
}
-struct sb_lb {
- struct hmap_node hmap_node;
-
- const struct sbrec_load_balancer *slb;
- struct ovn_dp_group *dpg;
- struct ovn_dp_group *lr_dpg;
- struct uuid lb_uuid;
-};
-
-static struct sb_lb *
-find_slb_in_sb_lbs(struct hmap *sb_lbs, const struct uuid *lb_uuid)
-{
- struct sb_lb *sb_lb;
- HMAP_FOR_EACH_WITH_HASH (sb_lb, hmap_node, uuid_hash(lb_uuid), sb_lbs) {
- if (uuid_equals(&sb_lb->lb_uuid, lb_uuid)) {
- return sb_lb;
- }
- }
-
- return NULL;
-}
-
-/* Syncs relevant load balancers (applied to logical switches) to the
- * Southbound database.
- */
-void
-sync_lbs(struct ovsdb_idl_txn *ovnsb_txn,
- const struct sbrec_load_balancer_table *sbrec_load_balancer_table,
- struct ovn_datapaths *ls_datapaths,
- struct ovn_datapaths *lr_datapaths,
- struct hmap *lb_dps_map,
- struct chassis_features *chassis_features)
-{
- struct hmap ls_dp_groups = HMAP_INITIALIZER(&ls_dp_groups);
- struct hmap lr_dp_groups = HMAP_INITIALIZER(&lr_dp_groups);
- struct ovn_lb_datapaths *lb_dps;
- struct hmap sb_lbs = HMAP_INITIALIZER(&sb_lbs);
-
- /* Delete any stale SB load balancer rows and create datapath
- * groups for existing ones. */
- struct hmapx existing_lbs = HMAPX_INITIALIZER(&existing_lbs);
- const struct sbrec_load_balancer *sbrec_lb;
- SBREC_LOAD_BALANCER_TABLE_FOR_EACH_SAFE (sbrec_lb,
- sbrec_load_balancer_table) {
- const char *nb_lb_uuid = smap_get(&sbrec_lb->external_ids, "lb_id");
- struct uuid lb_uuid;
- if (!nb_lb_uuid || !uuid_from_string(&lb_uuid, nb_lb_uuid)) {
- sbrec_load_balancer_delete(sbrec_lb);
- continue;
- }
-
- /* Delete any SB load balancer entries that refer to NB load balancers
- * that don't exist anymore or are not applied to switches/routers
- * anymore.
- *
- * There is also a special case in which duplicate LBs might be created
- * in the SB, e.g., due to the fact that OVSDB only ensures
- * "at-least-once" consistency for clustered database tables that
- * are not indexed in any way.
- */
- lb_dps = ovn_lb_datapaths_find(lb_dps_map, &lb_uuid);
- if (!lb_dps || (!lb_dps->n_nb_ls && !lb_dps->n_nb_lr) ||
- !hmapx_add(&existing_lbs, lb_dps)) {
- sbrec_load_balancer_delete(sbrec_lb);
- continue;
- }
-
- struct sb_lb *sb_lb = xzalloc(sizeof *sb_lb);
- sb_lb->lb_uuid = lb_uuid;
- sb_lb->slb = sbrec_lb;
- hmap_insert(&sb_lbs, &sb_lb->hmap_node, uuid_hash(&lb_uuid));
-
- /* Find or create datapath group for this load balancer. */
- if (lb_dps->n_nb_ls) {
- struct sbrec_logical_dp_group *ls_datapath_group
- = chassis_features->ls_dpg_column
- ? sb_lb->slb->ls_datapath_group
- : sb_lb->slb->datapath_group; /* deprecated */
- sb_lb->dpg = ovn_dp_group_get_or_create(
- ovnsb_txn, &ls_dp_groups,
- ls_datapath_group,
- lb_dps->n_nb_ls, lb_dps->nb_ls_map,
- ods_size(ls_datapaths), true,
- ls_datapaths, NULL);
- }
- if (lb_dps->n_nb_lr) {
- sb_lb->lr_dpg = ovn_dp_group_get_or_create(
- ovnsb_txn, &lr_dp_groups,
- sb_lb->slb->lr_datapath_group,
- lb_dps->n_nb_lr, lb_dps->nb_lr_map,
- ods_size(lr_datapaths), false,
- NULL, lr_datapaths);
- }
- }
- hmapx_destroy(&existing_lbs);
-
- /* Create SB Load balancer records if not present and sync
- * the SB load balancer columns. */
- HMAP_FOR_EACH (lb_dps, hmap_node, lb_dps_map) {
-
- if (!lb_dps->n_nb_ls && !lb_dps->n_nb_lr) {
- continue;
- }
-
- /* Store the fact that northd provides the original (destination IP +
- * transport port) tuple.
- */
- struct smap options;
- smap_clone(&options, &lb_dps->lb->nlb->options);
- smap_replace(&options, "hairpin_orig_tuple", "true");
-
- struct sb_lb *sb_lb = find_slb_in_sb_lbs(&sb_lbs,
- &lb_dps->lb->nlb->header_.uuid);
- ovs_assert(!sb_lb || (sb_lb->slb && (sb_lb->dpg || sb_lb->lr_dpg)));
- struct ovn_dp_group *lb_dpg = NULL, *lb_lr_dpg = NULL;
- if (!sb_lb) {
- sbrec_lb = sbrec_load_balancer_insert(ovnsb_txn);
- char *lb_id = xasprintf(
- UUID_FMT, UUID_ARGS(&lb_dps->lb->nlb->header_.uuid));
- const struct smap external_ids =
- SMAP_CONST1(&external_ids, "lb_id", lb_id);
- sbrec_load_balancer_set_external_ids(sbrec_lb, &external_ids);
- free(lb_id);
- } else {
- sbrec_lb = sb_lb->slb;
- lb_dpg = sb_lb->dpg;
- lb_lr_dpg = sb_lb->lr_dpg;
- }
-
- /* Find or create datapath group for this load balancer. */
- if (!lb_dpg && lb_dps->n_nb_ls) {
- struct sbrec_logical_dp_group *ls_datapath_group
- = chassis_features->ls_dpg_column
- ? sbrec_lb->ls_datapath_group
- : sbrec_lb->datapath_group; /* deprecated */
- lb_dpg = ovn_dp_group_get_or_create(
- ovnsb_txn, &ls_dp_groups,
- ls_datapath_group,
- lb_dps->n_nb_ls, lb_dps->nb_ls_map,
- ods_size(ls_datapaths), true,
- ls_datapaths, NULL);
- }
- if (!lb_lr_dpg && lb_dps->n_nb_lr) {
- lb_lr_dpg = ovn_dp_group_get_or_create(
- ovnsb_txn, &lr_dp_groups,
- sbrec_lb->lr_datapath_group,
- lb_dps->n_nb_lr, lb_dps->nb_lr_map,
- ods_size(lr_datapaths), false,
- NULL, lr_datapaths);
- }
-
- /* Update columns. */
- sbrec_load_balancer_set_name(sbrec_lb, lb_dps->lb->nlb->name);
- sbrec_load_balancer_set_vips(sbrec_lb,
- ovn_northd_lb_get_vips(lb_dps->lb));
- sbrec_load_balancer_set_protocol(sbrec_lb, lb_dps->lb->nlb->protocol);
-
- if (chassis_features->ls_dpg_column) {
- sbrec_load_balancer_set_ls_datapath_group(
- sbrec_lb, lb_dpg ? lb_dpg->dp_group : NULL
- );
- sbrec_load_balancer_set_datapath_group(sbrec_lb, NULL);
- } else {
- /* datapath_group column is deprecated. */
- sbrec_load_balancer_set_ls_datapath_group(sbrec_lb, NULL);
- sbrec_load_balancer_set_datapath_group(
- sbrec_lb, lb_dpg ? lb_dpg->dp_group : NULL
- );
- }
-
- sbrec_load_balancer_set_lr_datapath_group(
- sbrec_lb, lb_lr_dpg ? lb_lr_dpg->dp_group : NULL
- );
- sbrec_load_balancer_set_options(sbrec_lb, &options);
- /* Clearing 'datapaths' column, since 'dp_group' is in use. */
- sbrec_load_balancer_set_datapaths(sbrec_lb, NULL, 0);
- smap_destroy(&options);
- }
-
- struct ovn_dp_group *dpg;
- HMAP_FOR_EACH_POP (dpg, node, &ls_dp_groups) {
- bitmap_free(dpg->bitmap);
- free(dpg);
- }
- hmap_destroy(&ls_dp_groups);
-
- HMAP_FOR_EACH_POP (dpg, node, &lr_dp_groups) {
- bitmap_free(dpg->bitmap);
- free(dpg);
- }
- hmap_destroy(&lr_dp_groups);
-
- struct sb_lb *sb_lb;
- HMAP_FOR_EACH_POP (sb_lb, hmap_node, &sb_lbs) {
- free(sb_lb);
- }
- hmap_destroy(&sb_lbs);
-
- /* Datapath_Binding.load_balancers is not used anymore, it's still in the
- * schema for compatibility reasons. Reset it to empty, just in case.
- */
- struct ovn_datapath *od;
- HMAP_FOR_EACH (od, key_node, &ls_datapaths->datapaths) {
- ovs_assert(od->nbs);
-
- if (od->sb->n_load_balancers) {
- sbrec_datapath_binding_set_load_balancers(od->sb, NULL, 0);
- }
- }
- HMAP_FOR_EACH (od, key_node, &lr_datapaths->datapaths) {
- ovs_assert(od->nbr);
-
- if (od->sb->n_load_balancers) {
- sbrec_datapath_binding_set_load_balancers(od->sb, NULL, 0);
- }
- }
-}
-
-bool
-check_sb_lb_duplicates(const struct sbrec_load_balancer_table *table)
-{
- struct sset existing_nb_lb_uuids =
- SSET_INITIALIZER(&existing_nb_lb_uuids);
- const struct sbrec_load_balancer *sbrec_lb;
- bool duplicates = false;
-
- SBREC_LOAD_BALANCER_TABLE_FOR_EACH (sbrec_lb, table) {
- const char *nb_lb_uuid = smap_get(&sbrec_lb->external_ids, "lb_id");
- if (nb_lb_uuid && !sset_add(&existing_nb_lb_uuids, nb_lb_uuid)) {
- duplicates = true;
- break;
- }
- }
-
- sset_destroy(&existing_nb_lb_uuids);
- return duplicates;
-}
-
/* Syncs the SB port binding for the ovn_port 'op' of a logical switch port.
* Caller should make sure that the OVN SB IDL txn is not NULL. Presently it
* only syncs the nat column of port binding corresponding to the 'op->nbsp' */
@@ -712,12 +712,6 @@ const char *northd_get_svc_monitor_mac(void);
const struct ovn_datapath *northd_get_datapath_for_port(
const struct hmap *ls_ports, const char *port_name);
-void sync_lbs(struct ovsdb_idl_txn *, const struct sbrec_load_balancer_table *,
- struct ovn_datapaths *ls_datapaths,
- struct ovn_datapaths *lr_datapaths,
- struct hmap *lbs,
- struct chassis_features *chassis_features);
-bool check_sb_lb_duplicates(const struct sbrec_load_balancer_table *);
struct lr_stateful_table;
void sync_pbs(struct ovsdb_idl_txn *, struct hmap *ls_ports,
@@ -2938,6 +2938,8 @@ sw1_sb_uuid=$(fetch_column datapath_binding _uuid external_ids:name=sw1)
echo "$sw0_sb_uuid" > sw_sb_uuids
echo "$sw1_sb_uuid" >> sw_sb_uuids
+lb0_dp_group=$(fetch_column sb:load_balancer ls_datapath_group name=lb0)
+
echo
echo "__file__:__line__: Check that SB lb0 has sw0 and sw1 in datapaths column."
AT_CHECK_UNQUOTED([ovn-sbctl --bare --columns _uuid,datapaths find Logical_DP_Group dnl
@@ -2945,6 +2947,8 @@ AT_CHECK_UNQUOTED([ovn-sbctl --bare --columns _uuid,datapaths find Logical_DP_Gr
$(cat sw_sb_uuids | sort)
])
+lbg0_dp_group=$(fetch_column sb:load_balancer ls_datapath_group name=lbg0)
+
echo
echo "__file__:__line__: Check that SB lbg0 has sw0 and sw1 in datapaths column."
AT_CHECK_UNQUOTED([ovn-sbctl --bare --columns _uuid,datapaths find Logical_DP_Group dnl
@@ -10521,8 +10525,7 @@ check ovn-nbctl --wait=sb lb-add lb1 10.0.0.10:80 10.0.0.3:80
check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute nocompute
-
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE(1)
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -10531,7 +10534,7 @@ check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -10541,7 +10544,7 @@ check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -10550,7 +10553,7 @@ check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE(1)
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -10560,7 +10563,7 @@ check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE(1)
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -10618,7 +10621,7 @@ check_engine_stats lr_stateful norecompute compute
# A LB applied to a switch/router triggers:
# - a recompute in the first iteration (handling northd change)
# - a compute in the second iteration (handling SB update)
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE((1))
@@ -10631,7 +10634,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE(1)
# Cleanup the vip of lb1.
@@ -10642,7 +10645,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE(1)
# Set the vips of lb1 back
@@ -10653,7 +10656,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE(1)
# Add another vip to lb1
@@ -10664,7 +10667,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE(1)
# Disassociate lb1 from sw0. There should be a full recompute of northd engine node.
@@ -10687,7 +10690,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -10708,7 +10711,7 @@ check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Modify the backend of the lb1 vip
@@ -10718,7 +10721,7 @@ check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Cleanup the vip of lb1.
@@ -10728,7 +10731,7 @@ check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Set the vips of lb1 back
@@ -10738,7 +10741,7 @@ check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Add another vip to lb1
@@ -10748,7 +10751,7 @@ check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -10779,7 +10782,7 @@ check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -10796,7 +10799,7 @@ check ovn-nbctl --wait=sb add load_balancer_group . load_Balancer $lb1_uuid
check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -10806,7 +10809,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
# Update lb and this should not result in northd recompute
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -10816,7 +10819,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
# Modify the backend of the lb1 vip
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -10826,7 +10829,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Cleanup the vip of lb1.
@@ -10837,7 +10840,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Set the vips of lb1 back
@@ -10848,7 +10851,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Add another vip to lb1
@@ -10859,7 +10862,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -10875,7 +10878,7 @@ check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Modify the backend of the lb1 vip
@@ -10885,7 +10888,7 @@ check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Cleanup the vip of lb1.
@@ -10895,7 +10898,7 @@ check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Set the vips of lb1 back
@@ -10905,7 +10908,7 @@ check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Add another vip to lb1
@@ -10915,7 +10918,7 @@ check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -10935,7 +10938,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -10979,7 +10982,7 @@ check_engine_stats northd norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -10989,7 +10992,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -10998,7 +11001,7 @@ check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -11008,7 +11011,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -11018,7 +11021,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -11028,7 +11031,7 @@ check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -11059,7 +11062,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Deleting lb2 should result in lflow recompute as it is
@@ -11071,7 +11074,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats ls_stateful norecompute compute
check_engine_stats lflow norecompute compute
-check_engine_stats sync_to_sb_lb recompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -11158,6 +11161,7 @@ check ovn-nbctl --wait=sb ls-lb-add sw0 lb1
check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lflow norecompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Clear the VIPs of lb1
@@ -11166,6 +11170,7 @@ check ovn-nbctl --wait=sb clear load_balancer . vips
check_engine_stats lb_data norecompute compute
check_engine_stats northd norecompute compute
check_engine_stats lflow norecompute compute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
@@ -11173,6 +11178,7 @@ check ovn-nbctl --wait=sb lb-del lb1
check_engine_stats lb_data norecompute compute
check_engine_stats northd recompute nocompute
check_engine_stats lflow recompute nocompute
+check_engine_stats sync_to_sb_lb recompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
AT_CLEANUP
@@ -11401,6 +11407,7 @@ check_engine_stats northd recompute nocompute
check_engine_stats lr_nat recompute nocompute
check_engine_stats lr_stateful recompute nocompute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb recompute nocompute
check_engine_stats lflow recompute nocompute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
@@ -11414,6 +11421,7 @@ check_engine_stats northd recompute compute
check_engine_stats lr_nat recompute nocompute
check_engine_stats lr_stateful recompute nocompute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb recompute nocompute
check_engine_stats lflow recompute nocompute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
@@ -11426,6 +11434,7 @@ check_engine_stats northd recompute compute
check_engine_stats lr_nat recompute nocompute
check_engine_stats lr_stateful recompute nocompute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb recompute nocompute
check_engine_stats lflow recompute nocompute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
@@ -11452,6 +11461,7 @@ check_engine_stats northd recompute nocompute
check_engine_stats lr_nat recompute nocompute
check_engine_stats lr_stateful recompute nocompute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb recompute nocompute
check_engine_stats lflow recompute nocompute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
@@ -11464,6 +11474,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_nat norecompute compute
check_engine_stats lflow norecompute compute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Update the NAT options column
@@ -11473,6 +11484,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_nat norecompute compute
check_engine_stats lflow norecompute compute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Update the NAT external_ip column
@@ -11483,6 +11495,7 @@ check_engine_stats lr_nat norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Update the NAT logical_ip column
@@ -11493,6 +11506,7 @@ check_engine_stats lr_nat norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Update the NAT type
@@ -11503,6 +11517,7 @@ check_engine_stats lr_nat norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Create a dnat_and_snat NAT with external_mac and logical_port
@@ -11513,6 +11528,7 @@ check_engine_stats lr_nat norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
nat2_uuid=$(ovn-nbctl --bare --columns _uuid find nat logical_ip=10.0.0.4)
@@ -11524,6 +11540,7 @@ check_engine_stats lr_nat norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Create a load balancer and add the lb vip as NAT
@@ -11540,6 +11557,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_nat norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
check_engine_stats lflow recompute nocompute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
@@ -11551,6 +11569,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_nat norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
check_engine_stats lflow recompute nocompute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
@@ -11562,6 +11581,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_nat norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
check_engine_stats lflow recompute nocompute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
@@ -11573,6 +11593,7 @@ check_engine_stats northd norecompute compute
check_engine_stats lr_nat norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
check_engine_stats lflow recompute nocompute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
@@ -11584,6 +11605,7 @@ check_engine_stats lr_nat norecompute compute
check_engine_stats lr_stateful norecompute compute
check_engine_stats lflow norecompute compute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb norecompute compute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Create router Policy
@@ -11593,6 +11615,7 @@ check_engine_stats northd recompute nocompute
check_engine_stats lr_nat recompute nocompute
check_engine_stats lr_stateful recompute nocompute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb recompute nocompute
check_engine_stats lflow recompute nocompute
CHECK_NO_CHANGE_AFTER_RECOMPUTE
@@ -11602,6 +11625,7 @@ check_engine_stats northd recompute nocompute
check_engine_stats lr_nat recompute nocompute
check_engine_stats lr_stateful recompute nocompute
check_engine_stats sync_to_sb_pb recompute nocompute
+check_engine_stats sync_to_sb_lb recompute nocompute
check_engine_stats lflow recompute nocompute
CHECK_NO_CHANGE_AFTER_RECOMPUTE