1 contributor
[Unit]
Description=Suspend PVE VMs to disk manually
Documentation=man:qm(1)
# Only run if pve-cluster is available (not rescue/recovery)
ConditionPathExists=/var/lib/pve-cluster/config.db
# We need storage and cluster access when stopping (suspend needs these alive)
Requires=pve-cluster.service
After=pve-cluster.service network.target local-fs.target remote-fs.target
# Start AFTER pve-guests → during shutdown we stop BEFORE pve-guests
# Critical: ensures we suspend VMs before pve-guests runs "stopall"
After=pve-guests.service
[Service]
Type=oneshot
RemainAfterExit=yes
# Trivial start - just marks the service as "active" while the node is up
# The actual work happens in ExecStop during shutdown
ExecStart=/bin/true
# REAL work: suspend VMs and shutdown CTs when system is going down
ExecStop=/usr/local/sbin/pgs suspend -v
# Allow generous time for all VMs to suspend to disk
TimeoutStopSec=900
[Install]
WantedBy=multi-user.target