[ovs-dev] [PATCH 20/30] ovn-nbctl: Don't die in nbctl_lr_lb_add().

Jakub Sitnicki jkbs at redhat.com
Sat Jul 7 11:09:54 UTC 2018


Propagate the error via the context instead.

Signed-off-by: Jakub Sitnicki <jkbs at redhat.com>
---
 ovn/utilities/ovn-nbctl.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index 16788cc43..989633120 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -2324,11 +2324,13 @@ nbctl_lr_lb_add(struct ctl_context *ctx)
 
     char *error = lr_by_name_or_uuid(ctx, ctx->argv[1], true, &lr);
     if (error) {
-        ctl_fatal("%s", error);
+        ctx->error = error;
+        return;
     }
     error = lb_by_name_or_uuid(ctx, ctx->argv[2], true, &new_lb);
     if (error) {
-        ctl_fatal("%s", error);
+        ctx->error = error;
+        return;
     }
 
     bool may_exist = shash_find(&ctx->options, "--may-exist") != NULL;
@@ -2340,8 +2342,9 @@ nbctl_lr_lb_add(struct ctl_context *ctx)
             if (may_exist) {
                 return;
             }
-            ctl_fatal(UUID_FMT " : a load balancer with this UUID already "
-                    "exists", UUID_ARGS(&lb->header_.uuid));
+            ctl_error(ctx, UUID_FMT " : a load balancer with this UUID "
+                      "already exists", UUID_ARGS(&lb->header_.uuid));
+            return;
         }
     }
 
-- 
2.14.4



More information about the dev mailing list