Re: [ovs-dev] [PATCH ovn v2] ovn-controller: Propagate nb_cfg to the local OVS DB.
On 11/19/20 8:31 AM, Numan Siddique wrote: > On Wed, Nov 18, 2020 at 6:27 PM Dumitru Ceara wrote: >> >> The NB.NB_Global.nb_cfg value gets propagated to >> Chassis_Private.nb_cfg (and then to NB.NB_Global.hv_cfg) as soon as >> ovn-controller has finished installing OVS flows corresponding to >> the NB DB state. >> >> However, if the CMS runs monitoring applications on the chassis itself, >> in order to detect that the NB changes have been applied, it has to >> connect to the NB/SB database. In a scaled deployment this additional >> connection might induce performance issues. >> >> In order to avoid that we now (also) propagate nb_cfg to the local OVS >> DB, in the record corresponding to the integration bridge in table >> Bridge, as external_id "ovn-nb-cfg". >> >> Signed-off-by: Dumitru Ceara > > Thanks for v2. I applied this patch to master. > Thanks! ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Re: [ovs-dev] [PATCH ovn v2] ovn-controller: Propagate nb_cfg to the local OVS DB.
On Wed, Nov 18, 2020 at 6:27 PM Dumitru Ceara wrote: > > The NB.NB_Global.nb_cfg value gets propagated to > Chassis_Private.nb_cfg (and then to NB.NB_Global.hv_cfg) as soon as > ovn-controller has finished installing OVS flows corresponding to > the NB DB state. > > However, if the CMS runs monitoring applications on the chassis itself, > in order to detect that the NB changes have been applied, it has to > connect to the NB/SB database. In a scaled deployment this additional > connection might induce performance issues. > > In order to avoid that we now (also) propagate nb_cfg to the local OVS > DB, in the record corresponding to the integration bridge in table > Bridge, as external_id "ovn-nb-cfg". > > Signed-off-by: Dumitru Ceara Thanks for v2. I applied this patch to master. Numan > --- > V2: > - Addressed Numan's comments: > - Update ovn-controller doc. > - Store the seqno in OVS..external_ids:ovn-nb-cfg. > - Update NEWS. > --- > NEWS| 2 ++ > controller/ovn-controller.8.xml | 12 ++ > controller/ovn-controller.c | 51 > ++--- > tests/ovn-controller.at | 21 + > 4 files changed, 73 insertions(+), 13 deletions(-) > > diff --git a/NEWS b/NEWS > index 6010230..a681573 100644 > --- a/NEWS > +++ b/NEWS > @@ -8,6 +8,8 @@ Post-v20.09.0 > server. > - Support other_config:vlan-passthru=true to allow VLAN tagged incoming > traffic. > + - Propagate currently processed SB_Global.nb_cfg in ovn-controller to the > + local OVS DB integration bridge external_ids:ovn-nb-cfg. > > OVN v20.09.0 - 28 Sep 2020 > -- > diff --git a/controller/ovn-controller.8.xml b/controller/ovn-controller.8.xml > index 16bc47b..0d57355 100644 > --- a/controller/ovn-controller.8.xml > +++ b/controller/ovn-controller.8.xml > @@ -378,6 +378,18 @@ >logical patch port that it implements. > > > + > + > +external-ids:ovn-nb-cfg in the Bridge table > + > + > + > + > + This key represents the last known > + OVN_Southbound.SB_Global.nb_cfg value for which all > + flows have been successfully installed in OVS. > + > + > > > OVN Southbound Database Usage > diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c > index 25de0c7..70a193b 100644 > --- a/controller/ovn-controller.c > +++ b/controller/ovn-controller.c > @@ -85,6 +85,8 @@ static unixctl_cb_func debug_delay_nb_cfg_report; > > #define CONTROLLER_LOOP_STOPWATCH_NAME "ovn-controller-flow-generation" > > +#define OVS_NB_CFG_NAME "ovn-nb-cfg" > + > static char *parse_options(int argc, char *argv[]); > OVS_NO_RETURN static void usage(void); > > @@ -792,6 +794,40 @@ get_nb_cfg(const struct sbrec_sb_global_table > *sb_global_table) > return sb ? sb->nb_cfg : 0; > } > > +/* Propagates the local cfg seqno, 'cur_cfg', to the chassis_private record > + * and to the local OVS DB. > + */ > +static void > +store_nb_cfg(struct ovsdb_idl_txn *sb_txn, struct ovsdb_idl_txn *ovs_txn, > + const struct sbrec_chassis_private *chassis, > + const struct ovsrec_bridge *br_int, > + unsigned int delay_nb_cfg_report, > + int64_t cur_cfg) > +{ > +if (!cur_cfg) { > +return; > +} > + > +if (sb_txn && chassis && cur_cfg != chassis->nb_cfg) { > +sbrec_chassis_private_set_nb_cfg(chassis, cur_cfg); > +sbrec_chassis_private_set_nb_cfg_timestamp(chassis, > time_wall_msec()); > + > +if (delay_nb_cfg_report) { > +VLOG_INFO("Sleep for %u sec", delay_nb_cfg_report); > +xsleep(delay_nb_cfg_report); > +} > +} > + > +if (ovs_txn && br_int && > +cur_cfg != smap_get_ullong(&br_int->external_ids, > + OVS_NB_CFG_NAME, 0)) { > +char *cur_cfg_str = xasprintf("%"PRId64, cur_cfg); > +ovsrec_bridge_update_external_ids_setkey(br_int, OVS_NB_CFG_NAME, > + cur_cfg_str); > +free(cur_cfg_str); > +} > +} > + > static const char * > get_transport_zones(const struct ovsrec_open_vswitch_table *ovs_table) > { > @@ -2692,19 +2728,8 @@ main(int argc, char *argv[]) > engine_set_force_recompute(false); > } > > -if (ovnsb_idl_txn && chassis_private) { > -int64_t cur_cfg = ofctrl_get_cur_cfg(); > -if (cur_cfg && cur_cfg != chassis_private->nb_cfg) { > -sbrec_chassis_private_set_nb_cfg(chassis_private, > cur_cfg); > -sbrec_chassis_private_set_nb_cfg_timestamp( > -chassis_private, time_wall_msec()); > -if (delay_nb_cfg_report) { > -VLOG_INFO("Sleep for %u sec", delay_nb_cfg_report); > -xsleep(delay_nb_cfg_
[ovs-dev] [PATCH ovn v2] ovn-controller: Propagate nb_cfg to the local OVS DB.
The NB.NB_Global.nb_cfg value gets propagated to Chassis_Private.nb_cfg (and then to NB.NB_Global.hv_cfg) as soon as ovn-controller has finished installing OVS flows corresponding to the NB DB state. However, if the CMS runs monitoring applications on the chassis itself, in order to detect that the NB changes have been applied, it has to connect to the NB/SB database. In a scaled deployment this additional connection might induce performance issues. In order to avoid that we now (also) propagate nb_cfg to the local OVS DB, in the record corresponding to the integration bridge in table Bridge, as external_id "ovn-nb-cfg". Signed-off-by: Dumitru Ceara --- V2: - Addressed Numan's comments: - Update ovn-controller doc. - Store the seqno in OVS..external_ids:ovn-nb-cfg. - Update NEWS. --- NEWS| 2 ++ controller/ovn-controller.8.xml | 12 ++ controller/ovn-controller.c | 51 ++--- tests/ovn-controller.at | 21 + 4 files changed, 73 insertions(+), 13 deletions(-) diff --git a/NEWS b/NEWS index 6010230..a681573 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,8 @@ Post-v20.09.0 server. - Support other_config:vlan-passthru=true to allow VLAN tagged incoming traffic. + - Propagate currently processed SB_Global.nb_cfg in ovn-controller to the + local OVS DB integration bridge external_ids:ovn-nb-cfg. OVN v20.09.0 - 28 Sep 2020 -- diff --git a/controller/ovn-controller.8.xml b/controller/ovn-controller.8.xml index 16bc47b..0d57355 100644 --- a/controller/ovn-controller.8.xml +++ b/controller/ovn-controller.8.xml @@ -378,6 +378,18 @@ logical patch port that it implements. + + +external-ids:ovn-nb-cfg in the Bridge table + + + + + This key represents the last known + OVN_Southbound.SB_Global.nb_cfg value for which all + flows have been successfully installed in OVS. + + OVN Southbound Database Usage diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 25de0c7..70a193b 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -85,6 +85,8 @@ static unixctl_cb_func debug_delay_nb_cfg_report; #define CONTROLLER_LOOP_STOPWATCH_NAME "ovn-controller-flow-generation" +#define OVS_NB_CFG_NAME "ovn-nb-cfg" + static char *parse_options(int argc, char *argv[]); OVS_NO_RETURN static void usage(void); @@ -792,6 +794,40 @@ get_nb_cfg(const struct sbrec_sb_global_table *sb_global_table) return sb ? sb->nb_cfg : 0; } +/* Propagates the local cfg seqno, 'cur_cfg', to the chassis_private record + * and to the local OVS DB. + */ +static void +store_nb_cfg(struct ovsdb_idl_txn *sb_txn, struct ovsdb_idl_txn *ovs_txn, + const struct sbrec_chassis_private *chassis, + const struct ovsrec_bridge *br_int, + unsigned int delay_nb_cfg_report, + int64_t cur_cfg) +{ +if (!cur_cfg) { +return; +} + +if (sb_txn && chassis && cur_cfg != chassis->nb_cfg) { +sbrec_chassis_private_set_nb_cfg(chassis, cur_cfg); +sbrec_chassis_private_set_nb_cfg_timestamp(chassis, time_wall_msec()); + +if (delay_nb_cfg_report) { +VLOG_INFO("Sleep for %u sec", delay_nb_cfg_report); +xsleep(delay_nb_cfg_report); +} +} + +if (ovs_txn && br_int && +cur_cfg != smap_get_ullong(&br_int->external_ids, + OVS_NB_CFG_NAME, 0)) { +char *cur_cfg_str = xasprintf("%"PRId64, cur_cfg); +ovsrec_bridge_update_external_ids_setkey(br_int, OVS_NB_CFG_NAME, + cur_cfg_str); +free(cur_cfg_str); +} +} + static const char * get_transport_zones(const struct ovsrec_open_vswitch_table *ovs_table) { @@ -2692,19 +2728,8 @@ main(int argc, char *argv[]) engine_set_force_recompute(false); } -if (ovnsb_idl_txn && chassis_private) { -int64_t cur_cfg = ofctrl_get_cur_cfg(); -if (cur_cfg && cur_cfg != chassis_private->nb_cfg) { -sbrec_chassis_private_set_nb_cfg(chassis_private, cur_cfg); -sbrec_chassis_private_set_nb_cfg_timestamp( -chassis_private, time_wall_msec()); -if (delay_nb_cfg_report) { -VLOG_INFO("Sleep for %u sec", delay_nb_cfg_report); -xsleep(delay_nb_cfg_report); -} -} -} - +store_nb_cfg(ovnsb_idl_txn, ovs_idl_txn, chassis_private, + br_int, delay_nb_cfg_report, ofctrl_get_cur_cfg()); if (pending_pkt.conn) { struct ed_type_addr_sets *as_data = diff --git a/tests/ovn-controller.at b/tests/ovn-controlle