From: Ben Pfaff Date: Thu, 4 Feb 2010 22:34:01 +0000 (-0800) Subject: ovsdb: Fix result object for "declare" operation. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f89d8180056ed6c217f075f0130a26d4b64bc70c;p=openvswitch ovsdb: Fix result object for "declare" operation. The "declare" operation is specified to return a , 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. --- diff --git a/ovsdb/execution.c b/ovsdb/execution.c index 514a2784..ba8351da 100644 --- a/ovsdb/execution.c +++ b/ovsdb/execution.c @@ -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; } diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at index dcf3efc4..0be2a11e 100644 --- a/tests/ovsdb-idl.at +++ b/tests/ovsdb-idl.at @@ -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>