|
Bogdan Timofte
authored
3 months ago
|
1
|
[Unit]
|
|
|
2
|
Description=Suspend PVE VMs to disk manually
|
|
|
3
|
Documentation=man:qm(1)
|
|
|
4
|
|
|
|
5
|
# Only run if pve-cluster is available (not rescue/recovery)
|
|
|
6
|
ConditionPathExists=/var/lib/pve-cluster/config.db
|
|
|
7
|
|
|
|
8
|
# We need storage and cluster access when stopping (suspend needs these alive)
|
|
|
9
|
Requires=pve-cluster.service
|
|
|
10
|
After=pve-cluster.service network.target local-fs.target remote-fs.target
|
|
|
11
|
|
|
|
12
|
# Start AFTER pve-guests → during shutdown we stop BEFORE pve-guests
|
|
|
13
|
# Critical: ensures we suspend VMs before pve-guests runs "stopall"
|
|
|
14
|
After=pve-guests.service
|
|
|
15
|
|
|
|
16
|
[Service]
|
|
|
17
|
Type=oneshot
|
|
|
18
|
RemainAfterExit=yes
|
|
|
19
|
|
|
|
20
|
# Trivial start - just marks the service as "active" while the node is up
|
|
|
21
|
# The actual work happens in ExecStop during shutdown
|
|
|
22
|
ExecStart=/bin/true
|
|
|
23
|
|
|
|
24
|
# REAL work: suspend VMs and shutdown CTs when system is going down
|
|
|
25
|
ExecStop=/usr/local/sbin/pgs suspend -v
|
|
|
26
|
|
|
|
27
|
# Allow generous time for all VMs to suspend to disk
|
|
|
28
|
TimeoutStopSec=900
|
|
|
29
|
|
|
|
30
|
[Install]
|
|
|
31
|
WantedBy=multi-user.target
|
|
|
32
|
|