Merge ~fnordahl/ubuntu/+source/openvswitch:bug/1915829 into ~ubuntu-server-dev/ubuntu/+source/openvswitch:master

Proposed by Frode Nordahl
Status: Merged
Merge reported by: Frode Nordahl
Merged at revision: e74d2a0273e1d73fd274208842ea5a81c5654aaa
Proposed branch: ~fnordahl/ubuntu/+source/openvswitch:bug/1915829
Merge into: ~ubuntu-server-dev/ubuntu/+source/openvswitch:master
Diff against target: 251 lines (+174/-2)
8 files modified
debian/changelog (+18/-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 (+129/-0)
debian/patches/series (+1/-0)
debian/rules (+2/-1)
Reviewer Review Type Date Requested Status
Christian Ehrhardt  Needs Fixing
Review via email: mp+398174@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Hirsute isn't released yet - so it would be 2.15.0-0ubuntu2

Other than this minor issue it does LGTM.
Of course to avoid diverging too much you might want to wait to see it accepted upstream before uploading (depends on how close that accept gets to the Freeze).

Also FYI - 2.15.0 still is held in -unapproved as we are soft freezing atm
https://launchpad.net/ubuntu/hirsute/+queue?queue_state=1
(Just in case you wondered)

review: Needs Fixing
Revision history for this message
Frode Nordahl (fnordahl) wrote :

Thank you for the review Christian.

Updated the package version and updated the patch to now match the version merged upstream [0].

We got it backported all the way to 2.13, but I would like to proceed with carrying it as a patch in the packaging until a upstream point release is cut as there are downstream issues waiting to be resolved by this fix.

Hope this resonates well with you.

0: https://mail.openvswitch.org/pipermail/ovs-dev/2021-March/380889.html

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

Subscribers

People subscribed via source and target branches