The name 'created' better reflects the actual meaning of this member: in
both ovsdb and ovs-vsctl, it is true if a row has been created with the
symbol's UUID and false otherwise.
struct ovsdb_symbol *
ovsdb_symbol_table_put(struct ovsdb_symbol_table *symtab, const char *name,
struct ovsdb_symbol *
ovsdb_symbol_table_put(struct ovsdb_symbol_table *symtab, const char *name,
- const struct uuid *uuid, bool used)
+ const struct uuid *uuid, bool created)
{
struct ovsdb_symbol *symbol;
assert(!ovsdb_symbol_table_get(symtab, name));
symbol = xmalloc(sizeof *symbol);
symbol->uuid = *uuid;
{
struct ovsdb_symbol *symbol;
assert(!ovsdb_symbol_table_get(symtab, name));
symbol = xmalloc(sizeof *symbol);
symbol->uuid = *uuid;
+ symbol->created = created;
shash_add(&symtab->sh, name, symbol);
return symbol;
}
shash_add(&symtab->sh, name, symbol);
return symbol;
}
-ovsdb_symbol_table_find_unused(const struct ovsdb_symbol_table *symtab)
+ovsdb_symbol_table_find_uncreated(const struct ovsdb_symbol_table *symtab)
{
struct shash_node *node;
SHASH_FOR_EACH (node, &symtab->sh) {
struct ovsdb_symbol *symbol = node->data;
{
struct shash_node *node;
SHASH_FOR_EACH (node, &symtab->sh) {
struct ovsdb_symbol *symbol = node->data;
+ if (!symbol->created) {
struct ovsdb_symbol {
struct uuid uuid; /* The UUID that the symbol represents. */
struct ovsdb_symbol {
struct uuid uuid; /* The UUID that the symbol represents. */
- bool used; /* Already used as row UUID? */
+ bool created; /* Already used to create row? */
};
struct ovsdb_symbol_table *ovsdb_symbol_table_create(void);
};
struct ovsdb_symbol_table *ovsdb_symbol_table_create(void);
const struct uuid *, bool used);
struct ovsdb_symbol *ovsdb_symbol_table_insert(struct ovsdb_symbol_table *,
const char *name);
const struct uuid *, bool used);
struct ovsdb_symbol *ovsdb_symbol_table_insert(struct ovsdb_symbol_table *,
const char *name);
-const char *ovsdb_symbol_table_find_unused(const struct ovsdb_symbol_table *);
+const char *ovsdb_symbol_table_find_uncreated(
+ const struct ovsdb_symbol_table *);
struct ovsdb_symbol *symbol;
symbol = ovsdb_symbol_table_insert(x->symtab, json_string(uuid_name));
struct ovsdb_symbol *symbol;
symbol = ovsdb_symbol_table_insert(x->symtab, json_string(uuid_name));
return ovsdb_syntax_error(uuid_name, "duplicate uuid-name",
"This \"uuid-name\" appeared on an "
"earlier \"insert\" operation.");
}
row_uuid = symbol->uuid;
return ovsdb_syntax_error(uuid_name, "duplicate uuid-name",
"This \"uuid-name\" appeared on an "
"earlier \"insert\" operation.");
}
row_uuid = symbol->uuid;
+ symbol->created = true;
} else {
uuid_generate(&row_uuid);
}
} else {
uuid_generate(&row_uuid);
}
}
symbol = ovsdb_symbol_table_insert(symtab, id);
}
symbol = ovsdb_symbol_table_insert(symtab, id);
vsctl_fatal("row id \"%s\" may only be specified on one --id option",
id);
}
vsctl_fatal("row id \"%s\" may only be specified on one --id option",
id);
}
+ symbol->created = true;
const struct ovsrec_open_vswitch *ovs;
enum ovsdb_idl_txn_status status;
struct ovsdb_symbol_table *symtab;
const struct ovsrec_open_vswitch *ovs;
enum ovsdb_idl_txn_status status;
struct ovsdb_symbol_table *symtab;
struct vsctl_command *c;
int64_t next_cfg = 0;
char *error = NULL;
struct vsctl_command *c;
int64_t next_cfg = 0;
char *error = NULL;
- unused = ovsdb_symbol_table_find_unused(symtab);
- if (unused) {
+ uncreated = ovsdb_symbol_table_find_uncreated(symtab);
+ if (uncreated) {
vsctl_fatal("row id \"%s\" is referenced but never created (e.g. "
vsctl_fatal("row id \"%s\" is referenced but never created (e.g. "
- "with \"-- --id=%s create ...\")", unused, unused);
+ "with \"-- --id=%s create ...\")", uncreated, uncreated);
}
status = ovsdb_idl_txn_commit_block(txn);
}
status = ovsdb_idl_txn_commit_block(txn);