From patchwork Fri Oct 5 14:54:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alin-Gabriel Serdean X-Patchwork-Id: 979499 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42RXq40cRyz9s1c for ; Sat, 6 Oct 2018 00:54:56 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 1BDEA66F3; Fri, 5 Oct 2018 14:54:54 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id E02C2FD0 for ; Fri, 5 Oct 2018 14:54:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 339797D2 for ; Fri, 5 Oct 2018 14:54:38 +0000 (UTC) X-Originating-IP: 82.79.245.216 Received: from localhost.localdomain (unknown [82.79.245.216]) (Authenticated sender: aserdean@ovn.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 819B9C0014; Fri, 5 Oct 2018 14:54:36 +0000 (UTC) From: Alin Gabriel Serdean To: dev@openvswitch.org Date: Fri, 5 Oct 2018 17:54:27 +0300 Message-Id: <20181005145427.25560-1-aserdean@ovn.org> X-Mailer: git-send-email 2.16.1.windows.1 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Alin Gabriel Serdean Subject: [ovs-dev] [PATCH v3 1/2] windows, ovn-nbctl: Add service_start call inside the server loop X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Currently all ovn-nbctl (daemon) tests are failing due to the missing call to `service_start` which is required on Windows. Windows lacks fork so we need to pass all arguments, so we can spawn a new process and interpret it properly when calling `service_start`. Signed-off-by: Alin Gabriel Serdean Signed-off-by: Ben Pfaff Co-authored-by: Ben Pfaff --- v3: Switch to Ben's patch v2: Remove OVS_UNUSED, add acks --- --- ovn/utilities/ovn-nbctl.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index eabd30308..7e42b53a9 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -117,7 +117,7 @@ static char * OVS_WARN_UNUSED_RESULT main_loop(const char *args, size_t n_commands, struct ovsdb_idl *idl, const struct timer *); -static void server_loop(struct ovsdb_idl *idl); +static void server_loop(struct ovsdb_idl *idl, int argc, char *argv[]); int main(int argc, char *argv[]) @@ -173,26 +173,24 @@ main(int argc, char *argv[]) shash_init(&local_options); apply_options_direct(parsed_options, n_parsed_options, &local_options); free(parsed_options); - argc -= optind; - argv += optind; /* Initialize IDL. */ idl = the_idl = ovsdb_idl_create(db, &nbrec_idl_class, true, false); ovsdb_idl_set_leader_only(idl, leader_only); if (get_detach()) { - if (argc != 0) { + if (argc != optind) { ctl_fatal("non-option arguments not supported with --detach " "(use --help for help)"); } - server_loop(idl); + server_loop(idl, argc, argv); } else { struct ctl_command *commands; size_t n_commands; char *error; - error = ctl_parse_commands(argc, argv, &local_options, &commands, - &n_commands); + error = ctl_parse_commands(argc - optind, argv + optind, + &local_options, &commands, &n_commands); if (error) { ctl_fatal("%s", error); } @@ -5349,11 +5347,12 @@ server_cmd_init(struct ovsdb_idl *idl, bool *exiting) } static void -server_loop(struct ovsdb_idl *idl) +server_loop(struct ovsdb_idl *idl, int argc, char *argv[]) { struct unixctl_server *server = NULL; bool exiting = false; + service_start(&argc, &argv); daemonize_start(false); int error = unixctl_server_create(unixctl_path, &server); if (error) {