From patchwork Tue Feb 16 14:30:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frode Nordahl X-Patchwork-Id: 1440992 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dg62T2yxXz9sVb for ; Wed, 17 Feb 2021 03:32:30 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id AB5C8858FB; Tue, 16 Feb 2021 16:32:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XpBkCSkWQcCv; Tue, 16 Feb 2021 16:32:26 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id C76C58526D; Tue, 16 Feb 2021 16:32:26 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id AA917C0174; Tue, 16 Feb 2021 16:32:26 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id D537EC013A for ; Tue, 16 Feb 2021 16:32:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id BBA39868AA for ; Tue, 16 Feb 2021 16:32:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3JV-7mBz3i-0 for ; Tue, 16 Feb 2021 16:32:24 +0000 (UTC) X-Greylist: delayed 00:06:38 by SQLgrey-1.7.6 Received: from ti0189a330-0925.bb.online.no (ti0189a330-0925.bb.online.no [88.88.218.161]) by whitealder.osuosl.org (Postfix) with ESMTP id 5190F86A01 for ; Tue, 16 Feb 2021 16:32:06 +0000 (UTC) X-Mailbox-Line: From f2ed741805089d9ebf54f4583e0d82459f8f9029 Mon Sep 17 00:00:00 2001 From: Frode Nordahl To: dev@openvswitch.org Date: Tue, 16 Feb 2021 15:30:57 +0100 Message-Id: <20210216163225.BBA39868AA@whitealder.osuosl.org> Subject: [ovs-dev] [PATCH] ovs-ctl: Allow recording hostname separately X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" ovs-ctl determines the system FQDN or hostname and records it in the `external-ids:hostname` field of the `Open-vSwitch` table on system startup. This value may be consumed by downstream software and having it unset or set to a incorrect value could lead to erratic behavior of a system. When a system is configured to use a Open vSwitch controlled datapath as its only network connection, the current ordering of events would always produce a unreliable hostname Reported-At: https://bugs.launchpad.net/bugs/1915829 Signed-off-by: Frode Nordahl Reviewed-by: Christian Ehrhardt --- utilities/ovs-ctl.in | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index be3aa083b..9231ae4f4 100644 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -230,7 +230,9 @@ start_forwarding () { if test X"$OVS_VSWITCHD" = Xyes; then do_start_forwarding || return 1 fi - set_hostname & + if test X"$RECORD_HOSTNAME" = Xyes; then + set_hostname & + fi return 0 } @@ -321,6 +323,7 @@ set_defaults () { SYSTEM_ID= FULL_HOSTNAME=yes + RECORD_HOSTNAME=yes DELETE_BRIDGES=no DELETE_TRANSIENT_PORTS=no @@ -394,6 +397,8 @@ Commands: delete-transient-ports delete transient (other_config:transient=true) ports start-ovs-ipsec start Open vSwitch ipsec daemon stop-ovs-ipsec stop Open vSwitch ipsec daemon + record-hostname determine the system hostname and record it in the + Open vSwitch database if not already set help display this help message One of the following options is required for "start", "restart" and "force-reload-kmod": @@ -415,6 +420,8 @@ Less important options for "start", "restart" and "force-reload-kmod": --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 + --no-record-hostname do not attempt to determine/record system + hostname as part of start command Debugging options for "start", "restart" and "force-reload-kmod": --ovsdb-server-wrapper=WRAPPER @@ -573,6 +580,9 @@ case $command in stop-ovs-ipsec) stop_ovs_ipsec ;; + record-hostname) + set_hostname + ;; help) usage ;;