[pve-devel] [PATCH v2 container 2/3] add new pve-container@ unit

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Oct 9 15:04:48 CEST 2017


to replace lxc at .service.

we want our unit to only start when manually invoked (by our code), and
stop on shutdown via pve-guests or pve-ha-lrm. lxc@ units are stopped by
systemd on shutdown, because of transitive dependencies.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 src/Makefile               |  1 +
 src/pve-container at .service | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)
 create mode 100644 src/pve-container at .service

diff --git a/src/Makefile b/src/Makefile
index 9c5fbc3..9d25171 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -42,6 +42,7 @@ install: pct lxc-pve.conf lxc-pve-prestart-hook lxc-pve-autodev-hook lxc-pve-pos
 	install -m 0755 lxc-pve-reboot-trigger ${LXC_SCRIPT_DIR}
 	install -d -m0755 ${SERVICEDIR}/lxc at .service.d
 	install -m0644 pve-reboot.conf ${SERVICEDIR}/lxc at .service.d/
+	install -m0644 pve-container at .service ${SERVICEDIR}/
 	install -d ${LXC_HOOK_DIR}
 	install -m 0755 lxc-pve-prestart-hook ${LXC_HOOK_DIR}
 	install -m 0755 lxc-pve-autodev-hook ${LXC_HOOK_DIR}
diff --git a/src/pve-container at .service b/src/pve-container at .service
new file mode 100644
index 0000000..e610fb7
--- /dev/null
+++ b/src/pve-container at .service
@@ -0,0 +1,16 @@
+[Unit]
+Description=PVE LXC Container: %i
+DefaultDependencies=No
+Documentation=man:lxc-start man:lxc man:pct
+
+[Service]
+Type=forking
+KillMode=mixed
+TimeoutStopSec=120s
+ExecStart=/usr/bin/lxc-start -n %i
+ExecStop=/usr/bin/lxc-stop -n %i
+ExecStopPost=/usr/share/lxc/lxc-pve-reboot-trigger %i
+# Environment=BOOTUP=serial
+# Environment=CONSOLETYPE=serial
+StandardOutput=syslog
+StandardError=syslog
-- 
2.14.1





More information about the pve-devel mailing list