[ovs-dev] [PATCH 1/2] ovn-northd: Refactor logic for logical port 'up' state update

Jakub Sitnicki jkbs at redhat.com
Fri Sep 29 15:05:22 UTC 2017


No functional change.  Make it obvious that we determine the logical
port 'up' state by checking for bound chassis, and update the NB DB only
when state has not been set yet or current state is different.

Signed-off-by: Jakub Sitnicki <jkbs at redhat.com>
---
 ovn/northd/ovn-northd.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index 2db2380..37651a0 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -5980,11 +5980,8 @@ update_logical_port_status(struct northd_context *ctx)
             continue;
         }
 
-        if (sb->chassis && (!nbsp->up || !*nbsp->up)) {
-            bool up = true;
-            nbrec_logical_switch_port_set_up(nbsp, &up, 1);
-        } else if (!sb->chassis && (!nbsp->up || *nbsp->up)) {
-            bool up = false;
+        bool up = sb->chassis ? true : false;
+        if (!nbsp->up || *nbsp->up != up) {
             nbrec_logical_switch_port_set_up(nbsp, &up, 1);
         }
     }
-- 
2.9.5



More information about the dev mailing list