From patchwork Fri Oct 6 11:08:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurucharan Shetty X-Patchwork-Id: 822731 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=) 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 3y83276LWGz9t2Z for ; Sat, 7 Oct 2017 08:39:42 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 5E85EACB; Fri, 6 Oct 2017 21:39:40 +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 2CD22A59 for ; Fri, 6 Oct 2017 21:39:39 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9680F151 for ; Fri, 6 Oct 2017 21:39:38 +0000 (UTC) Received: by mail-pf0-f196.google.com with SMTP id i23so17713516pfi.2 for ; Fri, 06 Oct 2017 14:39:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=SWqBOesRtVvtQGXBjinDHJZo3X3+BxDmLjhpfEO0LwQ=; b=e+7saz+LBZs16G7Uetf/Q8B/TV1wXslKZYhVHSPdeUF1E5mLpi+GE/oeWNipOOCTf6 Nsn08jNQBaFl4+evDoiMqJqEKUECRQfUzCYGnKmCV2GIRWytiLhC85uajwCgLw9Qzwt0 RGzhE/fJYZiDY2KseylnkvhR7QKw1fRBoy8X1U2RAXizlXPsGuEijeqrq7C8lEZ1FoUU wnpxqgb8Z2vk1BgQcYeEsxhMGipRiG5UcuXOIBMWOGwK62JW4Dc5b+UG0UEPRPGGqC2M UitX6gGQ8l4nv5KNdWhwc3RT18OG5k/CmqSnf36rGZeLr0+C2y8thvg58LbAsYUaEhjk UI+A== X-Gm-Message-State: AMCzsaVSbk2N2W4uUqb0Rar4YFO+Ai7wsBtJB3JWZol3UIa/GlYN6mKx vhNs9tzEuE7qoixXfmo1gvtxpw== X-Google-Smtp-Source: AOwi7QD0YkN4kl18bWNwJcLjM04i6Ty5NWlG5wGgydq7uDYeoUzXi9VQv65LmvvaEjEWBHr6CzN/6A== X-Received: by 10.99.117.65 with SMTP id f1mr3135932pgn.104.1507325977824; Fri, 06 Oct 2017 14:39:37 -0700 (PDT) Received: from ubuntu.eng.vmware.com ([208.91.1.34]) by smtp.gmail.com with ESMTPSA id b7sm3991707pge.79.2017.10.06.14.39.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Oct 2017 14:39:36 -0700 (PDT) From: Gurucharan Shetty To: dev@openvswitch.org Date: Fri, 6 Oct 2017 04:08:22 -0700 Message-Id: <1507288103-16077-1-git-send-email-guru@ovn.org> X-Mailer: git-send-email 1.9.1 X-Spam-Status: No, score=1.6 required=5.0 tests=DATE_IN_PAST_06_12, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=disabled version=3.3.1 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 1/2] ovs-ctl.in: Call 'hostname -f' after vswitchd starts. 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 we call 'hostname -f' when ovs-vswitchd is not running. If you are using ovs-vswitchd to provide your primary networking, then 'hostname -f' will "hang" till it times out. On the system this issue was discovered, this was as long as 40 seconds. This is a problem during OVS restarts or upgrades. This commit calls 'hostname -f' after ovs-vswitchd has started. Signed-off-by: Gurucharan Shetty Acked-by: Ben Pfaff --- utilities/ovs-ctl.in | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index dc1d02c..97c3c09 100755 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -75,6 +75,12 @@ ovs_vsctl () { ovs-vsctl --no-wait "$@" } +set_hostname () { + # 'hostname -f' needs network connectivity to work. So we should + # call this only after ovs-vswitchd is running. + ovs_vsctl set Open_vSwitch . external-ids:hostname=$(hostname -f) +} + set_system_ids () { set ovs_vsctl set Open_vSwitch . @@ -108,8 +114,6 @@ set_system_ids () { esac set "$@" external-ids:system-id="\"$SYSTEM_ID\"" - set "$@" external-ids:hostname="\"$(hostname -f)\"" - set "$@" external-ids:rundir="\"$rundir\"" if test X"$SYSTEM_TYPE" != X; then @@ -382,6 +386,7 @@ force_reload_kmod () { else log_warning_msg "Failed to save configuration, not replacing kernel module" start_forwarding + set_hostname add_managers exit 1 fi @@ -405,6 +410,7 @@ force_reload_kmod () { # Start vswitchd by asking it to wait till flow restore is finished. flow_restore_wait start_forwarding || return 1 + set_hostname # Restore saved flows and inform vswitchd that we are done. restore_flows @@ -438,6 +444,7 @@ restart () { # Start vswitchd by asking it to wait till flow restore is finished. flow_restore_wait start_forwarding || return 1 + set_hostname # Restore saved flows and inform vswitchd that we are done. restore_flows @@ -695,6 +702,7 @@ case $command in start) start_ovsdb || exit 1 start_forwarding || exit 1 + set_hostname add_managers ;; stop)