syslog_config_write destination destination_only listen_remote
-
+let get_management_interface ~__context ~host =
+ let pifs = Db.PIF.get_all_records ~__context in
+ let management_pif, _ = List.find (fun (_, pif) -> pif.API.pIF_management && pif.API.pIF_host = host) pifs in
+ management_pif
+
let change_management_interface ~__context interface =
debug "Changing management interface";
let addrs = Netdev.Addr.get interface in
val request_config_file_sync : __context:'a -> host:'b -> hash:string -> unit
val syslog_config_write : string -> bool -> bool -> unit
val syslog_reconfigure : __context:Context.t -> host:'a -> unit
+
+(** {2 Management Interface} *)
+
+val get_management_interface : __context:Context.t -> host:API.ref_host -> API.ref_PIF
val change_management_interface : __context:Context.t -> string -> unit
val local_management_reconfigure :
__context:Context.t -> interface:string -> unit
val management_reconfigure :
__context:Context.t -> pif:[ `PIF ] Ref.t -> unit
val management_disable : __context:Context.t -> unit
+
+(** {2 (Fill in title!)} *)
+
val get_system_status_capabilities :
__context:'a -> host:API.ref_host -> string
val get_diagnostic_timing_stats :
(* FIXME: in the future, we should send the windows AD admin/pass here *)
(* in order to remove the slave from the AD database during pool-eject *)
+ debug "Pool.eject: rewrite networking first-boot files";
+ let management_pif = Xapi_host.get_management_interface ~__context ~host in
+ let pif = Db.PIF.get_record ~__context ~self:management_pif in
+ let management_mac =
+ (* assumes that the management interface is either physical or a bond *)
+ if pif.API.pIF_bond_master_of <> [] then
+ let bond = List.hd pif.API.pIF_bond_master_of in
+ let slaves = Db.Bond.get_slaves ~__context ~self:bond in
+ let first_slave = List.hd slaves in
+ Db.PIF.get_MAC ~__context ~self:first_slave
+ else
+ pif.API.pIF_MAC
+ in
+ let mode = match pif.API.pIF_ip_configuration_mode with
+ | `None -> "none"
+ | `DHCP -> "dhcp"
+ | `Static -> "static"
+ in
+ let t = Xapi_pif.make_tables ~__context ~host in
+ let interfaces = List.fold_left
+ (fun ifs (mac, device) ->
+ let s =
+ if mac <> management_mac then
+ "LABEL='" ^ device ^ "'\nMODE=none\n"
+ else begin
+ let bridge = Xapi_pif.bridge_naming_convention device in
+ Xapi_inventory.update Xapi_inventory._management_interface bridge;
+ "LABEL='" ^ device ^ "'\nMODE=" ^ mode ^
+ if mode = "static" then
+ "\nIP=" ^ pif.API.pIF_IP ^
+ "\nNETMASK=" ^ pif.API.pIF_netmask ^
+ "\nGATEWAY=" ^ pif.API.pIF_gateway ^
+ "\nDNS=" ^ pif.API.pIF_DNS ^ "\n"
+ else
+ "\n"
+ end
+ in
+ Unixext.write_string_to_file (Xapi_globs.first_boot_dir ^ "data/interface-" ^ mac ^ ".conf") s;
+ mac :: ifs
+ ) [] t.Xapi_pif.mac_to_biosname_table
+ in
+ let s = "ADMIN_INTERFACE='" ^ management_mac ^ "'\nINTERFACES='" ^ (String.concat " " interfaces) ^ "'\n" in
+ Unixext.write_string_to_file (Xapi_globs.first_boot_dir ^ "data/network.conf") s;
+ Xapi_inventory.update Xapi_inventory._current_interfaces "";
+
debug "Pool.eject: deleting Host record (the point of no return)";
(* delete me from the database - this will in turn cause PBDs and PIFs to be GCed *)
Db.Host.destroy ~__context ~self:host;