Skip to content

Commit 9eeb1f3

Browse files
authored
XSI-1773 clean up swtpm service files (#6193)
We have seen swtpm systemd service files not being removed. We now make Fe_systemctl.stop callable when the servive is potentially not running to ensure clean up is happening regardless.
2 parents 90b0faf + 3d394e0 commit 9eeb1f3

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

ocaml/xenopsd/xc/service.ml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -608,26 +608,17 @@ module SystemdDaemonMgmt (D : DAEMONPIDPATH) = struct
608608
else
609609
None
610610

611-
let is_running ~xs domid =
612-
match of_domid domid with
613-
| None ->
614-
Compat.is_running ~xs domid
615-
| Some key ->
616-
Fe_systemctl.is_active ~service:key
617-
618611
let stop ~xs domid =
619-
match (of_domid domid, is_running ~xs domid) with
620-
| None, true ->
612+
match of_domid domid with
613+
| None when Compat.is_running ~xs domid ->
621614
Compat.stop ~xs domid
622-
| Some service, true ->
623-
(* xenstore cleanup is done by systemd unit file *)
624-
let (_ : Fe_systemctl.status) = Fe_systemctl.stop ~service in
625-
()
626-
| Some service, false ->
627-
info "Not trying to stop %s since it's not running" service
628-
| None, false ->
615+
| None ->
629616
info "Not trying to stop %s for domid %i since it's not running" D.name
630617
domid
618+
| Some service ->
619+
(* call even when not running for clean up *)
620+
let (_ : Fe_systemctl.status) = Fe_systemctl.stop ~service in
621+
()
631622

632623
let start_daemon ~path ~args ~domid () =
633624
debug "Starting daemon: %s with args [%s]" path (String.concat "; " args) ;

0 commit comments

Comments
 (0)