@@ -2417,12 +2417,21 @@ ctl_context_done(struct ctl_context *ctx,
invalidate_cache(ctx);
}
-void ctl_set_column(const char *table_name,
- const struct ovsdb_idl_row *row, const char *arg,
- struct ovsdb_symbol_table *symtab)
+char * OVS_WARN_UNUSED_RESULT
+ctl_set_column(const char *table_name, const struct ovsdb_idl_row *row,
+ const char *arg, struct ovsdb_symbol_table *symtab)
{
const struct ovsdb_idl_table_class *table;
+ char *error;
- die_if_error(get_table(table_name, &table));
- die_if_error(set_column(table, row, arg, symtab));
+ error = get_table(table_name, &table);
+ if (error) {
+ return error;
+ }
+ error = set_column(table, row, arg, symtab);
+ if (error) {
+ return error;
+ }
+
+ return NULL;
}
@@ -276,8 +276,7 @@ char *ctl_get_row(struct ctl_context *, const struct ovsdb_idl_table_class *,
const char *record_id, bool must_exist,
const struct ovsdb_idl_row **);
-void ctl_set_column(const char *table_name,
- const struct ovsdb_idl_row *, const char *arg,
- struct ovsdb_symbol_table *);
+char *ctl_set_column(const char *table_name, const struct ovsdb_idl_row *,
+ const char *arg, struct ovsdb_symbol_table *);
#endif /* db-ctl-base.h */
@@ -3279,8 +3279,11 @@ nbctl_lrp_add(struct ctl_context *ctx)
nbrec_logical_router_port_set_networks(lrp, networks, n_networks);
for (int i = 0; i < n_settings; i++) {
- ctl_set_column("Logical_Router_Port", &lrp->header_, settings[i],
- ctx->symtab);
+ char *error = ctl_set_column("Logical_Router_Port", &lrp->header_,
+ settings[i], ctx->symtab);
+ if (error) {
+ ctl_fatal("%s", error);
+ }
}
/* Insert the logical port into the logical router. */
@@ -1591,8 +1591,11 @@ add_port(struct ctl_context *ctx,
}
for (i = 0; i < n_settings; i++) {
- ctl_set_column("Port", &port->header_, settings[i],
- ctx->symtab);
+ char *error = ctl_set_column("Port", &port->header_, settings[i],
+ ctx->symtab);
+ if (error) {
+ ctl_fatal("%s", error);
+ }
}
bridge_insert_port((bridge->parent ? bridge->parent->br_cfg
Return the error message to the caller instead of reporting it and dying so that the caller can handle the error without terminating the process if needed. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> --- lib/db-ctl-base.c | 19 ++++++++++++++----- lib/db-ctl-base.h | 5 ++--- ovn/utilities/ovn-nbctl.c | 7 +++++-- utilities/ovs-vsctl.c | 7 +++++-- 4 files changed, 26 insertions(+), 12 deletions(-)