File 0001-ovs-ctl.in-Call-hostname-f-after-vswitchd-starts.patch of Package openvswitch.openSUSE_Leap_42.3_Update

From 93ac0b6205d34c3ceb78790e51cd692e7b2893a7 Mon Sep 17 00:00:00 2001
From: Gurucharan Shetty <guru@ovn.org>
Date: Fri, 6 Oct 2017 03:58:35 -0700
Subject: [PATCH] ovs-ctl.in: Call 'hostname -f' after vswitchd starts.

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.

VMware-BZ: #1972026
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
---
 utilities/ovs-ctl.in | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index e234937b1..8e506cc94 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)\""
-
     if test X"$SYSTEM_TYPE" != X; then
         set "$@" system-type="\"$SYSTEM_TYPE\""
     else
@@ -252,6 +256,7 @@ start_forwarding () {
     if test X"$OVS_VSWITCHD" = Xyes; then
         do_start_forwarding || return 1
     fi
+    set_hostname &
     return 0
 }
 
-- 
2.17.0

openSUSE Build Service is sponsored by