Re: [ovs-dev] [PATCH v2] rhel: move conf.db to /var/lib/openvswitch, using symlinks

2022-12-15 Thread Ilya Maximets
On 12/15/22 15:38, Timothy Redaelli wrote:
> On Tue, 13 Dec 2022 12:57:08 +0100
> Ilya Maximets  wrote:
> 
>> On 12/5/22 15:36, Ilya Maximets wrote:
>>> On 12/4/22 09:23, Roi Dayan wrote:


 On 30/11/2022 17:55, Ilya Maximets wrote:
> On 11/14/22 20:41, 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://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.redhat.com%2F1830857data=05%7C01%7Croid%40nvidia.com%7Cd69116141ff645fc2c7308dad2eb4612%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638054205222362304%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7Csdata=%2BIcIVZBKrfhIpq%2B6r6I3QvjdZ9KvjLsrRSlvi9kFHzc%3Dreserved=0
>> Reported-by: Yedidyah Bar David 
>> Signed-off-by: Timothy Redaelli 
>> ---
>> v1 -> v2:
>> - Use hugetlbfs group instead of openvswitch when the package is built
>>   with dpdk (as reported by Flavio)
>> ---
>>  rhel/openvswitch-fedora.spec.in | 27 +++
>>  1 file changed, 23 insertions(+), 4 deletions(-)
>
> If that works for Fedora, then LGTM.  Applied.
>
> Thanks!
> Best regards, Ilya Maximets.
> ___
> dev mailing list
> d...@openvswitch.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.openvswitch.org%2Fmailman%2Flistinfo%2Fovs-devdata=05%7C01%7Croid%40nvidia.com%7Cd69116141ff645fc2c7308dad2eb4612%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638054205222362304%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7Csdata=fZZh4iYeUu%2BL2%2F%2FWTIgPNzpvfhpe%2F9MANkVPLmv57aY%3Dreserved=0


 hi,

 This commit expose some kind of issue and cause openvswitch not
 to start on clean systems.

 If old conf.db file didn't exists it creates an empty conf.db with
 the touch command.
 Empty conf.db cause ovsdb-server not to start.

 #  /usr/share/openvswitch/scripts/ovs-ctl start
 ovsdb-tool: ovsdb error: /etc/openvswitch/conf.db: cannot identify file 
 type
 Starting ovsdb-server ovsdb-server: ovsdb error: /etc/openvswitch/conf.db: 
 cannot identify file type
[FAILED]

 If I remove the conf.db file (can leave the symbolic link in /etc)
 then ovs starts fine.
 # rm /var/lib/openvswitch/conf.db
 #  /usr/share/openvswitch/scripts/ovs-ctl start
 /etc/openvswitch/conf.db does not exist ... (warning).
 Creating empty database /etc/openvswitch/conf.db   [  OK  ]
 Starting ovsdb-server  [  OK  ]
 system ID not configured, please use --system-id ... failed!
 Configuring Open vSwitch system IDs[  OK  ]
 Starting ovs-vswitchd  [  OK  ]
 Enabling remote OVSDB managers [  OK  ]


 I'm not sure where it's better to fix this. either the spec here
 not to create an empty file or in ovsdb/log.c to an accept empty conf.db,
 or maybe even upgrade_db() in ovs-lib bash file to call create_db
 even if conf.db exists but it's empty.
>>>
>>> Thanks, Roi, for the report!
>>> I think, fixing the spec should be the right approach here.
>>
>> Hi, Timothy.  Do you plan to work on the fix for this issue?
> 
> Yes sure, I'll do that today or tomorrow
> 
>> Otherwise we may just revert the change for now until the proper
>> fix is available.  Thoughts?
> 
> I prefer just to fix it, without the revert, if it's possible

If you know how to fix that, than sure.  I tried to quickly come up
with a fix before sending a revert patch, but I wasn't successful.

Here is what I tried:

diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
index 4a3e6294b..ebb6a46ed 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -339,11 +339,10 @@ for base in conf.db .conf.db.~lock~; do
 if test ! -e $old && test ! -h $old; then
 ln -s $new $old
 fi
-touch $new
 %if %{with dpdk}
-chown openvswitch:hugetlbfs $new
+chown -h openvswitch:hugetlbfs $old
 %else
-chown openvswitch:openvswitch $new
+chown -h openvswitch:openvswitch $old
 %endif
 done
 
---

With that the ovsdb-server service still fails to start on my system.

Best regards, Ilya Maximets.
___
dev mailing list
d...@openvswitch.org

Re: [ovs-dev] [PATCH v2] rhel: move conf.db to /var/lib/openvswitch, using symlinks

2022-12-15 Thread Timothy Redaelli
On Tue, 13 Dec 2022 12:57:08 +0100
Ilya Maximets  wrote:

> On 12/5/22 15:36, Ilya Maximets wrote:
> > On 12/4/22 09:23, Roi Dayan wrote:
> >>
> >>
> >> On 30/11/2022 17:55, Ilya Maximets wrote:
> >>> On 11/14/22 20:41, 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://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.redhat.com%2F1830857data=05%7C01%7Croid%40nvidia.com%7Cd69116141ff645fc2c7308dad2eb4612%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638054205222362304%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7Csdata=%2BIcIVZBKrfhIpq%2B6r6I3QvjdZ9KvjLsrRSlvi9kFHzc%3Dreserved=0
>  Reported-by: Yedidyah Bar David 
>  Signed-off-by: Timothy Redaelli 
>  ---
>  v1 -> v2:
>  - Use hugetlbfs group instead of openvswitch when the package is built
>    with dpdk (as reported by Flavio)
>  ---
>   rhel/openvswitch-fedora.spec.in | 27 +++
>   1 file changed, 23 insertions(+), 4 deletions(-)
> >>>
> >>> If that works for Fedora, then LGTM.  Applied.
> >>>
> >>> Thanks!
> >>> Best regards, Ilya Maximets.
> >>> ___
> >>> dev mailing list
> >>> d...@openvswitch.org
> >>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.openvswitch.org%2Fmailman%2Flistinfo%2Fovs-devdata=05%7C01%7Croid%40nvidia.com%7Cd69116141ff645fc2c7308dad2eb4612%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638054205222362304%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7Csdata=fZZh4iYeUu%2BL2%2F%2FWTIgPNzpvfhpe%2F9MANkVPLmv57aY%3Dreserved=0
> >>
> >>
> >> hi,
> >>
> >> This commit expose some kind of issue and cause openvswitch not
> >> to start on clean systems.
> >>
> >> If old conf.db file didn't exists it creates an empty conf.db with
> >> the touch command.
> >> Empty conf.db cause ovsdb-server not to start.
> >>
> >> #  /usr/share/openvswitch/scripts/ovs-ctl start
> >> ovsdb-tool: ovsdb error: /etc/openvswitch/conf.db: cannot identify file 
> >> type
> >> Starting ovsdb-server ovsdb-server: ovsdb error: /etc/openvswitch/conf.db: 
> >> cannot identify file type
> >>[FAILED]
> >>
> >> If I remove the conf.db file (can leave the symbolic link in /etc)
> >> then ovs starts fine.
> >> # rm /var/lib/openvswitch/conf.db
> >> #  /usr/share/openvswitch/scripts/ovs-ctl start
> >> /etc/openvswitch/conf.db does not exist ... (warning).
> >> Creating empty database /etc/openvswitch/conf.db   [  OK  ]
> >> Starting ovsdb-server  [  OK  ]
> >> system ID not configured, please use --system-id ... failed!
> >> Configuring Open vSwitch system IDs[  OK  ]
> >> Starting ovs-vswitchd  [  OK  ]
> >> Enabling remote OVSDB managers [  OK  ]
> >>
> >>
> >> I'm not sure where it's better to fix this. either the spec here
> >> not to create an empty file or in ovsdb/log.c to an accept empty conf.db,
> >> or maybe even upgrade_db() in ovs-lib bash file to call create_db
> >> even if conf.db exists but it's empty.
> > 
> > Thanks, Roi, for the report!
> > I think, fixing the spec should be the right approach here.
> 
> Hi, Timothy.  Do you plan to work on the fix for this issue?

