Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit 2d661a2733010d7e94560c624edbe7f192952b3d
- Author: Numan Siddique <nusiddiq@redhat.com>
- Date: Wed Oct 10 11:38:55 2018 +0530
- ovn: Support configuring the BFD params for the tunnel interfaces
- With this commit the users can override the default values of
- the BFD params - min_rx, min_tx, decay_min_rx and mult if desired.
- This can be useful to debug any issues related to BFD (like
- frequent BFD state changes).
- A new column 'options' is added in NB_Global and SB_Global tables
- of OVN_Northbound and OVN_Southbound schemas respectively. CMS
- can define the options 'bfd-min-rx', 'bfd-min-tx',
- 'bfd-decay-min-rx' and 'bfd-mult' in the options column of
- NB_Global table row. ovn-northd copies these options from
- NB_Global to SB_Global. ovn-controller configures these
- options to the tunnel interfaces when enabling BFD.
- When BFD is disabled, this patch now clears the 'bfd' column
- of the interface row, instead of setting 'enable=false'.
- Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
- Signed-off-by: Ben Pfaff <blp@ovn.org>
- --- a/ovn/controller/bfd.c
- +++ b/ovn/controller/bfd.c
- @@ -38,24 +38,6 @@ bfd_register_ovs_idl(struct ovsdb_idl *o
- ovsdb_idl_add_column(ovs_idl, &ovsrec_interface_col_bfd_status);
- }
- -
- -static void
- -interface_set_bfd(const struct ovsrec_interface *iface, bool bfd_setting)
- -{
- - const char *new_setting = bfd_setting ? "true":"false";
- - const char *current_setting = smap_get(&iface->bfd, "enable");
- - if (current_setting && !strcmp(current_setting, new_setting)) {
- - /* If already set to the desired setting we skip setting it again
- - * to avoid flapping to bfd initialization state */
- - return;
- - }
- - const struct smap bfd = SMAP_CONST1(&bfd, "enable", new_setting);
- - ovsrec_interface_verify_bfd(iface);
- - ovsrec_interface_set_bfd(iface, &bfd);
- - VLOG_INFO("%s BFD on interface %s", bfd_setting ? "Enabled" : "Disabled",
- - iface->name);
- -}
- -
- void
- bfd_calculate_active_tunnels(const struct ovsrec_bridge *br_int,
- struct sset *active_tunnels)
- @@ -248,7 +230,8 @@ bfd_calculate_chassis(struct controller_
- void
- bfd_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int,
- const struct sbrec_chassis *chassis_rec, struct hmap *local_datapaths,
- - const struct chassis_index *chassis_index)
- + const struct chassis_index *chassis_index,
- + const struct sbrec_sb_global_table *sb_global_table)
- {
- if (!chassis_rec) {
- @@ -272,15 +255,58 @@ bfd_run(struct controller_ctx *ctx, cons
- }
- }
- + const struct sbrec_sb_global *sb
- + = sbrec_sb_global_table_first(sb_global_table);
- + struct smap bfd = SMAP_INITIALIZER(&bfd);
- + smap_add(&bfd, "enable", "true");
- +
- + if (sb) {
- + const char *min_rx = smap_get(&sb->options, "bfd-min-rx");
- + const char *decay_min_rx = smap_get(&sb->options, "bfd-decay-min-rx");
- + const char *min_tx = smap_get(&sb->options, "bfd-min-tx");
- + const char *mult = smap_get(&sb->options, "bfd-mult");
- + if (min_rx) {
- + smap_add(&bfd, "min_rx", min_rx);
- + }
- + if (decay_min_rx) {
- + smap_add(&bfd, "decay_min_rx", decay_min_rx);
- + }
- + if (min_tx) {
- + smap_add(&bfd, "min_tx", min_tx);
- + }
- + if (mult) {
- + smap_add(&bfd, "mult", mult);
- + }
- + }
- +
- /* Enable or disable bfd */
- const struct ovsrec_interface *iface;
- OVSREC_INTERFACE_FOR_EACH (iface, ctx->ovs_idl) {
- if (sset_contains(&tunnels, iface->name)) {
- - interface_set_bfd(
- - iface, sset_contains(&bfd_ifaces, iface->name));
- + if (sset_contains(&bfd_ifaces, iface->name)) {
- + /* We need to enable BFD for this interface. Configure the
- + * BFD params if
- + * - If BFD was disabled earlier
- + * - Or if CMS has updated BFD config options.
- + */
- + if (!smap_equal(&iface->bfd, &bfd)) {
- + ovsrec_interface_verify_bfd(iface);
- + ovsrec_interface_set_bfd(iface, &bfd);
- + VLOG_INFO("Enabled BFD on interface %s", iface->name);
- + }
- + } else {
- + /* We need to disable BFD for this interface if it was enabled
- + * earlier. */
- + if (smap_count(&iface->bfd)) {
- + ovsrec_interface_verify_bfd(iface);
- + ovsrec_interface_set_bfd(iface, NULL);
- + VLOG_INFO("Disabled BFD on interface %s", iface->name);
- + }
- + }
- }
- }
- + smap_destroy(&bfd);
- sset_destroy(&tunnels);
- sset_destroy(&bfd_ifaces);
- sset_destroy(&bfd_chassis);
- --- a/ovn/controller/bfd.h
- +++ b/ovn/controller/bfd.h
- @@ -21,13 +21,16 @@ struct controller_ctx;
- struct hmap;
- struct ovsdb_idl;
- struct ovsrec_bridge;
- +struct ovsrec_open_vswitch_table;
- struct sbrec_chassis;
- +struct sbrec_sb_global_table;
- struct sset;
- void bfd_register_ovs_idl(struct ovsdb_idl *);
- void bfd_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int,
- const struct sbrec_chassis *chassis_rec,
- - struct hmap *local_datapaths, const struct chassis_index *);
- + struct hmap *local_datapaths, const struct chassis_index *,
- + const struct sbrec_sb_global_table *sb_global_table);
- void bfd_calculate_active_tunnels(const struct ovsrec_bridge *br_int,
- struct sset *active_tunnels);
- --- a/ovn/controller/ovn-controller.c
- +++ b/ovn/controller/ovn-controller.c
- @@ -731,7 +731,8 @@ main(int argc, char *argv[])
- if (chassis_id) {
- bfd_run(&ctx, br_int, chassis, &local_datapaths,
- - &chassis_index);
- + &chassis_index,
- + sbrec_sb_global_table_get(ovnsb_idl_loop.idl));
- }
- physical_run(&ctx, mff_ovn_geneve,
- br_int, chassis, &ct_zones,
- --- a/ovn/northd/ovn-northd.c
- +++ b/ovn/northd/ovn-northd.c
- @@ -6458,6 +6458,7 @@ ovnnb_db_run(struct northd_context *ctx,
- sb = sbrec_sb_global_insert(ctx->ovnsb_txn);
- }
- sbrec_sb_global_set_nb_cfg(sb, nb->nb_cfg);
- + sbrec_sb_global_set_options(sb, &nb->options);
- sb_loop->next_cfg = nb->nb_cfg;
- cleanup_macam(&macam);
- @@ -6956,6 +6957,7 @@ main(int argc, char *argv[])
- ovsdb_idl_add_table(ovnsb_idl_loop.idl, &sbrec_table_sb_global);
- add_column_noalert(ovnsb_idl_loop.idl, &sbrec_sb_global_col_nb_cfg);
- + add_column_noalert(ovnsb_idl_loop.idl, &sbrec_sb_global_col_options);
- ovsdb_idl_add_table(ovnsb_idl_loop.idl, &sbrec_table_logical_flow);
- add_column_noalert(ovnsb_idl_loop.idl,
- --- a/ovn/ovn-nb.ovsschema
- +++ b/ovn/ovn-nb.ovsschema
- @@ -1,7 +1,7 @@
- {
- "name": "OVN_Northbound",
- - "version": "5.10.0",
- - "cksum": "626737541 17810",
- + "version": "5.10.1",
- + "cksum": "2509654490 17965",
- "tables": {
- "NB_Global": {
- "columns": {
- @@ -19,7 +19,10 @@
- "ssl": {
- "type": {"key": {"type": "uuid",
- "refTable": "SSL"},
- - "min": 0, "max": 1}}},
- + "min": 0, "max": 1}},
- + "options": {
- + "type": {"key": "string", "value": "string",
- + "min": 0, "max": "unlimited"}}},
- "maxRows": 1,
- "isRoot": true},
- "Logical_Switch": {
- --- a/ovn/ovn-nb.xml
- +++ b/ovn/ovn-nb.xml
- @@ -69,6 +69,41 @@
- See <em>External IDs</em> at the beginning of this document.
- </column>
- </group>
- +
- + <group title="Common options">
- + <column name="options">
- + This column provides general key/value settings. The supported
- + options are described individually below.
- + </column>
- +
- + <group title="Options for configuring BFD">
- + <p>
- + These options apply when <code>ovn-controller</code> configures
- + BFD on tunnels interfaces.
- + </p>
- +
- + <column name="options" key="bfd-min-rx">
- + BFD option <code>min-rx</code> value to use when configuring BFD on
- + tunnel interfaces.
- + </column>
- +
- + <column name="options" key="bfd-decay-min-rx">
- + BFD option <code>decay-min-rx</code> value to use when configuring
- + BFD on tunnel interfaces.
- + </column>
- +
- + <column name="options" key="bfd-min-tx">
- + BFD option <code>min-tx</code> value to use when configuring BFD on
- + tunnel interfaces.
- + </column>
- +
- + <column name="options" key="bfd-mult">
- + BFD option <code>mult</code> value to use when configuring BFD on
- + tunnel interfaces.
- + </column>
- + </group>
- + </group>
- +
- <group title="Connection Options">
- <column name="connections">
- Database clients to which the Open vSwitch database server should
- --- a/ovn/ovn-sb.ovsschema
- +++ b/ovn/ovn-sb.ovsschema
- @@ -1,7 +1,7 @@
- {
- "name": "OVN_Southbound",
- - "version": "1.15.0",
- - "cksum": "70426956 13327",
- + "version": "1.15.1",
- + "cksum": "4038624432 13482",
- "tables": {
- "SB_Global": {
- "columns": {
- @@ -17,7 +17,10 @@
- "ssl": {
- "type": {"key": {"type": "uuid",
- "refTable": "SSL"},
- - "min": 0, "max": 1}}},
- + "min": 0, "max": 1}},
- + "options": {
- + "type": {"key": "string", "value": "string",
- + "min": 0, "max": "unlimited"}}},
- "maxRows": 1,
- "isRoot": true},
- "Chassis": {
- --- a/ovn/ovn-sb.xml
- +++ b/ovn/ovn-sb.xml
- @@ -162,7 +162,45 @@
- <column name="external_ids">
- See <em>External IDs</em> at the beginning of this document.
- </column>
- +
- + <column name="options">
- + </column>
- + </group>
- +
- + <group title="Common options">
- + <column name="options">
- + This column provides general key/value settings. The supported
- + options are described individually below.
- + </column>
- +
- + <group title="Options for configuring BFD">
- + <p>
- + These options apply when <code>ovn-controller</code> configures
- + BFD on tunnels interfaces.
- + </p>
- +
- + <column name="options" key="bfd-min-rx">
- + BFD option <code>min-rx</code> value to use when configuring BFD on
- + tunnel interfaces.
- + </column>
- +
- + <column name="options" key="bfd-decay-min-rx">
- + BFD option <code>decay-min-rx</code> value to use when configuring
- + BFD on tunnel interfaces.
- + </column>
- +
- + <column name="options" key="bfd-min-tx">
- + BFD option <code>min-tx</code> value to use when configuring BFD on
- + tunnel interfaces.
- + </column>
- +
- + <column name="options" key="bfd-mult">
- + BFD option <code>mult</code> value to use when configuring BFD on
- + tunnel interfaces.
- + </column>
- + </group>
- </group>
- +
- <group title="Connection Options">
- <column name="connections">
- Database clients to which the Open vSwitch database server should
- --- a/tests/ovn.at
- +++ b/tests/ovn.at
- @@ -8722,7 +8722,7 @@ for chassis in gw1 gw2; do
- done
- # make sure BFD is not enabled to hv2, we don't need it
- AT_CHECK([ovs-vsctl --bare --columns bfd find Interface name=ovn-hv2-0],[0],
- - [[enable=false
- + [[
- ]])
- @@ -8736,7 +8736,7 @@ for chassis in gw1 gw2; do
- done
- # make sure BFD is not enabled to hv1, we don't need it
- AT_CHECK([ovs-vsctl --bare --columns bfd find Interface name=ovn-hv1-0],[0],
- - [[enable=false
- + [[
- ]])
- sleep 3 # let BFD sessions settle so we get the right flows on the right chassis
- @@ -8766,6 +8766,33 @@ AT_CHECK([ovn-sbctl --columns chassis --
- [0],[[1
- ]])
- +ovn-nbctl --wait=hv set NB_Global . options:"bfd-min-rx"=2000
- +as gw2
- +for chassis in gw1 hv1 hv2; do
- + echo "checking gw2 -> $chassis"
- + OVS_WAIT_UNTIL([
- + bfd_cfg=$(ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0)
- + test "$bfd_cfg" = "enable=true min_rx=2000"
- +])
- +done
- +ovn-nbctl --wait=hv set NB_Global . options:"bfd-min-tx"=1500
- +for chassis in gw1 hv1 hv2; do
- + echo "checking gw2 -> $chassis"
- + OVS_WAIT_UNTIL([
- + bfd_cfg=$(ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0)
- + test "$bfd_cfg" = "enable=true min_rx=2000 min_tx=1500"
- +])
- +done
- +ovn-nbctl remove NB_Global . options "bfd-min-rx"
- +ovn-nbctl --wait=hv set NB_Global . options:"bfd-mult"=5
- +for chassis in gw1 hv1 hv2; do
- + echo "checking gw2 -> $chassis"
- + OVS_WAIT_UNTIL([
- + bfd_cfg=$(ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0)
- + test "$bfd_cfg" = "enable=true min_tx=1500 mult=5"
- +])
- +done
- +
- OVN_CLEANUP([gw1],[gw2],[hv1],[hv2])
- AT_CLEANUP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement