Skip to content
Permalink
Browse files

ovn-northd: Copy name in logical datapath southbound representations.

This makes it easier to debug based on the southbound database without
looking at the northbound representation.  This commit adds the name
to "ovn-sbctl dump-flows" output and it will be even more useful in
an upcoming commit.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Ryan Moats <rmoats@us.ibm.com>
Acked-by: Justin Pettit <jpettit@ovn.org>
  • Loading branch information...
blp committed Aug 2, 2016
1 parent 67842eb commit 0f8e9c126ba36041d2f446f2a661a7c603087795
Showing with 28 additions and 5 deletions.
  1. +14 −2 ovn/northd/ovn-northd.c
  2. +7 −0 ovn/ovn-sb.xml
  3. +7 −3 ovn/utilities/ovn-sbctl.c
@@ -518,11 +518,23 @@ build_datapaths(struct northd_context *ctx, struct hmap *datapaths)

od->sb = sbrec_datapath_binding_insert(ctx->ovnsb_txn);

/* Get the logical-switch or logical-router UUID to set in
* external-ids. */
char uuid_s[UUID_LEN + 1];
sprintf(uuid_s, UUID_FMT, UUID_ARGS(&od->key));
const char *key = od->nbs ? "logical-switch" : "logical-router";
const struct smap id = SMAP_CONST1(&id, key, uuid_s);
sbrec_datapath_binding_set_external_ids(od->sb, &id);

/* Get name to set in external-ids. */
const char *name = od->nbs ? od->nbs->name : od->nbr->name;

/* Set external-ids. */
struct smap ids = SMAP_INITIALIZER(&ids);
smap_add(&ids, key, uuid_s);
if (*name) {
smap_add(&ids, "name", name);
}
sbrec_datapath_binding_set_external_ids(od->sb, &ids);
smap_destroy(&ids);

sbrec_datapath_binding_set_tunnel_key(od->sb, tunnel_key);
}
@@ -1524,6 +1524,13 @@ tcp.flags = RST;
corresponding <ref table="Logical_Router" db="OVN_Northbound"/> row in
the <ref db="OVN_Northbound"/> database.
</column>

<column name="external_ids" key="name">
<code>ovn-northd</code> copies this from the <ref
table="Logical_Router" db="OVN_Northbound"/> or <ref
table="Logical_Switch" db="OVN_Northbound"/> table in the <ref
db="OVN_Northbound"/> database, when that column is nonempty.
</column>
</group>

<group title="Common Columns">
@@ -489,6 +489,8 @@ pre_get_info(struct ctl_context *ctx)
ovsdb_idl_add_column(ctx->idl, &sbrec_logical_flow_col_table_id);
ovsdb_idl_add_column(ctx->idl, &sbrec_logical_flow_col_match);
ovsdb_idl_add_column(ctx->idl, &sbrec_logical_flow_col_external_ids);

ovsdb_idl_add_column(ctx->idl, &sbrec_datapath_binding_col_external_ids);
}

static struct cmd_show_table cmd_show_tables[] = {
@@ -719,9 +721,11 @@ cmd_lflow_list(struct ctl_context *ctx)
continue;
}
if (strcmp(cur_pipeline, lflow->pipeline)) {
printf("Datapath: " UUID_FMT " Pipeline: %s\n",
UUID_ARGS(&lflow->logical_datapath->header_.uuid),
lflow->pipeline);
printf("Datapath: \"%s\" ("UUID_FMT") Pipeline: %s\n",
smap_get_def(&lflow->logical_datapath->external_ids,
"name", ""),
UUID_ARGS(&lflow->logical_datapath->header_.uuid),
lflow->pipeline);
cur_pipeline = lflow->pipeline;
}

0 comments on commit 0f8e9c1

Please sign in to comment.
You can’t perform that action at this time.