ovsdb: Fix result object for "declare" operation.
authorBen Pfaff <blp@nicira.com>
Thu, 4 Feb 2010 22:34:01 +0000 (14:34 -0800)
committerBen Pfaff <blp@nicira.com>
Mon, 8 Feb 2010 22:16:18 +0000 (14:16 -0800)
The "declare" operation is specified to return a <uuid>, e.g.:
["uuid", "7b703002-f7b6-45c6-bfd6-7619b21a1a5f"]
It was actually just returning the second part, e.g.
"7b703002-f7b6-45c6-bfd6-7619b21a1a5f"

This commit makes the result match the specification.

ovsdb/execution.c
tests/ovsdb-idl.at

index 514a278481f6ee8873ebe681e1e512176d1f490e..ba8351da757a27127630eb537629642d26102323 100644 (file)
@@ -686,8 +686,11 @@ ovsdb_execute_declare(struct ovsdb_execution *x, struct ovsdb_parser *parser,
 
     uuid_generate(&uuid);
     ovsdb_symbol_table_put(x->symtab, json_string(uuid_name), &uuid, false);
-    json_object_put(result, "uuid", json_string_create_nocopy(
-                        xasprintf(UUID_FMT, UUID_ARGS(&uuid))));
+    json_object_put(result, "uuid",
+                    json_array_create_2(
+                        json_string_create("uuid"),
+                        json_string_create_nocopy(
+                            xasprintf(UUID_FMT, UUID_ARGS(&uuid)))));
     return NULL;
 }
 
index dcf3efc4e19f114f6b1c7eb6accd02b86728839f..0be2a11e14ab1c0d2bc66d9c8f1125452d81b952 100644 (file)
@@ -207,7 +207,7 @@ OVSDB_CHECK_IDL([self-linking idl, consistent ops],
   [[000: empty
 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]}
 002: i=0 k=0 ka=[] l2= uuid=<0>
-003: {"error":null,"result":[{"uuid":"<1>"},{"uuid":"<2>"},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]}
+003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]}
 004: i=0 k=0 ka=[] l2= uuid=<0>
 004: i=1 k=2 ka=[] l2= uuid=<1>
 004: i=2 k=1 ka=[] l2= uuid=<2>