Yes sure, I'll do that today or tomorrow

> Otherwise we may just revert the change for now until the proper
> fix is available.  Thoughts?

I prefer just to fix it, without the revert, if it's possible

> Best regards, Ilya Maximets.
> 

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] rhel: move conf.db to /var/lib/openvswitch, using symlinks

2022-12-13 Thread Ilya Maximets
On 12/5/22 15:36, Ilya Maximets wrote:
> On 12/4/22 09:23, Roi Dayan wrote:
>>
>>
>> On 30/11/2022 17:55, Ilya Maximets wrote:
>>> On 11/14/22 20:41, 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://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.redhat.com%2F1830857data=05%7C01%7Croid%40nvidia.com%7Cd69116141ff645fc2c7308dad2eb4612%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638054205222362304%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7Csdata=%2BIcIVZBKrfhIpq%2B6r6I3QvjdZ9KvjLsrRSlvi9kFHzc%3Dreserved=0
 Reported-by: Yedidyah Bar David 
 Signed-off-by: Timothy Redaelli 
 ---
 v1 -> v2:
 - Use hugetlbfs group instead of openvswitch when the package is built
   with dpdk (as reported by Flavio)
 ---
  rhel/openvswitch-fedora.spec.in | 27 +++
  1 file changed, 23 insertions(+), 4 deletions(-)
>>>
>>> If that works for Fedora, then LGTM.  Applied.
>>>
>>> Thanks!
>>> Best regards, Ilya Maximets.
>>> ___
>>> dev mailing list
>>> d...@openvswitch.org
>>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.openvswitch.org%2Fmailman%2Flistinfo%2Fovs-devdata=05%7C01%7Croid%40nvidia.com%7Cd69116141ff645fc2c7308dad2eb4612%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638054205222362304%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7Csdata=fZZh4iYeUu%2BL2%2F%2FWTIgPNzpvfhpe%2F9MANkVPLmv57aY%3Dreserved=0
>>
>>
>> hi,
>>
>> This commit expose some kind of issue and cause openvswitch not
>> to start on clean systems.
>>
>> If old conf.db file didn't exists it creates an empty conf.db with
>> the touch command.
>> Empty conf.db cause ovsdb-server not to start.
>>
>> #  /usr/share/openvswitch/scripts/ovs-ctl start
>> ovsdb-tool: ovsdb error: /etc/openvswitch/conf.db: cannot identify file type
>> Starting ovsdb-server ovsdb-server: ovsdb error: /etc/openvswitch/conf.db: 
>> cannot identify file type
>>[FAILED]
>>
>> If I remove the conf.db file (can leave the symbolic link in /etc)
>> then ovs starts fine.
>> # rm /var/lib/openvswitch/conf.db
>> #  /usr/share/openvswitch/scripts/ovs-ctl start
>> /etc/openvswitch/conf.db does not exist ... (warning).
>> Creating empty database /etc/openvswitch/conf.db   [  OK  ]
>> Starting ovsdb-server  [  OK  ]
>> system ID not configured, please use --system-id ... failed!
>> Configuring Open vSwitch system IDs[  OK  ]
>> Starting ovs-vswitchd  [  OK  ]
>> Enabling remote OVSDB managers [  OK  ]
>>
>>
>> I'm not sure where it's better to fix this. either the spec here
>> not to create an empty file or in ovsdb/log.c to an accept empty conf.db,
>> or maybe even upgrade_db() in ovs-lib bash file to call create_db
>> even if conf.db exists but it's empty.
> 
> Thanks, Roi, for the report!
> I think, fixing the spec should be the right approach here.

