summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhiPeng Lu <lu.zhipeng@zte.com.cn>2017-07-11 08:47:10 +0800
committerBen Pfaff <blp@ovn.org>2017-07-13 17:17:00 -0700
commit29c7ec8562b6dd373201f31a6d05cd1d46ee9c64 (patch)
tree1997f09cf8666eb68444550a955d461fe5086b7e
parenteb3079929a7ec6a82d62c72e9cbeb2990c74b9d3 (diff)
downloadopenvswitch-29c7ec8562b6dd373201f31a6d05cd1d46ee9c64.tar.gz
db-ctl-base: Fix reference-following feature in get_row_by_id().
If a particular column is supposed to be reached by following a reference from a UUID column, then that really needs to happen; if there's no reference, then we're probably starting from a row in the wrong table. This fixes an assertion failure in command "ovs-vsctl list netflow br0", if bridge br0 without any netflows. $ovs-vsctl list netflow br0 ovs-vsctl: lib/ovsdb-idl.c:2407: assertion column_idx < class->n_columns failed in ovsdb_idl_read() Aborted Fixes: 3f5b5f7b4115 ("db-ctl-base: Always support all tables in schema.") Signed-off-by: Zhipeng Lu <lu.zhipeng@zte.com.cn> Signed-off-by: Ben Pfaff <blp@ovn.org>
-rw-r--r--lib/db-ctl-base.c2
-rw-r--r--tests/ovs-vsctl.at3
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/db-ctl-base.c b/lib/db-ctl-base.c
index afc70eb06..5fcb5939c 100644
--- a/lib/db-ctl-base.c
+++ b/lib/db-ctl-base.c
@@ -295,6 +295,8 @@ get_row_by_id(struct ctl_context *ctx,
if (uuid->n == 1) {
final = ovsdb_idl_get_row_for_uuid(ctx->idl, table,
&uuid->keys[0].uuid);
+ } else {
+ final = NULL;
}
}
return final;
diff --git a/tests/ovs-vsctl.at b/tests/ovs-vsctl.at
index 08eb3287c..8861a4aad 100644
--- a/tests/ovs-vsctl.at
+++ b/tests/ovs-vsctl.at
@@ -775,6 +775,9 @@ AT_CHECK([RUN_OVS_VSCTL([add-br br1])],
[0], [ignore], [], [OVS_VSCTL_CLEANUP])
AT_CHECK([RUN_OVS_VSCTL([set-controller br1 tcp:127.0.0.1])],
[0], [ignore], [], [OVS_VSCTL_CLEANUP])
+AT_CHECK([RUN_OVS_VSCTL([list netflow br0])], [1], [],
+ [ovs-vsctl: no row "br0" in table NetFlow
+], [OVS_VSCTL_CLEANUP])
AT_CHECK([
RUN_OVS_VSCTL_TOGETHER([--id=@n create netflow targets='"1.2.3.4:567"'],
[set bridge br0 netflow=@n])],