Skip to content

Commit

Permalink
tools/ocaml/xenstored: fix live update exception
Browse files Browse the repository at this point in the history
During live update we will load the /tool/xenstored path from the previous binary,
and then try to mkdir /tool again which will fail with EEXIST.
Check for existence of the path before creating it.

The write call to /tool/xenstored should not need any changes
(and we do want to overwrite any previous path, in case it changed).

Prior to 7110192 live update would work only if the binary path was
specified, and with 7110192 and this live update also works when
no binary path is specified in `xenstore-control live-update`.

Fixes: 7110192 ("tools/oxenstored: Fix Oxenstored Live Update")
Signed-off-by: Edwin Török <edvin.torok@citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
Release-acked-by: Henry Wang <Henry.Wang@arm.com>
  • Loading branch information
edwintorok committed Oct 21, 2022
1 parent 0c06760 commit 4a89f1f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/ocaml/xenstored/xenstored.ml
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,9 @@ let _ =
) in

(* required for xenstore-control to detect availability of live-update *)
Store.mkdir store Perms.Connection.full_rights (Store.Path.of_string "/tool");
let tool_path = Store.Path.of_string "/tool" in
if not (Store.path_exists store tool_path) then
Store.mkdir store Perms.Connection.full_rights tool_path;
Store.write store Perms.Connection.full_rights
(Store.Path.of_string "/tool/xenstored") Sys.executable_name;

Expand Down

0 comments on commit 4a89f1f

Please sign in to comment.