Remove unsupported config option from other_config in chassis. This should prevent an issue when user upgrades past certain feature and then decides to downgrade for whatever reason. Without the removal the feature flag would stay in the DB causing northd to produce unsupported logical flows.
Reported-at: https://bugzilla.redhat.com/2161529 Signed-off-by: Ales Musil <[email protected]> --- controller/chassis.c | 51 +++++++++++++++++++++++++++++++++++++++++ tests/ovn-controller.at | 24 +++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/controller/chassis.c b/controller/chassis.c index 0f1e9e789..3e2a2b8d9 100644 --- a/controller/chassis.c +++ b/controller/chassis.c @@ -597,6 +597,55 @@ chassis_build_encaps(struct ovsdb_idl_txn *ovnsb_idl_txn, return encaps; } +/* 'struct sset' of all supported options in other_confing. Anything missing + * in this set will be removed from the chassis configuration. */ +static void +update_supported_sset(struct sset *supported) +{ + /* OvS external_ids. */ + sset_add(supported, "ovn-bridge-mappings"); + sset_add(supported, "datapath-type"); + sset_add(supported, "ovn-cms-options"); + sset_add(supported, "ovn-monitor-all"); + sset_add(supported, "ovn-enable-lflow-cache"); + sset_add(supported, "ovn-limit-lflow-cache"); + sset_add(supported, "ovn-memlimit-lflow-cache-kb"); + sset_add(supported, "ovn-trim-limit-lflow-cache"); + sset_add(supported, "ovn-trim-wmark-perc-lflow-cache"); + sset_add(supported, "ovn-trim-timeout-ms"); + sset_add(supported, "iface-types"); + sset_add(supported, "ovn-chassis-mac-mappings"); + sset_add(supported, "is-interconn"); + + /* Internal options. */ + sset_add(supported, "is-vtep"); + sset_add(supported, "is-remote"); + sset_add(supported, OVN_FEATURE_PORT_UP_NOTIF); + sset_add(supported, OVN_FEATURE_CT_NO_MASKED_LABEL); + sset_add(supported, OVN_FEATURE_MAC_BINDING_TIMESTAMP); + sset_add(supported, OVN_FEATURE_CT_LB_RELATED); +} + +static void +remove_unsupported_options(const struct sbrec_chassis *chassis_rec, + bool *updated) +{ + struct sset supported_options = SSET_INITIALIZER(&supported_options); + update_supported_sset(&supported_options); + + const struct smap_node *node; + SMAP_FOR_EACH (node, &chassis_rec->other_config) { + if (!sset_contains(&supported_options, node->key)) { + VLOG_WARN("Removing unsupported key \"%s\" from chassis record.", + node->key); + sbrec_chassis_update_other_config_delkey(chassis_rec, node->key); + *updated = true; + } + } + + sset_destroy(&supported_options); +} + /* If this is a chassis config update after we initialized the record once * then we should always be able to find it with the ID we saved in * chassis_state. @@ -662,6 +711,8 @@ chassis_update(const struct sbrec_chassis *chassis_rec, update_chassis_transport_zones(transport_zones, chassis_rec); + remove_unsupported_options(chassis_rec, &updated); + /* If any of the encaps should change, update them. */ bool tunnels_changed = chassis_tunnels_changed(&ovs_cfg->encap_type_set, diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at index bbe142ae3..159e66461 100644 --- a/tests/ovn-controller.at +++ b/tests/ovn-controller.at @@ -2527,3 +2527,27 @@ check test "$zone_num" -eq 666 AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD([ +AT_SETUP([ovn-controller - check unsupported chassis options removal]) + +ovn_start + +net_add n1 +sim_add hv1 +as hv1 +ovs-vsctl add-br br-phys +ovn_attach n1 br-phys 192.168.0.1 + +ovn-nbctl --wait=sb sync + +chassis_id=$(fetch_column Chassis _uuid name=hv1) +check ovn-sbctl set chassis $chassis_id other_config:unsupported="value" + +OVS_WAIT_UNTIL([grep -q 'Removing unsupported key "unsupported" from chassis record.' hv1/ovn-controller.log]) + +AT_CHECK([ovn-sbctl get chassis $chassis_id other_config:unsupported], [1], [ignore], [ignore]) + +OVN_CLEANUP([hv1]) +AT_CLEANUP +]) -- 2.39.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
