On Tue, Feb 18, 2020 at 03:24:25PM +0800, Tao YunXiang wrote:
> Commit a529e3cd1f (ovsdb-server: Allow OVSDB clients to specify the
> UUID for inserted rows) solves ovsdb-client specifing the UUID for
> insert operation. OVSDB now can support directly using uuid to identify
> a row. But for xxxctl tool,specifying uuid when creating a row is not
> yet supported . This patch tried to specify uuid when creating a row
> by the ctl tools. A new parameter --row_uuid is added to setup row's UUID.
> e.g. ovn-nbctl --row_uuid=3da0398b-a5a8-4bc9-808d-fa662865138f create
> logical_switch name='abc'
>
> Co-authored-by: Liu Chang <[email protected]>
> Co-authored-by: Rong Yin <[email protected]>
> Signed-off-by: Tao YunXiang <[email protected]>
> Signed-off-by: Liu Chang <[email protected]>
> Signed-off-by: Rong Yin <[email protected]>
>
> CC: Han Zhou <[email protected]>
You can squash in the following to get the effect I suggested earlier.
diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index c8f207e4ebaa..bfd89724e4af 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -3696,7 +3696,9 @@ ovsdb_idl_txn_get_row(const struct ovsdb_idl_txn *txn,
const struct uuid *uuid)
static struct json *
substitute_uuids(struct json *json, const struct ovsdb_idl_txn *txn)
{
- if (json->type == JSON_ARRAY) {
+ if (txn->uuid_specified) {
+ return json;
+ } else if (json->type == JSON_ARRAY) {
struct uuid uuid;
size_t i;
@@ -4160,14 +4162,14 @@ ovsdb_idl_txn_commit(struct ovsdb_idl_txn *txn)
any_updates = true;
- json_object_put(op, "uuid-name",
- json_string_create_nocopy(
- ovsdb_data_row_name(&row->uuid)));
-
if (txn->uuid_specified) {
json_object_put(op, "uuid",
json_string_create_nocopy(
xasprintf(UUID_FMT,
UUID_ARGS(&row->uuid))));
+ } else {
+ json_object_put(op, "uuid-name",
+ json_string_create_nocopy(
+ ovsdb_data_row_name(&row->uuid)));
}
insert = xmalloc(sizeof *insert);
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev