[ovs-dev] [PATCH v2] ovs-ctl: Allow recording hostname separately

Frode Nordahl frode.nordahl at canonical.com
Thu Sep 2 05:31:30 UTC 2021


On Thu, Sep 2, 2021 at 1:25 AM aginwala <aginwala at asu.edu> wrote:
>
>
>
> On Wed, Sep 1, 2021 at 12:26 AM aginwala <aginwala at asu.edu> wrote:
>>
>>
>>
>> On Tue, Aug 31, 2021 at 11:26 PM Frode Nordahl <frode.nordahl at canonical.com> wrote:
>>>
>>> On Tue, Aug 31, 2021 at 8:28 PM aginwala <aginwala at asu.edu> wrote:
>>> >
>>> >
>>> >
>>> > On Tue, Aug 31, 2021 at 11:20 AM Frode Nordahl <frode.nordahl at canonical.com> wrote:
>>> >>
>>> >> On Tue, Aug 31, 2021 at 8:01 PM aginwala <aginwala at asu.edu> wrote:
>>> >> >
>>> >> > Hi:
>>> >> >
>>> >> > Thanks for this improvement. As per our recent tests with ovs 2.16 with 5.4* linux, the problem is that ovs-vswitchd adds ovs-record-hostname as required in the systemctl params.
>>> >> > Because of that debian installation of ovs always complaints
>>> >> >
>>> >> > Setting up openvswitch-switch (2.16.0-1) ...
>>> >> > insserv: warning: script 'iproutepolicy' missing LSB tags and overrides
>>> >> > Failed to restart openvswitch-switch.service: Unit ovs-record-hostname.service not found.
>>> >> > invoke-rc.d: initscript openvswitch-switch, action "restart" failed.
>>> >> > * openvswitch-switch.service - LSB: Open vSwitch switch
>>> >> >      Loaded: loaded (/etc/init.d/openvswitch-switch; generated)
>>> >> >      Active: inactive (dead) since Tue 2021-08-31 00:59:30 -07; 2h 24min ago
>>> >> >        Docs: man:systemd-sysv-generator(8)
>>> >> >
>>> >> > Main PID: 5960 (code=exited, status=0/SUCCESS)
>>> >> >
>>> >> > dpkg: error processing package openvswitch-switch (--install):
>>> >> >  installed openvswitch-switch package post-installation script subprocess returned error exit status 1
>>> >> >
>>> >> > Installation is ok as dpkg:error shows confusion
>>> >> > dpkg -l | grep openv
>>> >> >
>>> >> > Can be also seen on restart if vswitchd fails as debain install
>>> >> > systemctl restart openvswitch-switch.service
>>> >> > Failed to restart openvswitch-switch.service: Unit ovs-record-hostname.service not found.
>>> >> >
>>> >> > With ovs-ctl things works as expected.
>>> >> > Temp fix if we want to skip ovs-host-record for now is.
>>> >> >
>>> >> > rm /etc/systemd/system/openvswitch-switch.service.requires/ovs-record-hostname.service
>>> >> > systemctl daemon-reload
>>> >> >
>>> >> >
>>> >> > I saw upstream ubuntu does add ovs-record.service for debian packaging https://urldefense.com/v3/__https://code.launchpad.net/*fnordahl/ubuntu/*source/openvswitch/*git/openvswitch/*merge/398174__;fisrKw!!IKRxdwAv5BmarQ!NOVNzYnNX0z7Is75RKTpkbzKWTqqhxvHQ8m4xEVtweIy9WE-BCw76yxVCx3SwlA$
>>> >> >
>>> >> >
>>> >> > Seems it makes reasonable to port ovs-record-hostname for ovs debian packaging too to avoid error for 2.16.0 and master ovs branch to avoid systemctl issues.
>>> >> >
>>> >> > Please advice.
>>> >>
>>> >> Thank you for reaching out. The change made to the Open vSwitch
>>> >> repository itself for the ovn-ctl script was of an optional nature and
>>> >> is only opted into by those who want to use it. As you have found we
>>> >> do make use of this in Ubuntu, here we provide real systemd service
>>> >> files, including one for the separate recording of hostname, and do
>>> >> not rely on the systemd-sysv compatibility layer.
>>> >>
>>> >> I am not sure how the package you are looking at here came into this
>>> >> state, it is almost as if someone halfway enabled the feature? What is
>>> >> the source for the package you are displaying here?
>>> >>
>>> > https://urldefense.com/v3/__https://github.com/openvswitch/ovs/tree/v2.16.0__;!!IKRxdwAv5BmarQ!OovT7gtV1b9NvkRLizdRIY7Gviy8uckgpLx8-TfmSkPQp6Cr_GsaUsh8V6UvX08$  and building with debian build on kernel 5.4-80
>>> >
>>> > So, on ubuntu itself ovs-record-hostname can be optional for openvswitch vs being set as required on systemctl settings in 5.4* kernel.
>>> > or
>>> > add ovs-record-hostname.service in https://urldefense.com/v3/__https://github.com/openvswitch/ovs/tree/v2.16.0/debian__;!!IKRxdwAv5BmarQ!OovT7gtV1b9NvkRLizdRIY7Gviy8uckgpLx8-TfmSkPQp6Cr_GsaUsh8L1zplWw$  so that debain compilation will set that up.
>>> > That's what I can read from the current code so far.
>>>
>>> So I built debs from the currently tagged v2.16.0 sources and
>>> installed them on a clean system without any prior installation of
>>> Open vSwitch and I see no mention of a ovs-record-hostname.service and
>>> I have no issues starting or restarting the
>>> openvswitch-switch.service.  This service is also not mentioned in the
>>> debian package recipe in the OVS repository.
>>>
>>> Could the files you see in /etc/systemd be left over from a different
>>> package installation? Or am I misunderstanding the problem?
>>>
>> Hey thanks for trying out. I should have clarified earlier(my bad); the issue happens on kernel upgrade ; from older 4.* to 5.4.0-80  to ubuntu20.04(focal) where our kernel builds pulls openvswitch default debs https://launchpad.net/ubuntu/+source/openvswitch/2.13.3-0ubuntu0.20.04.1  that has ovs-record-hostname set in systemd. However, the newly generated ovs debian that we have on tag v2.16.0 from ovs source  doesn't have it. Since kernel upgrade touches openvswitch systemd settings, vswitchd with 2.16.0 complaints/fails. Seems it impacts the newer ubuntu versions. So not sure if we can improvise the openvswitch debains on ubuntu20 and onwards release as it seems to be imposed from canonical for ubuntu20 releases. Not sure if we should backport the same patch in ovs repo can help avoid systemd compatibility issues.
>
> For now we have fixed on our side by skipping installation of  ubuntu openvswitch-switch from canonnical while upgrading kernel using apt-mark hold openvswitch-switch to avoid ovs-record-hostname.service being added in sysctl
>
> dpkg-deb -c ./openvswitch-switch_2.13.3-0ubuntu0.20.04.1_amd64.deb | grep service
> -rw-r--r-- root/root       418 2021-03-17 02:48 ./lib/systemd/system/openvswitch-switch.service
> -rw-r--r-- root/root       540 2021-03-17 02:48 ./lib/systemd/system/ovs-record-hostname.service
> -rw-r--r-- root/root       934 2021-03-17 02:48 ./lib/systemd/system/ovs-vswitchd.service
>
> -rw-r--r-- root/root 774 2021-03-18 02:18 ./lib/systemd/system/ovsdb-server.service

