Since there is some race condition between initialization of
drm-lease-manager and startup of lxc guest images in
lxc-host-image-demo currently, we sometimes observe a startup
failure of the cluster-guest, especially on refhw platform,
due to delay of lease device creation.
This change adds unit dependencies between lxc and
drm-lease-manager so that lxc guests can be started after lease
devices creation stably.
Bug-AGL: SPEC-4427
Signed-off-by: Hiroyuki Ishii <ishii.hiroyuki002@jp.panasonic.com>
Change-Id: I16183c784d8e1132ba316f842e5dedc664ec2853
--- /dev/null
+[Unit]
+Description=LXC Container Initialization and Autoboot Code
+After=network.target lxc-net.service remote-fs.target drm-lease-manager.service
+Wants=lxc-net.service
+Documentation=man:lxc-autostart man:lxc
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStartPre=@LIBEXECDIR@/lxc/lxc-apparmor-load
+ExecStart=@LIBEXECDIR@/lxc/lxc-containers start
+ExecStop=@LIBEXECDIR@/lxc/lxc-containers stop
+ExecReload=@LIBEXECDIR@/lxc/lxc-apparmor-load
+# Environment=BOOTUP=serial
+# Environment=CONSOLETYPE=serial
+Delegate=yes
+
+[Install]
+WantedBy=multi-user.target
SYSTEMD_AUTO_ENABLE:${PN} = "enable"
+FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
+
+SRC_URI += "file://lxc.service"
+
+do_install:append () {
+ install -D -m 0644 ${WORKDIR}/lxc.service ${D}${systemd_system_unitdir}/lxc.service
+ sed -i -e 's,@LIBEXECDIR@,${libexecdir},g' ${D}${systemd_system_unitdir}/lxc.service
+}
+
# NOTE:
# This needs to be replaced with a rework of the upstream packaging
# to do a proper split of core from the template support.