From patchwork Thu Oct 4 01:55:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han Zhou X-Patchwork-Id: 978619 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="q5wkn0vE"; dkim-atps=neutral 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 42QbZD5hYDz9s5c for ; Thu, 4 Oct 2018 11:55:31 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 85687128B; Thu, 4 Oct 2018 01:55:28 +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 327DB11B3 for ; Thu, 4 Oct 2018 01:55:27 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 4E6B7A8 for ; Thu, 4 Oct 2018 01:55:26 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id y18-v6so2395877pge.0 for ; Wed, 03 Oct 2018 18:55:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=HAebfdrDtfqu+B3cuTE1tZDj2kA5huNlfnMfrQ6pc+g=; b=q5wkn0vEzvn6Krjp7mG3iyscPU8R4ERKfz0Brz8Hb4d891Pkq/jt9QrMuvqpMlg/Ny xmeudUHhXnhfEQBq2VbiChXf1ioVwMpG0vcUjtZK7k7GAMzpkGJCCcdWVMDvN+LeXDCG jIEal+6hOprVPCZkpBOL7fafAhztkFs4EfvljmkjalaK7BtJ1rB3f7n+43ECZqKfunKY SNVe4YmnJggI6GdymNDEoaISKCyZwqDdKgd+WL4X57bXAfsF47Otb5fL72zklq8Y40dO qSg8LOrfFKJdS6Znm+U5Mu+510C5ahscMnryFNJ+jYskPgL/e9H4HswvlL7WBRrUOYFP EYOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=HAebfdrDtfqu+B3cuTE1tZDj2kA5huNlfnMfrQ6pc+g=; b=WNmJJbMcFwU/6/vo2JI43JZ6LLegtf/La7qyopDMwsewmF5g2EDjeMpkoZxqkW6vDv fIPUVQTvtefnj11ObpyOpwtxhVxtOwuoi3uvjWMp4iwvJF5U0XreJJmX97XL6+NChvt9 W2CJ5J0RWtZghWDM9gARbdNnQIwzM7NtKL3DOc5AxhpHrKbTBY2yavK14lhcKOwk6Dg7 mJj6bC4YLH9/Ab5AGn+xcqJrHV+0wrQYhV95BEuHlCbJXkoWJvPjMClcUexc/iy0OicQ PphhcfkBMurp1ebbp8C8w3/WDywnO9jDb9JV2g/0i4yojUbERcfd+8Mj0XU3EIEA4mak HHKQ== X-Gm-Message-State: ABuFfog3da6rJFinEp0HhAJGzErFf4vTaq19o/JdJtINfBh7fueGU3FI 2b8LYhIWR8prgcgv9JE4QNwMD75g X-Google-Smtp-Source: ACcGV619Z9eVjtA9jq3iKezJOwOAC3hRrxg4DtzOJdQb+WKM+rtakCnye4yk80YJGD4Z2T+IDmtfkA== X-Received: by 2002:a63:306:: with SMTP id 6-v6mr3681859pgd.393.1538618125511; Wed, 03 Oct 2018 18:55:25 -0700 (PDT) Received: from localhost.localdomain.localdomain ([216.113.160.77]) by smtp.gmail.com with ESMTPSA id t12-v6sm3467155pgg.72.2018.10.03.18.55.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 18:55:25 -0700 (PDT) From: Han Zhou X-Google-Original-From: Han Zhou To: dev@openvswitch.org Date: Wed, 3 Oct 2018 18:55:23 -0700 Message-Id: <1538618123-88663-1-git-send-email-hzhou8@ebay.com> X-Mailer: git-send-email 2.1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] ovs-ctl: Add new option to use short hostname. 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 From: Han Zhou Current ovs-ctl forces to set full hostname in external-ids. In some situation users may want to set short hostname. For example, in OpenStack - OVN integration, Neutron uses the host-id provided by Nova, which is usually short hostname, to set "requested-chassis" in OVN. The mismatch in hypervisor's external-ids:hostname setting causes OVN port binding failure. It can be overridden to short name but a openvswitch restart using ovs-ctl would again set it to full hostname. This patch ensures in such use cases --no-full-hostname can be specified to ovs-ctl to set short hostname instead. Signed-off-by: Han Zhou --- utilities/ovs-ctl.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index 749de99..7651927 100644 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -38,6 +38,10 @@ insert_mod_if_required () { set_hostname () { # 'hostname -f' needs network connectivity to work. So we should # call this only after ovs-vswitchd is running. + hn="$(hostname -f)" + if test X$FULL_HOSTNAME = Xno; then + hn="$(hostname)" + fi ovs_vsctl set Open_vSwitch . external-ids:hostname="$(hostname -f)" } @@ -289,6 +293,8 @@ enable_protocol () { set_defaults () { SYSTEM_ID= + FULL_HOSTNAME=yes + DELETE_BRIDGES=no DELETE_TRANSIENT_PORTS=no @@ -374,6 +380,7 @@ Less important options for "start", "restart" and "force-reload-kmod": --no-mlockall do not lock all of ovs-vswitchd into memory --ovsdb-server-priority=NICE set ovsdb-server's niceness (default: $OVSDB_SERVER_PRIORITY) --ovs-vswitchd-priority=NICE set ovs-vswitchd's niceness (default: $OVS_VSWITCHD_PRIORITY) + --no-full-hostname set short hostname instead of full hostname Debugging options for "start", "restart" and "force-reload-kmod": --ovsdb-server-wrapper=WRAPPER