[ovs-dev] [PATCH 21/23] db-ctl-base: Don't die in cmd_remove() on error.

Jakub Sitnicki jkbs at redhat.com
Mon Jul 2 10:50:17 UTC 2018


Return the error via the context instead of calling ctl_fatal() so that
the caller can decide how to handle it.

Signed-off-by: Jakub Sitnicki <jkbs at redhat.com>
---
 lib/db-ctl-base.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/db-ctl-base.c b/lib/db-ctl-base.c
index 7c1e10373..585cf67a0 100644
--- a/lib/db-ctl-base.c
+++ b/lib/db-ctl-base.c
@@ -1582,18 +1582,19 @@ cmd_remove(struct ctl_context *ctx)
                     return;
                 }
             } else {
-                ctl_fatal("%s", error);
+                ctx->error = error;
+                return;
             }
         }
         ovsdb_datum_subtract(&old, type, &rm, &rm_type);
         ovsdb_datum_destroy(&rm, &rm_type);
     }
     if (old.n < type->n_min) {
-        ctl_fatal("\"remove\" operation would put %u %s in column %s of "
-                  "table %s but the minimum number is %u",
-                  old.n,
+        ctl_error(ctx, "\"remove\" operation would put %u %s in column %s of "
+                  "table %s but the minimum number is %u", old.n,
                   type->value.type == OVSDB_TYPE_VOID ? "values" : "pairs",
                   column->name, table->name, type->n_min);
+        return;
     }
     ovsdb_idl_txn_verify(row, column);
     ovsdb_idl_txn_write(row, column, &old);
-- 
2.14.4



More information about the dev mailing list