summaryrefslogtreecommitdiff
path: root/ovn
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2016-06-23 17:00:51 -0700
committerBen Pfaff <blp@ovn.org>2016-06-23 20:33:09 -0700
commit9a33cd70f4f8bf5922ef05caf32e6da748c57f1a (patch)
treecab55b66f1d4cea17e2dccda5f9b5b823839e001 /ovn
parent6cf888b821cffb75c5723ee76b7103e54b8fa2b5 (diff)
downloadopenvswitch-9a33cd70f4f8bf5922ef05caf32e6da748c57f1a.tar.gz
ovn-controller: Use new ovsdb-idl helpers to make logic more readable.
Also there were lots of 'continue's sprinkled around that didn't seem to be needed given some simple code rearrangement. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com>
Diffstat (limited to 'ovn')
-rw-r--r--ovn/controller/binding.c11
-rw-r--r--ovn/controller/encaps.c19
-rw-r--r--ovn/controller/lport.c18
3 files changed, 15 insertions, 33 deletions
diff --git a/ovn/controller/binding.c b/ovn/controller/binding.c
index e36c8f4af..9921a4924 100644
--- a/ovn/controller/binding.c
+++ b/ovn/controller/binding.c
@@ -266,15 +266,12 @@ binding_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int,
process_full_binding = false;
} else {
SBREC_PORT_BINDING_FOR_EACH_TRACKED(binding_rec, ctx->ovnsb_idl) {
- bool is_deleted = sbrec_port_binding_row_get_seqno(binding_rec,
- OVSDB_IDL_CHANGE_DELETE) > 0;
-
- if (is_deleted) {
+ if (sbrec_port_binding_is_deleted(binding_rec)) {
remove_local_datapath_by_binding(local_datapaths, binding_rec);
- continue;
+ } else {
+ consider_local_datapath(ctx, &lports, chassis_rec, binding_rec,
+ local_datapaths);
}
- consider_local_datapath(ctx, &lports, chassis_rec, binding_rec,
- local_datapaths);
}
}
diff --git a/ovn/controller/encaps.c b/ovn/controller/encaps.c
index 495f8f6f2..18268a6dc 100644
--- a/ovn/controller/encaps.c
+++ b/ovn/controller/encaps.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015 Nicira, Inc.
+/* Copyright (c) 2015, 2016 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -404,12 +404,7 @@ encaps_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int,
process_full_encaps = false;
} else {
SBREC_CHASSIS_FOR_EACH_TRACKED (chassis_rec, ctx->ovnsb_idl) {
- bool is_deleted = sbrec_chassis_row_get_seqno(chassis_rec,
- OVSDB_IDL_CHANGE_DELETE) > 0;
- bool is_new = sbrec_chassis_row_get_seqno(chassis_rec,
- OVSDB_IDL_CHANGE_MODIFY) == 0;
-
- if (is_deleted) {
+ if (sbrec_chassis_is_deleted(chassis_rec)) {
/* Lookup the tunnel by row uuid and remove it. */
struct port_hash_node *port_hash =
port_lookup_by_uuid(&tc.tunnel_hmap_by_uuid,
@@ -424,14 +419,10 @@ encaps_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int,
free(port_hash);
binding_reset_processing();
}
- continue;
- }
- if (!is_new) {
- check_and_update_tunnel(chassis_rec);
- continue;
- } else {
+ } else if (sbrec_chassis_is_new(chassis_rec)) {
check_and_add_tunnel(chassis_rec, chassis_id);
- continue;
+ } else {
+ check_and_update_tunnel(chassis_rec);
}
}
}
diff --git a/ovn/controller/lport.c b/ovn/controller/lport.c
index 2ce638784..a5e9ad35e 100644
--- a/ovn/controller/lport.c
+++ b/ovn/controller/lport.c
@@ -107,14 +107,11 @@ lport_index_fill(struct lport_index *lports, struct ovsdb_idl *ovnsb_idl)
full_lport_rebuild = false;
} else {
SBREC_PORT_BINDING_FOR_EACH_TRACKED (pb, ovnsb_idl) {
- bool is_delete = sbrec_port_binding_row_get_seqno(pb,
- OVSDB_IDL_CHANGE_DELETE) > 0;
-
- if (is_delete) {
+ if (sbrec_port_binding_is_deleted(pb)) {
lport_index_remove(lports, &pb->header_.uuid);
- continue;
+ } else {
+ consider_lport_index(lports, pb);
}
- consider_lport_index(lports, pb);
}
}
}
@@ -248,14 +245,11 @@ mcgroup_index_fill(struct mcgroup_index *mcgroups, struct ovsdb_idl *ovnsb_idl)
full_mc_rebuild = false;
} else {
SBREC_MULTICAST_GROUP_FOR_EACH_TRACKED (mg, ovnsb_idl) {
- bool is_delete = sbrec_multicast_group_row_get_seqno(mg,
- OVSDB_IDL_CHANGE_DELETE) > 0;
-
- if (is_delete) {
+ if (sbrec_multicast_group_is_deleted(mg)) {
mcgroup_index_remove(mcgroups, &mg->header_.uuid);
- continue;
+ } else {
+ consider_mcgroup_index(mcgroups, mg);
}
- consider_mcgroup_index(mcgroups, mg);
}
}
}