This commit builds upon some of the recent ovs-ctl changes to build a more integrated systemd setup. A new service (ovs-vswitchd) is added to track the ovs-vswitchd, and ovsdb-server service is reserved for the ovsdb-server daemon. The systemd scripts still use ovs-ctl to actually initialize the daemons.
Signed-off-by: Aaron Conole <acon...@redhat.com> Reviewed-by: Markos Chandras <mchand...@suse.de> --- v2: * Removed reference to ovs-vswitchd service from ovsdb-server service rhel/automake.mk | 1 + rhel/etc_sysconfig_network-scripts_ifup-ovs | 6 +++--- rhel/openvswitch-fedora.spec.in | 3 ++- rhel/usr_lib_systemd_system_openvswitch.service | 6 ++++-- rhel/usr_lib_systemd_system_ovs-vswitchd.service | 18 ++++++++++++++++++ rhel/usr_lib_systemd_system_ovsdb-server.service | 16 +++++++++------- 6 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 rhel/usr_lib_systemd_system_ovs-vswitchd.service diff --git a/rhel/automake.mk b/rhel/automake.mk index 7907a87..a3c180c 100644 --- a/rhel/automake.mk +++ b/rhel/automake.mk @@ -27,6 +27,7 @@ EXTRA_DIST += \ rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \ rhel/usr_lib_systemd_system_openvswitch.service \ rhel/usr_lib_systemd_system_ovsdb-server.service \ + rhel/usr_lib_systemd_system_ovs-vswitchd.service \ rhel/usr_lib_systemd_system_ovn-controller.service \ rhel/usr_lib_systemd_system_ovn-controller-vtep.service \ rhel/usr_lib_systemd_system_ovn-northd.service diff --git a/rhel/etc_sysconfig_network-scripts_ifup-ovs b/rhel/etc_sysconfig_network-scripts_ifup-ovs index eb58c3a..6f1c891 100755 --- a/rhel/etc_sysconfig_network-scripts_ifup-ovs +++ b/rhel/etc_sysconfig_network-scripts_ifup-ovs @@ -60,10 +60,10 @@ fi fi done -SERVICE_UNIT=/usr/lib/systemd/system/ovsdb-server.service +SERVICE_UNIT=/usr/lib/systemd/system/openvswitch.service if [ -f $SERVICE_UNIT ] && [ -x /usr/bin/systemctl ]; then - if ! systemctl --quiet is-active ovsdb-server.service; then - systemctl start ovsdb-server.service + if ! systemctl --quiet is-active openvswitch.service; then + systemctl start openvswitch.service fi else if [ ! -f /var/lock/subsys/openvswitch ]; then diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in index 253d5bc..b1f07e7 100644 --- a/rhel/openvswitch-fedora.spec.in +++ b/rhel/openvswitch-fedora.spec.in @@ -189,7 +189,7 @@ 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 ovsdb-server \ +for service in openvswitch ovsdb-server ovs-vswitchd \ ovn-controller ovn-controller-vtep ovn-northd; do install -p -D -m 0644 \ rhel/usr_lib_systemd_system_${service}.service \ @@ -417,6 +417,7 @@ fi %config(noreplace) %{_sysconfdir}/logrotate.d/openvswitch %{_unitdir}/openvswitch.service %{_unitdir}/ovsdb-server.service +%{_unitdir}/ovs-vswitchd.service %{_datadir}/openvswitch/scripts/openvswitch.init %{_sysconfdir}/sysconfig/network-scripts/ifup-ovs %{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs diff --git a/rhel/usr_lib_systemd_system_openvswitch.service b/rhel/usr_lib_systemd_system_openvswitch.service index 96c697b..a44574b 100644 --- a/rhel/usr_lib_systemd_system_openvswitch.service +++ b/rhel/usr_lib_systemd_system_openvswitch.service @@ -1,11 +1,13 @@ [Unit] Description=Open vSwitch -After=syslog.target network.target ovsdb-server.service -Requires=ovsdb-server.service +PartOf=network.target +BindsTo=ovsdb-server.service +BindsTo=ovs-vswitchd.service [Service] Type=oneshot ExecStart=/bin/true +ExecReload=/bin/true ExecStop=/bin/true RemainAfterExit=yes diff --git a/rhel/usr_lib_systemd_system_ovs-vswitchd.service b/rhel/usr_lib_systemd_system_ovs-vswitchd.service new file mode 100644 index 0000000..d3d020a --- /dev/null +++ b/rhel/usr_lib_systemd_system_ovs-vswitchd.service @@ -0,0 +1,18 @@ +[Unit] +Description=Open vSwitch Forwarding Unit +After=ovsdb-server.service +Requires=ovsdb-server.service +ReloadPropagatedFrom=ovsdb-server.service +AssertPathIsReadWrite=/var/run/openvswitch/db.sock +PartOf=openvswitch.service + +[Service] +Type=forking +EnvironmentFile=-/etc/sysconfig/openvswitch +ExecStart=/usr/share/openvswitch/scripts/ovs-ctl \ + --no-ovsdb-server --no-monitor --system-id=random \ + start $OPTIONS +ExecStop=/usr/share/openvswitch/scripts/ovs-ctl --no-ovsdb-server stop +ExecReload=/usr/share/openvswitch/scripts/ovs-ctl --no-ovsdb-server \ + --no-monitor --system-id=random \ + restart $OPTIONS diff --git a/rhel/usr_lib_systemd_system_ovsdb-server.service b/rhel/usr_lib_systemd_system_ovsdb-server.service index e4c2a66..46e3e08 100644 --- a/rhel/usr_lib_systemd_system_ovsdb-server.service +++ b/rhel/usr_lib_systemd_system_ovsdb-server.service @@ -1,15 +1,17 @@ [Unit] -Description=Open vSwitch Internal Unit +Description=Open vSwitch Database Unit After=syslog.target +ReloadPropagatedFrom=openvswitch.service PartOf=openvswitch.service -Wants=openvswitch.service [Service] -Type=oneshot -RemainAfterExit=yes +Type=forking EnvironmentFile=-/etc/sysconfig/openvswitch -ExecStart=/usr/share/openvswitch/scripts/ovs-ctl start \ - --system-id=random $OPTIONS -ExecStop=/usr/share/openvswitch/scripts/ovs-ctl stop +ExecStart=/usr/share/openvswitch/scripts/ovs-ctl \ + --no-ovs-vswitchd --no-monitor --system-id=random \ + start $OPTIONS +ExecStop=/usr/share/openvswitch/scripts/ovs-ctl --no-ovs-vswitchd stop +ExecReload=/usr/share/openvswitch/scripts/ovs-ctl --no-ovs-vswitchd \ + --no-monitor restart $OPTIONS RuntimeDirectory=openvswitch RuntimeDirectoryMode=0755 -- 2.5.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev