[ovs-dev,ovn] ovn-northd: Clarify lsp's 'enabled' and 'up' column handling.
diff mbox series

Message ID 20190809180307.66613-1-jpettit@ovn.org
State Accepted
Headers show
Series
  • [ovs-dev,ovn] ovn-northd: Clarify lsp's 'enabled' and 'up' column handling.
Related show

Commit Message

Justin Pettit Aug. 9, 2019, 6:03 p.m. UTC
Signed-off-by: Justin Pettit <jpettit@ovn.org>
---
 northd/ovn-northd.c | 8 ++++++--
 ovn-nb.xml          | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

Comments

Numan Siddique Aug. 9, 2019, 6:16 p.m. UTC | #1
On Fri, Aug 9, 2019 at 11:33 PM Justin Pettit <jpettit@ovn.org> wrote:

> Signed-off-by: Justin Pettit <jpettit@ovn.org>
>

Thanks. This looks good to me.

Acked-by: Numan Siddique <nusiddiq@redhat.com>



> ---
>  northd/ovn-northd.c | 8 ++++++--
>  ovn-nb.xml          | 1 +
>  2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
> index e6953a405..e86134414 100644
> --- a/northd/ovn-northd.c
> +++ b/northd/ovn-northd.c
> @@ -3488,16 +3488,20 @@ build_port_security_ip(enum ovn_pipeline pipeline,
> struct ovn_port *op,
>
>  }
>
> +/* Returns true if the logical switch port 'enabled' column is empty or
> + * set to true.  Otherwise, returns false. */
>  static bool
>  lsp_is_enabled(const struct nbrec_logical_switch_port *lsp)
>  {
> -    return !lsp->enabled || *lsp->enabled;
> +    return !lsp->n_enabled || *lsp->enabled;
>  }
>
> +/* Returns true only if the logical switch port 'up' column is set to
> true.
> + * Otherwise, if the column is not set or set to false, returns false. */
>  static bool
>  lsp_is_up(const struct nbrec_logical_switch_port *lsp)
>  {
> -    return lsp->up && *lsp->up;
> +    return lsp->n_up && *lsp->up;
>  }
>
>  static bool
> diff --git a/ovn-nb.xml b/ovn-nb.xml
> index f5f10a5c1..e1661907d 100644
> --- a/ovn-nb.xml
> +++ b/ovn-nb.xml
> @@ -730,6 +730,7 @@
>            table="Binding"/> table, <code>ovn-northd</code> sets this
>            column to <code>true</code>; otherwise, or if the port
>            becomes unbound later, it sets it to <code>false</code>.
> +          If this column is empty, the port is not considered up.
>            This allows the CMS to wait for a VM's (or container's)
>            networking to become active before it allows the VM (or
>            container) to start.
> --
> 2.17.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
Justin Pettit Aug. 9, 2019, 8 p.m. UTC | #2
> On Aug 9, 2019, at 11:16 AM, Numan Siddique <nusiddiq@redhat.com> wrote:
> 
>> On Fri, Aug 9, 2019 at 11:33 PM Justin Pettit <jpettit@ovn.org> wrote:
>> Signed-off-by: Justin Pettit <jpettit@ovn.org>
> 
> Thanks. This looks good to me.
> 
> Acked-by: Numan Siddique <nusiddiq@redhat.com>

Thanks.  I pushed this to OVN master and OVS branch-2.12.

--Justin

Patch
diff mbox series

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index e6953a405..e86134414 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -3488,16 +3488,20 @@  build_port_security_ip(enum ovn_pipeline pipeline, struct ovn_port *op,
 
 }
 
+/* Returns true if the logical switch port 'enabled' column is empty or
+ * set to true.  Otherwise, returns false. */
 static bool
 lsp_is_enabled(const struct nbrec_logical_switch_port *lsp)
 {
-    return !lsp->enabled || *lsp->enabled;
+    return !lsp->n_enabled || *lsp->enabled;
 }
 
+/* Returns true only if the logical switch port 'up' column is set to true.
+ * Otherwise, if the column is not set or set to false, returns false. */
 static bool
 lsp_is_up(const struct nbrec_logical_switch_port *lsp)
 {
-    return lsp->up && *lsp->up;
+    return lsp->n_up && *lsp->up;
 }
 
 static bool
diff --git a/ovn-nb.xml b/ovn-nb.xml
index f5f10a5c1..e1661907d 100644
--- a/ovn-nb.xml
+++ b/ovn-nb.xml
@@ -730,6 +730,7 @@ 
           table="Binding"/> table, <code>ovn-northd</code> sets this
           column to <code>true</code>; otherwise, or if the port
           becomes unbound later, it sets it to <code>false</code>.
+          If this column is empty, the port is not considered up.
           This allows the CMS to wait for a VM's (or container's)
           networking to become active before it allows the VM (or
           container) to start.