[ovs-dev,v4,2/2] rhel: Add systemd support to delete transient ports only on boot

Message ID 6cc09b4922f4c7944ebb4e030fefac3380966233.1504871394.git.tredaelli@redhat.com
State New
Headers show
Series
  • Add system service to delete transient ports on boot.
Related show

Commit Message

Timothy Redaelli Sept. 13, 2017, 7:35 a.m.
Using the dependencies feature of systemd ovs-delete-transient-ports.service
is only started once and so transient ports are only deleted only the first
time after boot.

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
---
 rhel/automake.mk                                               |  1 +
 rhel/openvswitch-fedora.spec.in                                |  3 ++-
 rhel/usr_lib_systemd_system_ovs-delete-transient-ports.service | 10 ++++++++++
 rhel/usr_lib_systemd_system_ovsdb-server.service               |  1 +
 4 files changed, 14 insertions(+), 1 deletion(-)
 create mode 100644 rhel/usr_lib_systemd_system_ovs-delete-transient-ports.service

Patch

diff --git a/rhel/automake.mk b/rhel/automake.mk
index 1d1ac1a13..9336f0912 100644
--- a/rhel/automake.mk
+++ b/rhel/automake.mk
@@ -30,6 +30,7 @@  EXTRA_DIST += \
 	rhel/usr_lib_systemd_system_openvswitch.service \
 	rhel/usr_lib_systemd_system_ovsdb-server.service \
 	rhel/usr_lib_systemd_system_ovs-vswitchd.service.in \
+	rhel/usr_lib_systemd_system_ovs-delete-transient-ports.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/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
index dd79fa9a0..a08f369a3 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -259,7 +259,7 @@  install -p -D -m 0644 rhel/usr_lib_udev_rules.d_91-vfio.rules \
 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 ovs-vswitchd \
+for service in openvswitch ovsdb-server ovs-vswitchd ovs-delete-transient-ports \
 		ovn-controller ovn-controller-vtep ovn-northd; do
 	install -p -D -m 0644 \
 			rhel/usr_lib_systemd_system_${service}.service \
@@ -528,6 +528,7 @@  fi
 %{_unitdir}/openvswitch.service
 %{_unitdir}/ovsdb-server.service
 %{_unitdir}/ovs-vswitchd.service
+%{_unitdir}/ovs-delete-transient-ports.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_ovs-delete-transient-ports.service b/rhel/usr_lib_systemd_system_ovs-delete-transient-ports.service
new file mode 100644
index 000000000..4cd4d7f57
--- /dev/null
+++ b/rhel/usr_lib_systemd_system_ovs-delete-transient-ports.service
@@ -0,0 +1,10 @@ 
+[Unit]
+Description=Open vSwitch Delete Transient Ports
+After=ovsdb-server.service
+Before=ovs-vswitchd.service
+AssertPathExists=/var/run/openvswitch/db.sock
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/share/openvswitch/scripts/ovs-ctl delete-transient-ports
diff --git a/rhel/usr_lib_systemd_system_ovsdb-server.service b/rhel/usr_lib_systemd_system_ovsdb-server.service
index 7acd25f78..5baac822d 100644
--- a/rhel/usr_lib_systemd_system_ovsdb-server.service
+++ b/rhel/usr_lib_systemd_system_ovsdb-server.service
@@ -2,6 +2,7 @@ 
 Description=Open vSwitch Database Unit
 After=syslog.target network-pre.target
 Before=network.target network.service
+Wants=ovs-delete-transient-ports.service
 ReloadPropagatedFrom=openvswitch.service
 PartOf=openvswitch.service