The joined schema name currently is taken from any one of the schemas, (actually, it is taken from the first schema on the shash). This won't work since transactions needs to verify schema name.
This patch makes the joined schema name as a comma separated string of names from the original schemas. As long as an operation is against one of the original schemas, it is allowed to proceed. Signed-off-by: Andy Zhou <az...@nicira.com> --- using strstr() for checking is going to be error prone in the long run, but it should be sufficient for the goal of this patch: make ovsdb-tool multi-schema ready. I will revisit this if the schema name concatenation approach looks O.K. --- ovsdb/execution.c | 4 ++-- ovsdb/ovsdb.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ovsdb/execution.c b/ovsdb/execution.c index de25a87..57fc432 100644 --- a/ovsdb/execution.c +++ b/ovsdb/execution.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc. +/* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2015 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -106,7 +106,7 @@ ovsdb_execute(struct ovsdb *db, const struct ovsdb_session *session, if (params->type != JSON_ARRAY || !params->u.array.n || params->u.array.elems[0]->type != JSON_STRING - || strcmp(params->u.array.elems[0]->u.string, db->schema->name)) { + || !strstr(db->schema->name, params->u.array.elems[0]->u.string)) { if (params->type != JSON_ARRAY) { error = ovsdb_syntax_error(params, NULL, "array expected"); } else { diff --git a/ovsdb/ovsdb.c b/ovsdb/ovsdb.c index 9e430ce..39e6103 100644 --- a/ovsdb/ovsdb.c +++ b/ovsdb/ovsdb.c @@ -77,11 +77,21 @@ ovsdb_schema_destroy(struct ovsdb_schema *schema) /* Join two schemas into a single schema, by adding missing tables from 'src' * to 'dst'. In case 'src' and 'dst' both has the same table, the joined 'dst' table - * will contain the columns from both 'src' and 'dst' tables. */ + * will contain the columns from both 'src' and 'dst' tables. + * + * The joined schema name will be the concatenation of each schema's name, + * sperated by a comma and a space. */ static struct ovsdb_error * ovsdb_schema_join(struct ovsdb_schema *dst, const struct ovsdb_schema *src) { struct shash_node *snode; + struct ds ds; + + /* Combine schema names into a comma seperated string. */ + ds_init(&ds); + ds_put_format(&ds, "%s, %s", dst->name, src->name); + free(dst->name); + dst->name = ds_steal_cstr(&ds); SHASH_FOR_EACH (snode, &src->tables) { const struct ovsdb_table_schema *sts = snode->data; -- 1.9.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev