ovs-vsctl: Make "ovs-vsctl get <table> <record> _uuid" work.
authorBen Pfaff <blp@nicira.com>
Thu, 24 Jun 2010 23:06:07 +0000 (16:06 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 25 Jun 2010 00:12:57 +0000 (17:12 -0700)
Requested-by: Sean Brady <sbrady@gtfservices.com>
tests/ovs-vsctl.at
utilities/ovs-vsctl.c

index a8deb1a8417d6e5a5bd24bbbe0e974b80e375137..2923649adc24d9999ee8e48fa21d89674e0fc36f 100644 (file)
@@ -567,7 +567,7 @@ OVS_VSCTL_SETUP
 AT_CHECK([RUN_OVS_VSCTL([create b name=br0])], 
   [0], [stdout], [], [OVS_VSCTL_CLEANUP])
 cp stdout out1
-AT_CHECK([RUN_OVS_VSCTL([list b])], 
+AT_CHECK([RUN_OVS_VSCTL([list b], [get b br0 _uuid])], 
   [0], [stdout], [], [OVS_VSCTL_CLEANUP])
 cp stdout out2
 AT_CHECK([perl $srcdir/uuidfilt.pl out1 out2], [0], 
@@ -584,6 +584,7 @@ netflow             : []
 other_config        : {}
 ports               : []
 sflow               : []
+<0>
 ]], [ignore], [test ! -e pid || kill `cat pid`])
 AT_CHECK(
   [RUN_OVS_VSCTL(
index 9d34267b9ed4f30820fb766e5e7d9ef12836951f..2f78a53bcfe74be44a6fa654d7be75e8cd2ced8e 100644 (file)
@@ -2209,6 +2209,15 @@ cmd_get(struct vsctl_context *ctx)
         struct ovsdb_datum datum;
         char *key_string;
 
+        /* Special case for obtaining the UUID of a row.  We can't just do this
+         * through parse_column_key_value() below since it returns a "struct
+         * ovsdb_idl_column" and the UUID column doesn't have one. */
+        if (!strcasecmp(ctx->argv[i], "_uuid")
+            || !strcasecmp(ctx->argv[i], "-uuid")) {
+            ds_put_format(out, UUID_FMT"\n", UUID_ARGS(&row->uuid));
+            continue;
+        }
+
         die_if_error(parse_column_key_value(ctx->argv[i], table,
                                             &column, &key_string, NULL));