@@ -1054,19 +1054,6 @@ is_binding_lport_this_chassis(struct binding_lport *b_lport,
b_lport->pb->chassis == chassis);
}
-static bool
-can_bind_on_this_chassis(const struct sbrec_chassis *chassis_rec,
- const struct sbrec_port_binding *pb)
-{
- /* We need to check for presence of the requested-chassis option in
- * addittion to checking the pb->requested_chassis column because this
- * column will be set to NULL whenever the option points to a non-existent
- * chassis. As the controller routinely clears its own chassis record this
- * might occur more often than one might think. */
- return !smap_get(&pb->options, "requested-chassis")
- || chassis_rec == pb->requested_chassis;
-}
-
/* Returns 'true' if the 'lbinding' has binding lports of type LP_CONTAINER,
* 'false' otherwise. */
static bool
@@ -1169,7 +1156,7 @@ consider_vif_lport(const struct sbrec_port_binding *pb,
struct local_binding *lbinding,
struct hmap *qos_map)
{
- bool can_bind = can_bind_on_this_chassis(b_ctx_in->chassis_rec, pb);
+ bool can_bind = lport_can_bind_on_this_chassis(b_ctx_in->chassis_rec, pb);
if (!lbinding) {
lbinding = local_binding_find(&b_ctx_out->lbinding_data->bindings,
@@ -1284,7 +1271,7 @@ consider_container_lport(const struct sbrec_port_binding *pb,
}
ovs_assert(parent_b_lport && parent_b_lport->pb);
- bool can_bind = can_bind_on_this_chassis(b_ctx_in->chassis_rec, pb);
+ bool can_bind = lport_can_bind_on_this_chassis(b_ctx_in->chassis_rec, pb);
return consider_vif_lport_(pb, can_bind, b_ctx_in, b_ctx_out,
container_b_lport, qos_map);
@@ -108,6 +108,20 @@ lport_get_l3gw_peer(const struct sbrec_port_binding *pb,
return get_peer_lport(pb, sbrec_port_binding_by_name);
}
+bool
+lport_can_bind_on_this_chassis(const struct sbrec_chassis *chassis_rec,
+ const struct sbrec_port_binding *pb)
+{
+ /* We need to check for presence of the requested-chassis option in
+ * addittion to checking the pb->requested_chassis column because this
+ * column will be set to NULL whenever the option points to a non-existent
+ * chassis. As the controller routinely clears its own chassis record this
+ * might occur more often than one might think. */
+ return !smap_get(&pb->options, "requested-chassis")
+ || chassis_rec == pb->requested_chassis;
+}
+
+
const struct sbrec_datapath_binding *
datapath_lookup_by_key(struct ovsdb_idl_index *sbrec_datapath_binding_by_key,
uint64_t dp_key)
@@ -43,6 +43,9 @@ const struct sbrec_port_binding *lport_lookup_by_key(
struct ovsdb_idl_index *sbrec_port_binding_by_key,
uint64_t dp_key, uint64_t port_key);
+bool lport_can_bind_on_this_chassis(const struct sbrec_chassis *chassis_rec,
+ const struct sbrec_port_binding *pb);
+
const struct sbrec_datapath_binding *datapath_lookup_by_key(
struct ovsdb_idl_index *sbrec_datapath_binding_by_key, uint64_t dp_key);
The `can_bind_on_this_chassis` helper is useful outside of the binding module. Since it is related to lports renaming it to `lport_can_bind_on_this_chassis` and putting it into the lport module appears to be appropriate. Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com> --- controller/binding.c | 17 ++--------------- controller/lport.c | 14 ++++++++++++++ controller/lport.h | 3 +++ 3 files changed, 19 insertions(+), 15 deletions(-)