Message ID | 20210915142213.25413-1-dceara@redhat.com |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev] binding: Store timestamp at which ovn-installed was set. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
ovsrobot/github-robot-_ovn-kubernetes | success | github build: passed |
On Wed, Sep 15, 2021 at 10:22 AM Dumitru Ceara <dceara@redhat.com> wrote: > > CMSs (e.g., ovn-kubernetes) already use the ovn-installed > external_id set by ovn-controller in OVS.Interface.external_ids to > determine that the networking for a VIF is completely plugged. > > ovn-controller now also stores the timestamp (in milliseconds since the > epoch) at which an interface was marked as "installed", as the > ovn-installed-ts external id in the OVS DB. > > This commit also adds the relevant documentation for > ovn-installed/ovn-installed-ts. > > Signed-off-by: Dumitru Ceara <dceara@redhat.com> Thanks. Applied. Numan > --- > controller/binding.c | 7 ++++++- > controller/binding.h | 3 ++- > controller/if-status.c | 6 +++++- > controller/ovn-controller.8.xml | 15 +++++++++++++++ > 4 files changed, 28 insertions(+), 3 deletions(-) > > diff --git a/controller/binding.c b/controller/binding.c > index 34935bb9c..c037b2352 100644 > --- a/controller/binding.c > +++ b/controller/binding.c > @@ -44,6 +44,7 @@ VLOG_DEFINE_THIS_MODULE(binding); > * flows have been installed. > */ > #define OVN_INSTALLED_EXT_ID "ovn-installed" > +#define OVN_INSTALLED_TS_EXT_ID "ovn-installed-ts" > > #define OVN_QOS_TYPE "linux-htb" > > @@ -712,7 +713,8 @@ local_binding_is_down(struct shash *local_bindings, const char *pb_name) > > void > local_binding_set_up(struct shash *local_bindings, const char *pb_name, > - bool sb_readonly, bool ovs_readonly) > + const char *ts_now_str, bool sb_readonly, > + bool ovs_readonly) > { > struct local_binding *lbinding = > local_binding_find(local_bindings, pb_name); > @@ -725,6 +727,9 @@ local_binding_set_up(struct shash *local_bindings, const char *pb_name, > ovsrec_interface_update_external_ids_setkey(lbinding->iface, > OVN_INSTALLED_EXT_ID, > "true"); > + ovsrec_interface_update_external_ids_setkey(lbinding->iface, > + OVN_INSTALLED_TS_EXT_ID, > + ts_now_str); > } > > if (!sb_readonly && lbinding && b_lport && b_lport->pb->n_up > diff --git a/controller/binding.h b/controller/binding.h > index f1abc4b9c..70cc37c78 100644 > --- a/controller/binding.h > +++ b/controller/binding.h > @@ -120,7 +120,8 @@ ofp_port_t local_binding_get_lport_ofport(const struct shash *local_bindings, > bool local_binding_is_up(struct shash *local_bindings, const char *pb_name); > bool local_binding_is_down(struct shash *local_bindings, const char *pb_name); > void local_binding_set_up(struct shash *local_bindings, const char *pb_name, > - bool sb_readonly, bool ovs_readonly); > + const char *ts_now_str, bool sb_readonly, > + bool ovs_readonly); > void local_binding_set_down(struct shash *local_bindings, const char *pb_name, > bool sb_readonly, bool ovs_readonly); > > diff --git a/controller/if-status.c b/controller/if-status.c > index 08fb50b87..b5a4025fc 100644 > --- a/controller/if-status.c > +++ b/controller/if-status.c > @@ -21,6 +21,7 @@ > > #include "lib/hmapx.h" > #include "lib/util.h" > +#include "timeval.h" > #include "openvswitch/vlog.h" > > VLOG_DEFINE_THIS_MODULE(if_status); > @@ -398,11 +399,14 @@ if_status_mgr_update_bindings(struct if_status_mgr *mgr, > * their flows installed but are not yet marked "up" in the binding > * module. > */ > + char *ts_now_str = xasprintf("%lld", time_wall_msec()); > HMAPX_FOR_EACH (node, &mgr->ifaces_per_state[OIF_MARK_UP]) { > struct ovs_iface *iface = node->data; > > - local_binding_set_up(bindings, iface->id, sb_readonly, ovs_readonly); > + local_binding_set_up(bindings, iface->id, ts_now_str, > + sb_readonly, ovs_readonly); > } > + free(ts_now_str); > > /* Notify the binding module to set "down" all bindings that have been > * released but are not yet marked as "down" in the binding module. > diff --git a/controller/ovn-controller.8.xml b/controller/ovn-controller.8.xml > index 5a649ee65..8c180f576 100644 > --- a/controller/ovn-controller.8.xml > +++ b/controller/ovn-controller.8.xml > @@ -471,6 +471,21 @@ > flows have been successfully installed in OVS. > </p> > </dd> > + > + <dt> > + <code>external_ids:ovn-installed</code> and > + <code>external_ids:ovn-installed-ts</code> in the > + <code>Interface</code> table > + </dt> > + > + <dd> > + <p> > + This key is set after all openflow operations corresponding to the > + OVS interface have been processed by ovs-vswitchd. At the same time > + a timestamp, in milliseconds since the epoch, is stored in > + <code>external_ids:ovn-installed-ts</code>. > + </p> > + </dd> > </dl> > > <h1>OVN Southbound Database Usage</h1> > -- > 2.27.0 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev >
diff --git a/controller/binding.c b/controller/binding.c index 34935bb9c..c037b2352 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -44,6 +44,7 @@ VLOG_DEFINE_THIS_MODULE(binding); * flows have been installed. */ #define OVN_INSTALLED_EXT_ID "ovn-installed" +#define OVN_INSTALLED_TS_EXT_ID "ovn-installed-ts" #define OVN_QOS_TYPE "linux-htb" @@ -712,7 +713,8 @@ local_binding_is_down(struct shash *local_bindings, const char *pb_name) void local_binding_set_up(struct shash *local_bindings, const char *pb_name, - bool sb_readonly, bool ovs_readonly) + const char *ts_now_str, bool sb_readonly, + bool ovs_readonly) { struct local_binding *lbinding = local_binding_find(local_bindings, pb_name); @@ -725,6 +727,9 @@ local_binding_set_up(struct shash *local_bindings, const char *pb_name, ovsrec_interface_update_external_ids_setkey(lbinding->iface, OVN_INSTALLED_EXT_ID, "true"); + ovsrec_interface_update_external_ids_setkey(lbinding->iface, + OVN_INSTALLED_TS_EXT_ID, + ts_now_str); } if (!sb_readonly && lbinding && b_lport && b_lport->pb->n_up diff --git a/controller/binding.h b/controller/binding.h index f1abc4b9c..70cc37c78 100644 --- a/controller/binding.h +++ b/controller/binding.h @@ -120,7 +120,8 @@ ofp_port_t local_binding_get_lport_ofport(const struct shash *local_bindings, bool local_binding_is_up(struct shash *local_bindings, const char *pb_name); bool local_binding_is_down(struct shash *local_bindings, const char *pb_name); void local_binding_set_up(struct shash *local_bindings, const char *pb_name, - bool sb_readonly, bool ovs_readonly); + const char *ts_now_str, bool sb_readonly, + bool ovs_readonly); void local_binding_set_down(struct shash *local_bindings, const char *pb_name, bool sb_readonly, bool ovs_readonly); diff --git a/controller/if-status.c b/controller/if-status.c index 08fb50b87..b5a4025fc 100644 --- a/controller/if-status.c +++ b/controller/if-status.c @@ -21,6 +21,7 @@ #include "lib/hmapx.h" #include "lib/util.h" +#include "timeval.h" #include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(if_status); @@ -398,11 +399,14 @@ if_status_mgr_update_bindings(struct if_status_mgr *mgr, * their flows installed but are not yet marked "up" in the binding * module. */ + char *ts_now_str = xasprintf("%lld", time_wall_msec()); HMAPX_FOR_EACH (node, &mgr->ifaces_per_state[OIF_MARK_UP]) { struct ovs_iface *iface = node->data; - local_binding_set_up(bindings, iface->id, sb_readonly, ovs_readonly); + local_binding_set_up(bindings, iface->id, ts_now_str, + sb_readonly, ovs_readonly); } + free(ts_now_str); /* Notify the binding module to set "down" all bindings that have been * released but are not yet marked as "down" in the binding module. diff --git a/controller/ovn-controller.8.xml b/controller/ovn-controller.8.xml index 5a649ee65..8c180f576 100644 --- a/controller/ovn-controller.8.xml +++ b/controller/ovn-controller.8.xml @@ -471,6 +471,21 @@ flows have been successfully installed in OVS. </p> </dd> + + <dt> + <code>external_ids:ovn-installed</code> and + <code>external_ids:ovn-installed-ts</code> in the + <code>Interface</code> table + </dt> + + <dd> + <p> + This key is set after all openflow operations corresponding to the + OVS interface have been processed by ovs-vswitchd. At the same time + a timestamp, in milliseconds since the epoch, is stored in + <code>external_ids:ovn-installed-ts</code>. + </p> + </dd> </dl> <h1>OVN Southbound Database Usage</h1>
CMSs (e.g., ovn-kubernetes) already use the ovn-installed external_id set by ovn-controller in OVS.Interface.external_ids to determine that the networking for a VIF is completely plugged. ovn-controller now also stores the timestamp (in milliseconds since the epoch) at which an interface was marked as "installed", as the ovn-installed-ts external id in the OVS DB. This commit also adds the relevant documentation for ovn-installed/ovn-installed-ts. Signed-off-by: Dumitru Ceara <dceara@redhat.com> --- controller/binding.c | 7 ++++++- controller/binding.h | 3 ++- controller/if-status.c | 6 +++++- controller/ovn-controller.8.xml | 15 +++++++++++++++ 4 files changed, 28 insertions(+), 3 deletions(-)