From patchwork Mon May 25 15:28:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Alvarez Sanchez X-Patchwork-Id: 1297403 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Dfd27aqg; dkim-atps=neutral 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 49W1Fx09w6z9sSg for ; Tue, 26 May 2020 01:28:36 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 49D408645E; Mon, 25 May 2020 15:28:34 +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 9xayIrGBnyG3; Mon, 25 May 2020 15:28:33 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 880A086542; Mon, 25 May 2020 15:28:33 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 69121C088D; Mon, 25 May 2020 15:28:33 +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 DCF3AC016F for ; Mon, 25 May 2020 15:28:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id CB8E586852 for ; Mon, 25 May 2020 15:28:31 +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 Q9YETTkbtdhu for ; Mon, 25 May 2020 15:28:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by whitealder.osuosl.org (Postfix) with ESMTPS id 087B08684A for ; Mon, 25 May 2020 15:28:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590420509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jK6n+6GhyaXc65Z+M7o9vu0RSu8VEx8VQuJ3MwH0A1E=; b=Dfd27aqg8Jj0R34S5qx28mwHg/+n3p+Ur5u3NYbT7Csko6Wg787AkfpHJsWDrYIAYss/Jv E6Frnq7B9ndZM1eplrrHjJnhbqkfKD6gzVTgX6TESWBR1pfNxZvtmVqAXJ6B4LUSeAZHBF m9VJIWxNe9JcUJRvERvypdyo7Bj7kNE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-355-Vhx3ISQWMdyKJsx4_lgJeQ-1; Mon, 25 May 2020 11:28:25 -0400 X-MC-Unique: Vhx3ISQWMdyKJsx4_lgJeQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AB43318FF660 for ; Mon, 25 May 2020 15:28:24 +0000 (UTC) Received: from MacBook-Pro-de-Daniel.telefonica.net (ovpn-113-10.ams2.redhat.com [10.36.113.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4F7860F89; Mon, 25 May 2020 15:28:23 +0000 (UTC) From: Daniel Alvarez To: dev@openvswitch.org Date: Mon, 25 May 2020 17:28:21 +0200 Message-Id: <20200525152821.19838-1-dalvarez@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH] ovs-ctl: Don't overwrite external-id hostname 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" ovs-ctl started to add the hostname as external-id [0] at some point. However, this can be problematic as if it's already set by an external entity it will get overwritten. In RHEL systems, systemd will invoke ovs-ctl to start OVS and that will overwrite it to the hostname of the machine. For OVN this can have a big impact because if, for whatever reason the hostname changes and the host gets restarted, ovn-controller won't claim the ports back leaving the workloads unaccessible. Also, it makes sense to not overwrite it as 1) it's an external_id, so it will actually let external entities to configure it (unlike now), and 2) it's optional. In the case that some systems were relying on ovs-ctl to set the external-id for the first time (e.g onboarding of a new hypervisor), this patch is not changing such behavior. For more details, see discussion at [1]. [0] https://mail.openvswitch.org/pipermail/ovs-dev/2016-March/312054.html [1] https://mail.openvswitch.org/pipermail/ovs-dev/2020-May/370813.html Signed-off-by: Daniel Alvarez Acked-by: Han Zhou --- utilities/ovs-ctl.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index 8c5cd7032..9be9c9871 100644 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -43,7 +43,8 @@ set_hostname () { else hn="$(uname -n)" fi - ovs_vsctl set Open_vSwitch . external-ids:hostname="$hn" + # Set the hostname if it wasn't set before + ovs_vsctl add Open_vSwitch . external-ids hostname="$hn" } set_system_ids () {