@@ -482,50 +482,6 @@ let resynchronise_ha_state () =
482482 (* Critical that we don't continue as a master and use shared resources *)
483483 error " Caught exception resynchronising state of HA system: %s" (ExnHelper. string_of_exn e)
484484
485- (* Calculates the amount of free memory on the host at boot time. *)
486- (* Returns a result that is equivalent to (T - X), where: *)
487- (* T = total memory in host. *)
488- (* X = host virtualization overhead: *)
489- (* memory used by Xen code, heap and crash kernel. *)
490- (* Actually returns the current value of (F + S + Z), where: *)
491- (* F = host free memory. *)
492- (* S = host scrub memory. *)
493- (* Z = host memory used by domain 0. *)
494- (* This relies on the equivalence (T = X + F + S + Z). *)
495- (* Warning! This function assumes that: *)
496- (* 1. Domain 0 is currently in an unballooned state. *)
497- (* 2. No other domains have been started. *)
498- let calculate_boot_time_host_free_memory () =
499- let ( + ) = Nativeint. add in
500- let open Xenctrl in
501- let host_info = with_intf (fun xc -> physinfo xc) in
502- let host_free_pages = host_info.free_pages in
503- let host_scrub_pages = host_info.scrub_pages in
504- match Create_misc. read_dom0_memory_usage () with
505- | None -> failwith " can't query balloon driver"
506- | Some domain0_bytes ->
507- let domain0_total_pages = XenopsMemory. pages_of_bytes_used domain0_bytes in
508- let boot_time_host_free_pages =
509- host_free_pages + host_scrub_pages + (Int64. to_nativeint domain0_total_pages) in
510- let boot_time_host_free_kib =
511- pages_to_kib (Int64. of_nativeint boot_time_host_free_pages) in
512- Int64. mul 1024L boot_time_host_free_kib
513-
514- (* Read the free memory on the host and record this in the db. This is used *)
515- (* as the baseline for memory calculations in the message forwarding layer. *)
516- let record_boot_time_host_free_memory () =
517- if not (Unixext. file_exists Xapi_globs. initial_host_free_memory_file) then begin
518- try
519- let free_memory = calculate_boot_time_host_free_memory () in
520- Unixext. mkdir_rec (Filename. dirname Xapi_globs. initial_host_free_memory_file) 0o700 ;
521- Unixext. write_string_to_file
522- Xapi_globs. initial_host_free_memory_file
523- (Int64. to_string free_memory)
524- with e ->
525- error " Could not record host free memory. This may prevent VMs from being started on this host. (%s)"
526- (Printexc. to_string e)
527- end
528-
529485(* * Reset the networking-related metadata for this host if the command [xe-reset-networking]
530486 * was executed before the restart. *)
531487let check_network_reset () =
0 commit comments