summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Sitnicki <jkbs@redhat.com>2017-09-29 17:05:22 +0200
committerBen Pfaff <blp@ovn.org>2017-11-28 12:58:20 -0800
commit7ec80bfb00f4d3a0a21acea448f1064a980be796 (patch)
treee48f0401d15a3508db0750411b8381be222eed95
parentc4c5da914f5135e86007044764fca844189eeca8 (diff)
downloadopenvswitch-7ec80bfb00f4d3a0a21acea448f1064a980be796.tar.gz
ovn-northd: Refactor logic for logical port 'up' state update
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@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Mark Michelson <mmichels@redhat.com> Acked-by: Miguel Angel Ajo <majopela@redhat.com>
-rw-r--r--ovn/northd/ovn-northd.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index 4d7189b52..11339c740 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -5265,11 +5265,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);
}
}