Hi, Timothy.  Do you plan to work on the fix for this issue?

Otherwise we may just revert the change for now until the proper
fix is available.  Thoughts?

Best regards, Ilya Maximets.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] rhel: move conf.db to /var/lib/openvswitch, using symlinks

2022-12-05 Thread Ilya Maximets
On 12/4/22 09:23, Roi Dayan wrote:
> 
> 
> On 30/11/2022 17:55, Ilya Maximets wrote:
>> On 11/14/22 20:41, 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://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.redhat.com%2F1830857data=05%7C01%7Croid%40nvidia.com%7Cd69116141ff645fc2c7308dad2eb4612%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638054205222362304%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7Csdata=%2BIcIVZBKrfhIpq%2B6r6I3QvjdZ9KvjLsrRSlvi9kFHzc%3Dreserved=0
>>> Reported-by: Yedidyah Bar David 
>>> Signed-off-by: Timothy Redaelli 
>>> ---
>>> v1 -> v2:
>>> - Use hugetlbfs group instead of openvswitch when the package is built
>>>   with dpdk (as reported by Flavio)
>>> ---
>>>  rhel/openvswitch-fedora.spec.in | 27 +++
>>>  1 file changed, 23 insertions(+), 4 deletions(-)
>>
>> If that works for Fedora, then LGTM.  Applied.
>>
>> Thanks!
>> Best regards, Ilya Maximets.
>> ___
>> dev mailing list
>> d...@openvswitch.org
>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.openvswitch.org%2Fmailman%2Flistinfo%2Fovs-devdata=05%7C01%7Croid%40nvidia.com%7Cd69116141ff645fc2c7308dad2eb4612%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638054205222362304%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7Csdata=fZZh4iYeUu%2BL2%2F%2FWTIgPNzpvfhpe%2F9MANkVPLmv57aY%3Dreserved=0
> 
> 
> hi,
> 
> This commit expose some kind of issue and cause openvswitch not
> to start on clean systems.
> 
> If old conf.db file didn't exists it creates an empty conf.db with
> the touch command.
> Empty conf.db cause ovsdb-server not to start.
> 
> #  /usr/share/openvswitch/scripts/ovs-ctl start
> ovsdb-tool: ovsdb error: /etc/openvswitch/conf.db: cannot identify file type
> Starting ovsdb-server ovsdb-server: ovsdb error: /etc/openvswitch/conf.db: 
> cannot identify file type
>[FAILED]
> 
> If I remove the conf.db file (can leave the symbolic link in /etc)
> then ovs starts fine.
> # rm /var/lib/openvswitch/conf.db
> #  /usr/share/openvswitch/scripts/ovs-ctl start
> /etc/openvswitch/conf.db does not exist ... (warning).
> Creating empty database /etc/openvswitch/conf.db   [  OK  ]
> Starting ovsdb-server  [  OK  ]
> system ID not configured, please use --system-id ... failed!
> Configuring Open vSwitch system IDs[  OK  ]
> Starting ovs-vswitchd  [  OK  ]
> Enabling remote OVSDB managers [  OK  ]
> 
> 
> I'm not sure where it's better to fix this. either the spec here
> not to create an empty file or in ovsdb/log.c to an accept empty conf.db,
> or maybe even upgrade_db() in ovs-lib bash file to call create_db
> even if conf.db exists but it's empty.

Thanks, Roi, for the report!
I think, fixing the spec should be the right approach here.

Best regards, Ilya Maximets.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] rhel: move conf.db to /var/lib/openvswitch, using symlinks

2022-12-04 Thread Roi Dayan via dev



