Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XSI-1773 clean up swtpm service files #6193

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions ocaml/xenopsd/xc/service.ml
Original file line number Diff line number Diff line change
Expand Up @@ -608,26 +608,17 @@ module SystemdDaemonMgmt (D : DAEMONPIDPATH) = struct
else
None

let is_running ~xs domid =
match of_domid domid with
| None ->
Compat.is_running ~xs domid
| Some key ->
Fe_systemctl.is_active ~service:key

let stop ~xs domid =
match (of_domid domid, is_running ~xs domid) with
| None, true ->
match of_domid domid with
| None when Compat.is_running ~xs domid ->
Compat.stop ~xs domid
| Some service, true ->
(* xenstore cleanup is done by systemd unit file *)
let (_ : Fe_systemctl.status) = Fe_systemctl.stop ~service in
()
| Some service, false ->
info "Not trying to stop %s since it's not running" service
| None, false ->
| None ->
info "Not trying to stop %s for domid %i since it's not running" D.name
domid
| Some service ->
(* call even when not running for clean up *)
let (_ : Fe_systemctl.status) = Fe_systemctl.stop ~service in
()

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