Skip to content

Commit

Permalink
ovn: Minor refactoring.
Browse files Browse the repository at this point in the history
This commit applies a minor restructuring of this code to put the
localnet port specific code in its own block.  This is mostly to make a
future patch easier to read.

Signed-off-by: Russell Bryant <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
russellb committed Mar 31, 2016
1 parent a4927e3 commit 1021e19
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions ovn/controller/patch.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,32 +175,32 @@ add_bridge_mappings(struct controller_ctx *ctx,

const struct sbrec_port_binding *binding;
SBREC_PORT_BINDING_FOR_EACH (binding, ctx->ovnsb_idl) {
if (strcmp(binding->type, "localnet")) {
if (!strcmp(binding->type, "localnet")) {
struct local_datapath *ld;
ld = CONTAINER_OF(hmap_first_with_hash(local_datapaths,
binding->datapath->tunnel_key),
struct local_datapath, hmap_node);
if (!ld) {
/* This localnet port is on a datapath with no
* logical ports bound to this chassis, so there's no need
* to create patch ports for it. */
continue;
}
if (ld->localnet_port) {
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1);
VLOG_WARN_RL(&rl, "localnet port '%s' already set for datapath "
"'%"PRId64"', skipping the new port '%s'.",
ld->localnet_port->logical_port,
binding->datapath->tunnel_key,
binding->logical_port);
continue;
}
ld->localnet_port = binding;
} else {
/* Not a binding for a localnet port. */
continue;
}

struct local_datapath *ld;
ld = CONTAINER_OF(hmap_first_with_hash(local_datapaths,
binding->datapath->tunnel_key),
struct local_datapath, hmap_node);
if (!ld) {
/* This localnet port is on a datapath with no
* logical ports bound to this chassis, so there's no need
* to create patch ports for it. */
continue;
}
if (ld->localnet_port) {
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1);
VLOG_WARN_RL(&rl, "localnet port '%s' already set for datapath "
"'%"PRId64"', skipping the new port '%s'.",
ld->localnet_port->logical_port,
binding->datapath->tunnel_key,
binding->logical_port);
continue;
}
ld->localnet_port = binding;

const char *network = smap_get(&binding->options, "network_name");
if (!network) {
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1);
Expand Down

0 comments on commit 1021e19

Please sign in to comment.