Skip to contentSkip to conversation

tools/kvm_stat: Add restart delay

PATCH Applied Stefan Raspl 2 participants 2 messages Mar 25, 2021 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/kvm_stat: Add restart delay

If this service is enabled and the system rebooted, Systemd's initial attempt to start this unit file may fail in case the kvm module is not loaded. Since we did not specify a delay for the retries, Systemd restarts with a minimum delay a number of times before giving up and disabling the service. Which means a subsequent kvm module load will have kvm running without monitoring.
Adding a delay to fix this.

---
 tools/kvm/kvm_stat/kvm_stat.service | 1 +
 1 file changed, 1 insertion(+)
tools/kvm/kvm_stat/kvm_stat.service +1 -0
index 71aabaffe779..8f13b843d5b4 100644
@@ -9,6 +9,7 @@ Type=simple
 ExecStart=/usr/bin/kvm_stat -dtcz -s 10 -L /var/log/kvm_stat.csv
 ExecReload=/bin/kill -HUP $MAINPID
 Restart=always
+RestartSec=60s
 SyslogIdentifier=kvm_stat
 SyslogLevel=debug
 
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 19 lines · Stefan Raspl

If this service is enabled and the system rebooted, Systemd's initial attempt to start this unit file may fail in case the kvm module is not loaded. Since we did not specify a delay for the retries, Systemd restarts with a minimum delay a number of times before giving up and disabling the service. Which means a subsequent kvm module load will have kvm running without monitoring.
Adding a delay to fix this.

---
  tools/kvm/kvm_stat/kvm_stat.service | 1 +
  1 file changed, 1 insertion(+)
tools/kvm/kvm_stat/kvm_stat.service +0 -0
index 71aabaffe779..8f13b843d5b4 100644

tools/kvm/kvm_stat/kvm_stat.service Type=simple · line 15

Quoted 7 lines
tools/kvm/kvm_stat/kvm_stat.service +1 -0
@@ -9,6 +9,7 @@ Type=simple
  ExecStart=/usr/bin/kvm_stat -dtcz -s 10 -L /var/log/kvm_stat.csv
  ExecReload=/bin/kill -HUP $MAINPID
  Restart=always
+RestartSec=60s
  SyslogIdentifier=kvm_stat
  SyslogLevel=debug
 

Queued, thanks.

Paolo