[ovs-dev] [PATCH 1/3] rhel: Use same rundir for ovs and ovn.

Russell Bryant rbryant at redhat.com
Thu Aug 27 19:49:13 UTC 2015


On 08/27/2015 03:26 PM, Flavio Leitner wrote:
> On Wed, Aug 26, 2015 at 05:46:53PM -0400, Russell Bryant wrote:
>> The previous systemd units for OVN had systemd create a rundir for
>> each daemon (ovn-northd and ovn-controller).  This "worked", in that
>> the services did start successfully.  However, they didn't actually
>> work.  In practice, both services make use of files in the main ovs
>> rundir, so just run everything from there.  It keeps things simple and
>> makes the services actually work.
> 
> The above sounds like a bug somewhere else.
> Why are they not using the correct OVS_RUNDIR?
> 
> The good thing about having different directories for each service
> is that we can have more specific selinux rules and permissions.

OK, I wasn't sure about the benefits of keeping them separate.

I *think* ovn-controller is the only one where I hit a problem I
couldn't work around without a patch.  Making them all use the same
rundir (this patch) was one option.  There are others, though.

In ovn/controller/ofctrl.c, ofctrl_run(), we have:

>   target = xasprintf("unix:%s/%s.mgmt", ovs_rundir(), br_int->name);

ovs_rundir() gives the dir for ovn-controller, where we actually need
the rundir for ovs-vswitchd here.

We could add a new option to ovn-controller like --vswitchd-rundir.
That'd be a trivial enough fix.  It feels like a hack, though.

> 
> 
>  
>> Signed-off-by: Russell Bryant <rbryant at redhat.com>
>> ---
>>  rhel/openvswitch-fedora.spec.in                    | 2 --
>>  rhel/usr_lib_systemd_system_ovn-controller.service | 9 +++------
>>  rhel/usr_lib_systemd_system_ovn-northd.service     | 5 +----
>>  3 files changed, 4 insertions(+), 12 deletions(-)
>>
>> diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
>> index 4d403e0..4789704 100644
>> --- a/rhel/openvswitch-fedora.spec.in
>> +++ b/rhel/openvswitch-fedora.spec.in
>> @@ -342,8 +342,6 @@ rm -rf $RPM_BUILD_ROOT
>>  %config %{_datadir}/openvswitch/ovn-sb.ovsschema
>>  %{_unitdir}/ovn-controller.service
>>  %{_unitdir}/ovn-northd.service
>> -%ghost %attr(755,root,root) %{_rundir}/ovn-controller
>> -%ghost %attr(755,root,root) %{_rundir}/ovn-northd
>>  
>>  %changelog
>>  * Wed Jan 12 2011 Ralf Spenneberg <ralf at os-s.net>
>> diff --git a/rhel/usr_lib_systemd_system_ovn-controller.service b/rhel/usr_lib_systemd_system_ovn-controller.service
>> index 4fdcfd2..7637fe7 100644
>> --- a/rhel/usr_lib_systemd_system_ovn-controller.service
>> +++ b/rhel/usr_lib_systemd_system_ovn-controller.service
>> @@ -6,11 +6,8 @@ After=openvswitch.service
>>  
>>  [Service]
>>  Type=simple
>> -RuntimeDirectory=ovn-controller
>> -RuntimeDirectoryMode=0755
>> -PIDFile=%t/ovn-controller/ovn-controller.pid
>> -Environment=OVS_RUNDIR=%t/ovn-controller
>> +Environment=OVS_RUNDIR=%t/openvswitch
>>  ExecStart=/usr/bin/ovn-controller -vconsole:emer -vsyslog:err -vfile:info \
>>            --log-file=/var/log/openvswitch/ovn-controller.log \
>> -          --no-chdir --pidfile=%t/ovn-controller/ovn-controller.pid \
>> -          unix:/var/run/openvswitch/db.sock
>> +          --no-chdir --pidfile=${OVS_RUNDIR}/ovn-controller.pid \
>> +          unix:${OVS_RUNDIR}/db.sock
>> diff --git a/rhel/usr_lib_systemd_system_ovn-northd.service b/rhel/usr_lib_systemd_system_ovn-northd.service
>> index fcbf646..5b3b03a 100644
>> --- a/rhel/usr_lib_systemd_system_ovn-northd.service
>> +++ b/rhel/usr_lib_systemd_system_ovn-northd.service
>> @@ -7,9 +7,6 @@ After=openvswitch.service
>>  [Service]
>>  Type=oneshot
>>  RemainAfterExit=yes
>> -RuntimeDirectory=ovn-northd
>> -RuntimeDirectoryMode=0755
>> -PIDFile=%t/ovn-northd/ovn-northd.pid
>> -Environment=OVN_RUNDIR=%t/ovn-northd OVS_RUNDIR=%t/openvswitch OVS_DBDIR=/var/lib/openvswitch
>> +Environment=OVS_RUNDIR=%t/openvswitch OVS_DBDIR=/var/lib/openvswitch
>>  ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_northd
>>  ExecStop=/usr/share/openvswitch/scripts/ovn-ctl stop_northd
>> -- 
>> 2.4.3
>>
>> _______________________________________________
>> dev mailing list
>> dev at openvswitch.org
>> http://openvswitch.org/mailman/listinfo/dev
> 


-- 
Russell Bryant



More information about the dev mailing list