Merge ~fnordahl/ubuntu/+source/openvswitch:ubuntu/groovy into ~ubuntu-server-dev/ubuntu/+source/openvswitch:ubuntu/groovy

Proposed by Frode Nordahl
Status: Merged
Merged at revision: b7a13487fb76d42a07c6c2c6bbf371d690e5a5f0
Proposed branch: ~fnordahl/ubuntu/+source/openvswitch:ubuntu/groovy
Merge into: ~ubuntu-server-dev/ubuntu/+source/openvswitch:ubuntu/groovy
Diff against target: 243 lines (+161/-2)
8 files modified
debian/changelog (+20/-0)
debian/openvswitch-switch.ovs-record-hostname.service (+18/-0)
debian/openvswitch-switch.ovs-vswitchd.service (+2/-0)
debian/openvswitch-switch.ovsdb-server.service (+3/-1)
debian/openvswitch-switch.service (+1/-0)
debian/patches/ovs-dev-ovs-ctl-Allow-recording-hostname-separately.patch (+114/-0)
debian/patches/series (+1/-0)
debian/rules (+2/-1)
Reviewer Review Type Date Requested Status
Ubuntu Server Developers Pending
Review via email: mp+399763@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 10bcb29..bfcf3c3 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,9 +1,29 @@
6 openvswitch (2.13.3-0ubuntu0.20.10.1) UNRELEASED; urgency=medium
7
8+ [ James Page ]
9+
10 * New upstream point release:
11 - d/p/*: Refresh including drop of part of patch as equivalent
12 changes included in point release.
13
14+ [ Frode Nordahl ]
15+
16+ * Fix recording of FQDN/hostname on startup (LP: #1915829):
17+ - d/p/ovs-dev-ovs-ctl-Allow-recording-hostname-separately.patch: Cherry
18+ pick of committed upstream fix to support skip of hostname
19+ configuration on ovs-vswitchd/ovsdb-server startup.
20+ - d/openvswitch-switch.ovs-record-hostname.service: Record hostname in
21+ Open vSwitch after network-online.target using new systemd unit.
22+ - d/openvswitch-switch.ovs-vswitchd.service: Pass `--no-record-hostname`
23+ option to `ovs-ctl` to delegate recording of hostname to the separate
24+ service.
25+ - d/openvswitch-switch.ovsdb-server.service: Pass `--no-record-hostname`
26+ option to `ovs-ctl` to delegate recording of hostname to the separate
27+ service.
28+ - d/openvswitch-switch.service: Add `Also` reference to
29+ ovs-record-hostname.service so that the service is enabled on install.
30+ - d/rules: Add `ovs-record-hostname.service` to package build.
31+
32 -- James Page <james.page@ubuntu.com> Tue, 16 Mar 2021 16:55:24 +0000
33
34 openvswitch (2.13.1-0ubuntu1.1) groovy; urgency=medium
35diff --git a/debian/openvswitch-switch.ovs-record-hostname.service b/debian/openvswitch-switch.ovs-record-hostname.service
36new file mode 100644
37index 0000000..c415d13
38--- /dev/null
39+++ b/debian/openvswitch-switch.ovs-record-hostname.service
40@@ -0,0 +1,18 @@
41+[Unit]
42+Description=Open vSwitch Record Hostname
43+After=ovsdb-server.service ovs-vswitchd.service network-online.target
44+Requires=ovsdb-server.service
45+Requires=ovs-vswitchd.service
46+Requires=network-online.target
47+AssertPathIsReadWrite=/var/run/openvswitch/db.sock
48+
49+[Service]
50+Type=oneshot
51+ExecStart=/usr/share/openvswitch/scripts/ovs-ctl record-hostname-if-not-set
52+ExecStop=/bin/true
53+ExecReload=/usr/share/openvswitch/scripts/ovs-ctl record-hostname-if-not-set
54+TimeoutSec=300
55+RemainAfterExit=yes
56+
57+[Install]
58+RequiredBy=openvswitch-switch.service
59diff --git a/debian/openvswitch-switch.ovs-vswitchd.service b/debian/openvswitch-switch.ovs-vswitchd.service
60index f2c080e..519d80d 100644
61--- a/debian/openvswitch-switch.ovs-vswitchd.service
62+++ b/debian/openvswitch-switch.ovs-vswitchd.service
63@@ -16,9 +16,11 @@ Environment=HOME=/var/run/openvswitch
64 EnvironmentFile=-/etc/default/openvswitch-switch
65 ExecStart=/usr/share/openvswitch/scripts/ovs-ctl \
66 --no-ovsdb-server --no-monitor --system-id=random \
67+ --no-record-hostname \
68 start $OVS_CTL_OPTS
69 ExecStop=/usr/share/openvswitch/scripts/ovs-ctl --no-ovsdb-server stop
70 ExecReload=/usr/share/openvswitch/scripts/ovs-ctl --no-ovsdb-server \
71 --no-monitor --system-id=random \
72+ --no-record-hostname \
73 restart $OVS_CTL_OPTS
74 TimeoutSec=300
75diff --git a/debian/openvswitch-switch.ovsdb-server.service b/debian/openvswitch-switch.ovsdb-server.service
76index 243b0f0..dd594a6 100644
77--- a/debian/openvswitch-switch.ovsdb-server.service
78+++ b/debian/openvswitch-switch.ovsdb-server.service
79@@ -12,9 +12,11 @@ Restart=on-failure
80 EnvironmentFile=-/etc/default/openvswitch-switch
81 ExecStart=/usr/share/openvswitch/scripts/ovs-ctl \
82 --no-ovs-vswitchd --no-monitor --system-id=random \
83+ --no-record-hostname \
84 start $OVS_CTL_OPTS
85 ExecStop=/usr/share/openvswitch/scripts/ovs-ctl --no-ovs-vswitchd stop
86 ExecReload=/usr/share/openvswitch/scripts/ovs-ctl --no-ovs-vswitchd \
87- --no-monitor restart $OVS_CTL_OPTS
88+ --no-record-hostname \
89+ --no-monitor restart $OVS_CTL_OPTS
90 RuntimeDirectory=openvswitch
91 RuntimeDirectoryMode=0755
92diff --git a/debian/openvswitch-switch.service b/debian/openvswitch-switch.service
93index f03f8b3..ef928b3 100644
94--- a/debian/openvswitch-switch.service
95+++ b/debian/openvswitch-switch.service
96@@ -15,3 +15,4 @@ RemainAfterExit=yes
97
98 [Install]
99 WantedBy=multi-user.target
100+Also=ovs-record-hostname.service
101diff --git a/debian/patches/ovs-dev-ovs-ctl-Allow-recording-hostname-separately.patch b/debian/patches/ovs-dev-ovs-ctl-Allow-recording-hostname-separately.patch
102new file mode 100644
103index 0000000..1840591
104--- /dev/null
105+++ b/debian/patches/ovs-dev-ovs-ctl-Allow-recording-hostname-separately.patch
106@@ -0,0 +1,114 @@
107+From 556e65e17991a5b165bc8697d2e4da266afada67 Mon Sep 17 00:00:00 2001
108+From: Frode Nordahl <frode.nordahl@canonical.com>
109+Date: Thu, 25 Feb 2021 16:28:16 +0100
110+Subject: [PATCH] ovs-ctl: Allow recording hostname separately.
111+
112+ovs-ctl determines the system FQDN or hostname and records it in
113+the `external-ids:hostname` field of the `Open-vSwitch` table on
114+system startup if it is not already set.
115+
116+This value may be consumed by downstream software and having it
117+unset or set to a incorrect value could lead to erratic behavior
118+of a system.
119+
120+When a system is configured to use an Open vSwitch controlled
121+datapath as its only network connection, the current ordering of
122+events would always record a unreliable hostname.
123+
124+To tackle this problem this patch adds an optional argument that
125+allows starting Open vSwitch without recording the hostname in
126+the database as well as a new ctl command to record the hostname
127+separately. This command can be called by the system startup
128+scripts when the system is ready to collect and record this
129+information.
130+
131+Reported-At: https://bugs.launchpad.net/bugs/1915829
132+Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
133+Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
134+Origin: https://github.com/openvswitch/ovs/commit/556e65e17991a5b165bc8697d2e4da266afada67
135+Applied-Upstream: https://github.com/openvswitch/ovs/commit/2ad201659cedbb1134a9d27af132e491173c7e40
136+---
137+ NEWS | 5 +++++
138+ utilities/ovs-ctl.in | 41 +++++++++++++++++++++++++++--------------
139+ 2 files changed, 32 insertions(+), 14 deletions(-)
140+
141+Index: openvswitch-2.13.1/utilities/ovs-ctl.in
142+===================================================================
143+--- openvswitch-2.13.1.orig/utilities/ovs-ctl.in
144++++ openvswitch-2.13.1/utilities/ovs-ctl.in
145+@@ -225,7 +225,9 @@ start_forwarding () {
146+ if test X"$OVS_VSWITCHD" = Xyes; then
147+ do_start_forwarding || return 1
148+ fi
149+- set_hostname &
150++ if test X"$RECORD_HOSTNAME" = Xyes; then
151++ set_hostname &
152++ fi
153+ return 0
154+ }
155+
156+@@ -312,6 +314,7 @@ set_defaults () {
157+ SYSTEM_ID=
158+
159+ FULL_HOSTNAME=yes
160++ RECORD_HOSTNAME=yes
161+
162+ DELETE_BRIDGES=no
163+ DELETE_TRANSIENT_PORTS=no
164+@@ -372,19 +375,24 @@ This program is intended to be invoked i
165+ scripts. System administrators should not normally invoke it directly.
166+
167+ Commands:
168+- start start Open vSwitch daemons
169+- stop stop Open vSwitch daemons
170+- restart stop and start Open vSwitch daemons
171+- status check whether Open vSwitch daemons are running
172+- version print versions of Open vSwitch daemons
173+- load-kmod insert modules if not already present
174+- force-reload-kmod save OVS network device state, stop OVS, unload kernel
175+- module, reload kernel module, start OVS, restore state
176+- enable-protocol enable protocol specified in options with iptables
177+- delete-transient-ports delete transient (other_config:transient=true) ports
178+- start-ovs-ipsec start Open vSwitch ipsec daemon
179+- stop-ovs-ipsec stop Open vSwitch ipsec daemon
180+- help display this help message
181++ start start Open vSwitch daemons
182++ stop stop Open vSwitch daemons
183++ restart stop and start Open vSwitch daemons
184++ status check whether Open vSwitch daemons are running
185++ version print versions of Open vSwitch daemons
186++ load-kmod insert modules if not already present
187++ force-reload-kmod save OVS network device state, stop OVS, unload
188++ kernel module, reload kernel module, start OVS,
189++ restore state
190++ enable-protocol enable protocol specified in options with
191++ iptables
192++ delete-transient-ports delete transient (other_config:transient=true)
193++ ports
194++ start-ovs-ipsec start Open vSwitch ipsec daemon
195++ stop-ovs-ipsec stop Open vSwitch ipsec daemon
196++ record-hostname-if-not-set determine the system hostname and record it in
197++ the Open vSwitch database if not already set
198++ help display this help message
199+
200+ One of the following options is required for "start", "restart" and "force-reload-kmod":
201+ --system-id=UUID set specific ID to uniquely identify this system
202+@@ -405,6 +413,8 @@ Less important options for "start", "res
203+ --ovsdb-server-priority=NICE set ovsdb-server's niceness (default: $OVSDB_SERVER_PRIORITY)
204+ --ovs-vswitchd-priority=NICE set ovs-vswitchd's niceness (default: $OVS_VSWITCHD_PRIORITY)
205+ --no-full-hostname set short hostname instead of full hostname
206++ --no-record-hostname do not attempt to determine/record system
207++ hostname as part of start command
208+
209+ Debugging options for "start", "restart" and "force-reload-kmod":
210+ --ovsdb-server-wrapper=WRAPPER
211+@@ -561,6 +571,9 @@ case $command in
212+ stop-ovs-ipsec)
213+ stop_ovs_ipsec
214+ ;;
215++ record-hostname-if-not-set)
216++ set_hostname
217++ ;;
218+ help)
219+ usage
220+ ;;
221diff --git a/debian/patches/series b/debian/patches/series
222index aff3d2a..a194a4f 100644
223--- a/debian/patches/series
224+++ b/debian/patches/series
225@@ -1 +1,2 @@
226 py3-compat.patch
227+ovs-dev-ovs-ctl-Allow-recording-hostname-separately.patch
228diff --git a/debian/rules b/debian/rules
229index c6790ed..e1fd741 100755
230--- a/debian/rules
231+++ b/debian/rules
232@@ -108,9 +108,10 @@ override_dh_installinit:
233 dh_installinit --restart-after-upgrade
234 dh_installinit -popenvswitch-switch --name=ovsdb-server --no-start
235 dh_installinit -popenvswitch-switch --name=ovs-vswitchd --no-start
236+ dh_installinit -popenvswitch-switch --name=ovs-record-hostname --no-start
237
238 override_dh_systemd_start:
239- dh_systemd_start --restart-after-upgrade -Xovs-vswitchd.service -Xovsdb-server.service
240+ dh_systemd_start --restart-after-upgrade -Xovs-vswitchd.service -Xovsdb-server.service -Xovs-record-hostname.service
241
242 override_dh_strip:
243 dh_strip --dbg-package=openvswitch-dbg

Subscribers

People subscribed via source and target branches