Skip to content

Commit

Permalink
xapi/export: set a date when generating tarballs
Browse files Browse the repository at this point in the history
Tooling complains about using 1970 as the date otherwise
  • Loading branch information
psafont committed Apr 3, 2024
1 parent 38193c6 commit 2228822
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ocaml/xapi/export.ml
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ let export_metadata ~__context ~with_snapshot_metadata ~preserve_power_state
(string_of_bool preserve_power_state)
(String.concat ", " (List.map Devicetype.to_string excluded_devices))
in
let now = Date.now () |> Date.to_unix_time |> Int64.of_float in
( match vms with
| [] ->
failwith "need to specify at least one VM"
Expand All @@ -629,14 +630,15 @@ let export_metadata ~__context ~with_snapshot_metadata ~preserve_power_state
~include_vhd_parents ~__context ~vms ~excluded_devices
in
let hdr =
Tar.Header.make Xapi_globs.ova_xml_filename
Tar.Header.make ~mod_time:now Xapi_globs.ova_xml_filename
(Int64.of_int @@ String.length ova_xml)
in
Tar_helpers.write_block hdr (fun s -> Unixext.really_write_string s ova_xml) s ;
Tar_helpers.write_end s

let export refresh_session __context rpc session_id s vm_ref
preserve_power_state =
let now = Date.now () |> Date.to_unix_time |> Int64.of_float in
info "VM.export: VM = %s; preserve_power_state = '%s'"
(string_of_vm ~__context vm_ref)
(string_of_bool preserve_power_state) ;
Expand All @@ -646,7 +648,7 @@ let export refresh_session __context rpc session_id s vm_ref
in
debug "Outputting ova.xml" ;
let hdr =
Tar.Header.make Xapi_globs.ova_xml_filename
Tar.Header.make ~mod_time:now Xapi_globs.ova_xml_filename
(Int64.of_int @@ String.length ova_xml)
in
Tar_helpers.write_block hdr (fun s -> Unixext.really_write_string s ova_xml) s ;
Expand Down

0 comments on commit 2228822

Please sign in to comment.