On 05/22/2015 05:31 AM, Flavio Leitner wrote:
> On Mon, May 04, 2015 at 05:40:46PM -0400, Russell Bryant wrote:
>> This patch creates a new subpackage for OVN, openvswitch-ovn. It also
>> installs systemd unit files for ovn-controller and ovn-northd.
>>
>> If you want to run ovn-controller:
>>
>> # systemctl start ovncontroller
>>
>> If you want to run ovn-northd:
>>
>> # systemctl start ovnnorthd
>>
>> Both systemd units are currently set to depend on openvswitch.
>> Technically you could ovn-northd and ovsdb-server without ovs running
>> locally as well, but that will require some additional work.
>>
>> This also means that you need to configure the openvswitch service to
>> serve the two OVN databases, as well: That is done by running the
>> following commands before starting or restarting openvswitch:
>>
>> # ovn-ctl create_ovn_dbs
>> # cat << EOF > /etc/sysconfig/openvswitch
>> OPTIONS="'--extra-dbs=ovnnb.db ovnsb.db'"
>> EOF
>>
>> Signed-off-by: Russell Bryant <[email protected]>
>> ---
>> rhel/automake.mk | 4 ++-
>> rhel/openvswitch-fedora.spec.in | 43
>> +++++++++++++++++++----
>> rhel/usr_lib_systemd_system_ovncontroller.service | 14 ++++++++
>> rhel/usr_lib_systemd_system_ovnnorthd.service | 13 +++++++
>> 4 files changed, 67 insertions(+), 7 deletions(-)
>> create mode 100644 rhel/usr_lib_systemd_system_ovncontroller.service
>> create mode 100644 rhel/usr_lib_systemd_system_ovnnorthd.service
>>
>> diff --git a/rhel/automake.mk b/rhel/automake.mk
>> index 9c3433b..fab3634 100644
>> --- a/rhel/automake.mk
>> +++ b/rhel/automake.mk
>> @@ -24,7 +24,9 @@ EXTRA_DIST += \
>> rhel/usr_share_openvswitch_scripts_sysconfig.template \
>> rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \
>> rhel/usr_lib_systemd_system_openvswitch.service \
>> - rhel/usr_lib_systemd_system_openvswitch-nonetwork.service
>> + rhel/usr_lib_systemd_system_openvswitch-nonetwork.service \
>> + rhel/usr_lib_systemd_system_ovncontroller.service \
>> + rhel/usr_lib_systemd_system_ovnnorthd.service
>>
>> update_rhel_spec = \
>> $(AM_V_GEN)($(ro_shell) && sed -e 's,[@]VERSION[@],$(VERSION),g') \
>> diff --git a/rhel/openvswitch-fedora.spec.in
>> b/rhel/openvswitch-fedora.spec.in
>> index f3dbebf..5b4e9ef 100644
>> --- a/rhel/openvswitch-fedora.spec.in
>> +++ b/rhel/openvswitch-fedora.spec.in
>> @@ -81,6 +81,19 @@ Provides: openvswitch-static = %{version}-%{release}
>> This provides static library, libopenswitch.a and the openvswitch header
>> files needed to build an external application.
>>
>> +%package ovn
>> +Summary: Open vSwitch - Open Virtual Network support
>> +License: ASL 2.0
>> +Requires: openvswitch
>> +
>> +%description ovn
>> +OVN, the Open Virtual Network, is a system to support virtual network
>> +abstraction. OVN complements the existing capabilities of OVS to add
>> +native support for virtual network abstractions, such as virtual L2 and L3
>> +overlays and security groups. Services such as DHCP are also desirable
>> +features. Just like OVS, OVN's design goal is to have a production-quality
>> +implementation that can operate at significant scale.
>
> Perhaps remove the last sentence, but I will leave that up to you.
Sure, that's fine with me. I went ahead and removed the last 2 sentences.
>
>> +
>>
>> %prep
>> %setup -q
>> @@ -98,13 +111,14 @@ install -d -m 0755
>> $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch
>> install -p -D -m 0644 \
>> rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \
>> $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/openvswitch
>> +for service in openvswitch ovncontroller ovnnorthd; do
>> + install -p -D -m 0644 \
>> + rhel/usr_lib_systemd_system_${service}.service \
>> + $RPM_BUILD_ROOT%{_unitdir}/${service}.service
>> +done
>> install -p -D -m 0644 \
>> - rhel/usr_lib_systemd_system_openvswitch.service \
>> - $RPM_BUILD_ROOT%{_unitdir}/openvswitch.service
>> -install -p -D -m 0644 \
>> - rhel/usr_lib_systemd_system_openvswitch-nonetwork.service \
>> - $RPM_BUILD_ROOT%{_unitdir}/openvswitch-nonetwork.service
>> -
>> + rhel/usr_lib_systemd_system_openvswitch-nonetwork.service \
>> + $RPM_BUILD_ROOT%{_unitdir}/openvswitch-nonetwork.service
>> install -m 0755 rhel/etc_init.d_openvswitch \
>
> Why not include openvswitch-nonetwork in that loop above?
I don't know. :-)
I added it now.
>
>
>> $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/openvswitch.init
>>
>> @@ -269,6 +283,23 @@ rm -rf $RPM_BUILD_ROOT
>> %exclude %{_mandir}/man8/ovs-vlan-bug-workaround.8.gz
>> %exclude %{_datadir}/openvswitch/scripts/ovs-save
>>
>> +%files ovn
>> +%{_bindir}/ovn-controller
>> +%{_bindir}/ovn-nbctl
>> +%{_bindir}/ovn-northd
>> +%{_datadir}/openvswitch/scripts/ovn-ctl
>> +%{_mandir}/man8/ovs-testcontroller.8*
>> +%{_mandir}/man5/ovn-nb.5*
>> +%{_mandir}/man5/ovn-sb.5*
>> +%{_mandir}/man7/ovn-architecture.7*
>> +%{_mandir}/man8/ovn-controller.8*
>> +%{_mandir}/man8/ovn-ctl.8*
>> +%{_mandir}/man8/ovn-nbctl.8*
>> +%config %{_datadir}/openvswitch/ovn-nb.ovsschema
>> +%config %{_datadir}/openvswitch/ovn-sb.ovsschema
>> +%{_unitdir}/ovncontroller.service
>> +%{_unitdir}/ovnnorthd.service
>> +
>> %changelog
>> * Wed Jan 12 2011 Ralf Spenneberg <[email protected]>
>> - First build on F14
>> diff --git a/rhel/usr_lib_systemd_system_ovncontroller.service
>> b/rhel/usr_lib_systemd_system_ovncontroller.service
>> new file mode 100644
>> index 0000000..b30bb9a
>> --- /dev/null
>> +++ b/rhel/usr_lib_systemd_system_ovncontroller.service
>> @@ -0,0 +1,14 @@
>> +[Unit]
>> +Description=OVN controller daemon
>> +After=syslog.target
>> +Requires=openvswitch.service
>> +After=openvswitch.service
>> +
>> +[Service]
>> +Type=forking
>> +PIDFile=/var/run/openvswitch/ovn-controller.pid
>> +ExecStart=/usr/bin/ovn-controller -vconsole:emer -vsyslog:err -vfile:info \
>> + --log-file=/var/log/openvswitch/ovn-controller.log \
>> + --detach --no-chdir \
>
> Can't we take --detach out and leave Type=simple or even remove Type=?
Yes, it seems so. Thanks for helping simplify this!
>
>
>> + --pidfile=/var/run/openvswitch/ovn-controller.pid \
>> + unix:/var/run/openvswitch/db.sock
>> diff --git a/rhel/usr_lib_systemd_system_ovnnorthd.service
>> b/rhel/usr_lib_systemd_system_ovnnorthd.service
>> new file mode 100644
>> index 0000000..7a20d59
>> --- /dev/null
>> +++ b/rhel/usr_lib_systemd_system_ovnnorthd.service
>> @@ -0,0 +1,13 @@
>> +[Unit]
>> +Description=OVN northd management daemon
>> +After=syslog.target
>> +Requires=openvswitch.service
>> +After=openvswitch.service
>> +
>> +[Service]
>> +Type=forking
>> +PIDFile=/var/run/openvswitch/ovn-northd.pid
>> +ExecStart=/usr/bin/ovn-northd -vconsole:emer -vsyslog:err -vfile:info \
>> + --log-file=/var/log/openvswitch/ovn-northd.log \
>> + --detach --no-chdir \
>> + --pidfile=/var/run/openvswitch/ovn-northd.pid
>
> Same here.
OK, done.
>
> Does ovn-controller or ovn-northd the need a rundir (/var/run/) like OVS?
Yes.
> If so, we can leave to systemd to manage the directory too. Just need to
> include these lines in each service above:
> RuntimeDirectory=<ovn-..>
> RuntimeDirectoryMode=0755
>
> and fix the ownership in the spec file too:
> +%ghost %attr(755,root,root) %{_rundir}/<ovs-...>
OK, thanks for the tip! I'll see if I can integrate this.
> It's much better when comparing with the previous one.
> Thanks a lot for your work!
Thank you for the reviews! I'll work on the updates to this patch and
send out a v3.
--
Russell Bryant
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev