Skip to content

Commit fac9043

Browse files
committed
Fix /run/chrony-dhcp does not exist
The `/run/chrony-dhcp` dir can be created when chrony.sh is executable (i.e. DHCP mode) when host boot up. If host boots up with other NTP mode, the dir may not be created. Check the dir and create it if not exist. Signed-off-by: Changlei Li <changlei.li@cloud.com>
1 parent cb78af3 commit fac9043

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ocaml/xapi/xapi_host_ntp.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ let get_dhcp_ntp_server interface =
5151
)
5252

5353
let add_dhcp_ntp_servers () =
54+
let ntp_dhcp_dir = !Xapi_globs.ntp_dhcp_dir in
55+
if not (Sys.file_exists ntp_dhcp_dir && Sys.is_directory ntp_dhcp_dir) then
56+
Xapi_stdext_unix.Unixext.mkdir_rec ntp_dhcp_dir 0o755 ;
5457
get_dhclient_interfaces ()
5558
|> List.iter (fun interface ->
5659
match get_dhcp_ntp_server interface with

0 commit comments

Comments
 (0)