[meta-virtualization] [PATCH 3/3] openvswitch: enable systemd support

Mark Asselstine mark.asselstine at windriver.com
Fri Dec 11 09:28:25 PST 2015


Make the necessary updates to get openvswitch to be compatible with
systemd. Up to now if you built a systemd supported image openvswitch
was using the systemd sysvinit wrappers, by making these changes we
now support systemd natively.

Note that there is no equivalent systemd support for
openvswitch-testcontroller. Following the lead of upstream this
is not something that should be run by the init system.

Signed-off-by: Mark Asselstine <mark.asselstine at windriver.com>
---
 recipes-networking/openvswitch/openvswitch.inc | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/recipes-networking/openvswitch/openvswitch.inc b/recipes-networking/openvswitch/openvswitch.inc
index 13c7d06..fc515e9 100644
--- a/recipes-networking/openvswitch/openvswitch.inc
+++ b/recipes-networking/openvswitch/openvswitch.inc
@@ -61,13 +61,21 @@ FILES_${PN}-brcompat = "${sbindir}/ovs-brcompatd"
 FILES_${PN}-switch = "\
 	${sysconfdir}/init.d/openvswitch-switch \
 	${sysconfdir}/default/openvswitch-switch \
+	${systemd_unitdir}/system/openvswitch.service \
+	${systemd_unitdir}/system/openvswitch-nonetwork.service \
 	"
 
 # silence a warning
 FILES_${PN} += "${datadir}/ovsdbmonitor"
 FILES_${PN} += "/run"
 
-inherit autotools update-rc.d
+inherit autotools update-rc.d systemd
+
+SYSTEMD_PACKAGES = "${PN}-switch"
+SYSTEMD_SERVICE_${PN}-switch = " \
+    openvswitch-nonetwork.service \
+    openvswitch-switch.service \
+"
 
 INITSCRIPT_PACKAGES = "${PN}-switch ${PN}-testcontroller"
 INITSCRIPT_NAME_${PN}-switch = "openvswitch-switch"
@@ -87,7 +95,11 @@ do_install_append() {
 	install -m 755 ${WORKDIR}/openvswitch-switch ${D}/${sysconfdir}/init.d/openvswitch-switch
 	true || rm -fr ${D}/${datadir}/${PN}/pki
 
-	install -d ${D}/${sysconfdir}/init.d/
+	install -d ${D}/${systemd_unitdir}/system/
+	install -m 644 ${S}/rhel/usr_lib_systemd_system_openvswitch.service \
+		${D}/${systemd_unitdir}/system/openvswitch-switch.service
+	install -m 644 ${S}/rhel/usr_lib_systemd_system_openvswitch-nonetwork.service \
+		${D}/${systemd_unitdir}/system/openvswitch-nonetwork.service
 
 	oe_runmake modules_install INSTALL_MOD_PATH=${D}
 }
-- 
2.1.4



More information about the meta-virtualization mailing list