On Thu, 17 Sep 2020 17:24:49 -0300
Flavio Leitner <[email protected]> wrote:

> On Thu, Sep 10, 2020 at 03:38:04PM +0200, Timothy Redaelli wrote:
> > conf.db is by default at /etc/openvswitch, but it should be at
> > /var/lib/openvswitch like on Debian or like ovnnb_db.db and ovnsb_db.db.
> > 
> > If conf.db already exists in /etc/openvswitch then it's moved to
> > /var/lib/openvswitch.
> > Symlinks are created for conf.db and .conf.db.~lock~ into /etc/openvswitch
> > for backward compatibility.
> > 
> > Reported-at: https://bugzilla.redhat.com/1830857
> > Reported-by: Yedidyah Bar David <[email protected]>
> > Signed-off-by: Timothy Redaelli <[email protected]>
> > ---
> >  rhel/openvswitch-fedora.spec.in | 23 +++++++++++++++++++----
> >  1 file changed, 19 insertions(+), 4 deletions(-)
> > 
> > diff --git a/rhel/openvswitch-fedora.spec.in 
> > b/rhel/openvswitch-fedora.spec.in
> > index e3e0d8acf..d70959eba 100644
> > --- a/rhel/openvswitch-fedora.spec.in
> > +++ b/rhel/openvswitch-fedora.spec.in
> > @@ -244,8 +244,6 @@ rm -rf $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
> >  
> >  install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch
> >  
> > -touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/conf.db
> > -touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/.conf.db.~lock~
> >  touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/system-id.conf
> >  
> >  install -p -m 644 -D selinux/openvswitch-custom.pp \
> > @@ -333,6 +331,23 @@ if [ $1 -eq 1 ]; then
> >  fi
> >  %endif
> >  
> > +# Ensure that /etc/openvswitch/conf.db links to /var/lib/openvswitch,
> > +# moving an existing file if there is one.
> > +#
> > +# Ditto for .conf.db.~lock~.
> > +for base in conf.db .conf.db.~lock~; do
> > +    new=/var/lib/openvswitch/$base
> > +    old=/etc/openvswitch/$base
> > +    if test -f $old && test ! -e $new; then
> > +        mv $old $new
> > +    fi
> > +    if test ! -e $old && test ! -h $old; then
> 
> This doesn't look correct to me. The -e covers -h.

This line is correct (I copied this part from
debian/openvswitch-switch.postinst), and it's needed to skip doing ln
if $old is a broken symlink (since, in this case, test -e returns 1 and
test -h returns 0)

> > +        ln -s $new $old
> > +    fi
> > +    touch $new
> > +    chown openvswitch: $new
> 
> This should consider if dpdk is enabled or not and then
> set the correct group?

This makes sense, I'll send a v2 using %{with dpdk}

> Thanks,

Thank you

> fbl
> 
> > +done
> > +
> >  %if 0%{?systemd_post:1}
> >      # This may not enable openvswitch service or do daemon-reload.
> >      %systemd_post %{name}.service
> > @@ -418,8 +433,8 @@ fi
> >  %endif
> >  %dir %{_sysconfdir}/openvswitch
> >  %{_sysconfdir}/openvswitch/default.conf
> > -%config %ghost %{_sysconfdir}/openvswitch/conf.db
> > -%ghost %{_sysconfdir}/openvswitch/.conf.db.~lock~
> > +%config %ghost %{_sharedstatedir}/openvswitch/conf.db
> > +%ghost %{_sharedstatedir}/openvswitch/.conf.db.~lock~
> >  %config %ghost %{_sysconfdir}/openvswitch/system-id.conf
> >  %config(noreplace) %{_sysconfdir}/sysconfig/openvswitch
> >  %defattr(-,root,root)
> > -- 
> > 2.26.2
> > 
> > _______________________________________________
> > dev mailing list
> > [email protected]
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> 

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to