That looks like a reasonable workaround, thank you for providing it here.

Guaranteeing the outcome of upgrades between packages of a disjoint
ancestry is virtually impossible, the debian package recipe in the ovs
and ovn repositories is currently living its own life and it does not
resemble what is actually in Debian or Ubuntu. We would be happy to
upstream our package sources and I'm sure the Debian maintainer would
agree, but it does depend on what other users there are of the in-tree
package recipes.

In the meantime, what we could do in Ubuntu is investigate whether
there should be postrm rules to make sure no systemd service
dependency links are left behind after one of our packages is
replaced.

--
Frode Nordahl

>>>
>>> --
>>> Frode Nordahl
>>>
>>> >>
>>> >> --
>>> >> Frode Nordahl
>>> >>
>>> >> >
>>> >> >
>>> >> >
>>> >> > On Tue, Mar 2, 2021 at 2:42 AM Ilya Maximets <i.maximets at ovn.org> wrote:
>>> >> >>
>>> >> >> On 3/2/21 6:52 AM, Frode Nordahl wrote:
>>> >> >> > On Mon, Mar 1, 2021 at 9:26 PM Ilya Maximets <i.maximets at ovn.org> wrote:
>>> >> >> >>
>>> >> >> >> On 2/25/21 4:28 PM, Frode Nordahl wrote:
>>> >> >> >>> 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 if it is not already set.
>>> >> >> >>>
>>> >> >> >>> 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 an Open vSwitch controlled
>>> >> >> >>> datapath as its only network connection, the current ordering of
>>> >> >> >>> events would always record a unreliable hostname.
>>> >> >> >>>
>>> >> >> >>> To tackle this problem this patchs adds an optional argument that
>>> >> >> >>> allows starting Open vSwitch without recording the hostname in
>>> >> >> >>> the database as well as a new ctl command to record the hostname
>>> >> >> >>> separately. This command can be called by the system startup
>>> >> >> >>> scripts when the system is ready to collect and record this
>>> >> >> >>> information.
>>> >> >> >>>
>>> >> >> >>> Reported-At: https://urldefense.com/v3/__https://bugs.launchpad.net/bugs/1915829__;!!IKRxdwAv5BmarQ!NOVNzYnNX0z7Is75RKTpkbzKWTqqhxvHQ8m4xEVtweIy9WE-BCw76yxV8PBtinU$
>>> >> >> >>> Signed-off-by: Frode Nordahl <frode.nordahl at canonical.com>
>>> >> >> >>> ---
>>> >> >> >>>  utilities/ovs-ctl.in | 41 +++++++++++++++++++++++++++--------------
>>> >> >> >>>  1 file changed, 27 insertions(+), 14 deletions(-)
>>> >> >> >>
>>> >> >> >> Thanks!
>>> >> >> >> I added a note to the NEWS file and applied to master.
>>> >> >> >
>>> >> >> > Excellent, thank you for review and merge!
>>> >> >> >
>>> >> >> >> We may consider backports down to 2.13 LTS.  Let me know
>>> >> >> >> if it's needed.
>>> >> >> >
>>> >> >> > We will consume this at 2.13 and onwards, so a backport all the way to
>>> >> >> > 2.13 LTS would really be helpful.
>>> >> >> >
>>> >> >>
>>> >> >> Done.
>>> >> >> _______________________________________________
>>> >> >> dev mailing list
>>> >> >> dev at openvswitch.org
>>> >> >> https://urldefense.com/v3/__https://mail.openvswitch.org/mailman/listinfo/ovs-dev__;!!IKRxdwAv5BmarQ!NOVNzYnNX0z7Is75RKTpkbzKWTqqhxvHQ8m4xEVtweIy9WE-BCw76yxVFbGw-DU$


More information about the dev mailing list