On 30/11/2022 17:55, Ilya Maximets wrote:
> On 11/14/22 20:41, 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://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.redhat.com%2F1830857data=05%7C01%7Croid%40nvidia.com%7Cd69116141ff645fc2c7308dad2eb4612%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638054205222362304%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7Csdata=%2BIcIVZBKrfhIpq%2B6r6I3QvjdZ9KvjLsrRSlvi9kFHzc%3Dreserved=0
>> Reported-by: Yedidyah Bar David 
>> Signed-off-by: Timothy Redaelli 
>> ---
>> v1 -> v2:
>> - Use hugetlbfs group instead of openvswitch when the package is built
>>   with dpdk (as reported by Flavio)
>> ---
>>  rhel/openvswitch-fedora.spec.in | 27 +++
>>  1 file changed, 23 insertions(+), 4 deletions(-)
> 
> If that works for Fedora, then LGTM.  Applied.
> 
> Thanks!
> Best regards, Ilya Maximets.
> ___
> dev mailing list
> d...@openvswitch.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.openvswitch.org%2Fmailman%2Flistinfo%2Fovs-devdata=05%7C01%7Croid%40nvidia.com%7Cd69116141ff645fc2c7308dad2eb4612%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638054205222362304%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7Csdata=fZZh4iYeUu%2BL2%2F%2FWTIgPNzpvfhpe%2F9MANkVPLmv57aY%3Dreserved=0


hi,

This commit expose some kind of issue and cause openvswitch not
to start on clean systems.

If old conf.db file didn't exists it creates an empty conf.db with
the touch command.
Empty conf.db cause ovsdb-server not to start.

#  /usr/share/openvswitch/scripts/ovs-ctl start
ovsdb-tool: ovsdb error: /etc/openvswitch/conf.db: cannot identify file type
Starting ovsdb-server ovsdb-server: ovsdb error: /etc/openvswitch/conf.db: 
cannot identify file type
   [FAILED]

If I remove the conf.db file (can leave the symbolic link in /etc)
then ovs starts fine.
# rm /var/lib/openvswitch/conf.db
#  /usr/share/openvswitch/scripts/ovs-ctl start
/etc/openvswitch/conf.db does not exist ... (warning).
Creating empty database /etc/openvswitch/conf.db   [  OK  ]
Starting ovsdb-server  [  OK  ]
system ID not configured, please use --system-id ... failed!
Configuring Open vSwitch system IDs[  OK  ]
Starting ovs-vswitchd  [  OK  ]
Enabling remote OVSDB managers [  OK  ]


I'm not sure where it's better to fix this. either the spec here
not to create an empty file or in ovsdb/log.c to an accept empty conf.db,
or maybe even upgrade_db() in ovs-lib bash file to call create_db
even if conf.db exists but it's empty.

Thanks,
Roi
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] rhel: move conf.db to /var/lib/openvswitch, using symlinks

2022-11-30 Thread Ilya Maximets
On 11/14/22 20:41, 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 
> Signed-off-by: Timothy Redaelli 
> ---
> v1 -> v2:
> - Use hugetlbfs group instead of openvswitch when the package is built
>   with dpdk (as reported by Flavio)
> ---
>  rhel/openvswitch-fedora.spec.in | 27 +++
>  1 file changed, 23 insertions(+), 4 deletions(-)

If that works for Fedora, then LGTM.  Applied.

Thanks!
Best regards, Ilya Maximets.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2] rhel: move conf.db to /var/lib/openvswitch, using symlinks

2022-11-14 Thread Timothy Redaelli
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 
Signed-off-by: Timothy Redaelli 
---
v1 -> v2:
- Use hugetlbfs group instead of openvswitch when the package is built
  with dpdk (as reported by Flavio)
---
 rhel/openvswitch-fedora.spec.in | 27 +++
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
index df296ea08..c8d238fbc 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -239,8 +239,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 \
@@ -329,6 +327,27 @@ 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
+ln -s $new $old
+fi
+touch $new
+%if %{with dpdk}
+chown openvswitch:hugetlbfs $new
+%else
+chown openvswitch:openvswitch $new
+%endif
+done
+
 %if 0%{?systemd_post:1}
 # This may not enable openvswitch service or do daemon-reload.
 %systemd_post %{name}.service
@@ -414,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.38.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev