Skip to content

Commit

Permalink
Merge pull request #3051 from gaborigloi/CA-242706_backport_honolulu
Browse files Browse the repository at this point in the history
CA-242706 backport for Honolulu
  • Loading branch information
mseri authored May 24, 2017
2 parents 6c272fd + 0a2d836 commit e94bc19
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
9 changes: 9 additions & 0 deletions ocaml/xapi/helpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ let update_pif_address ~__context ~self =
with _ ->
debug "Bridge %s is not up; not updating IP" bridge

let update_getty () =
(* Running update-issue service on best effort basis *)
try
ignore (Forkhelpers.execute_command_get_output !Xapi_globs.update_issue_script []);
ignore (Forkhelpers.execute_command_get_output !Xapi_globs.kill_process_script ["-q"; "-HUP"; "mingetty"; "agetty"])
with e ->
debug "update_getty at %s caught exception: %s"
__LOC__ (Printexc.to_string e)

let set_gateway ~__context ~pif ~bridge =
let dbg = Context.string_of_task __context in
try
Expand Down
3 changes: 2 additions & 1 deletion ocaml/xapi/xapi.ml
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ let bring_up_management_if ~__context () =
warn "Failed to acquire a management IP address"
end;
(* Start the Host Internal Management Network, if needed. *)
Xapi_network.check_himn ~__context
Xapi_network.check_himn ~__context;
Helpers.update_getty ()
with e ->
debug "Caught exception bringing up management interface: %s" (ExnHelper.string_of_exn e)

Expand Down
15 changes: 4 additions & 11 deletions ocaml/xapi/xapi_mgmt_iface.ml
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,6 @@ let wait_for_management_ip ~__context =
done; end);
!ip

let update_getty () =
(* Running update-issue service on best effort basis *)
try
ignore (Forkhelpers.execute_command_get_output !Xapi_globs.update_issue_script []);
ignore (Forkhelpers.execute_command_get_output !Xapi_globs.kill_process_script ["-q"; "-HUP"; "mingetty"; "agetty"])
with e ->
debug "update_getty at %s caught exception: %s"
__LOC__ (Printexc.to_string e)

let on_dom0_networking_change ~__context =
debug "Checking to see if hostname or management IP has changed";
(* Need to update:
Expand All @@ -192,17 +183,19 @@ let on_dom0_networking_change ~__context =
Db.Host.set_name_label ~__context ~self:localhost ~value:new_hostname;
begin match Helpers.get_management_ip_addr ~__context with
| Some ip ->
(* WARNING: this does NOT detect IP address changes that happen before
xapi's startup (see CA-242706) *)
if Db.Host.get_address ~__context ~self:localhost <> ip then begin
debug "Changing Host.address in database to: %s" ip;
Db.Host.set_address ~__context ~self:localhost ~value:ip;
debug "Refreshing console URIs";
update_getty ();
Helpers.update_getty ();
Dbsync_master.refresh_console_urls ~__context
end
| None ->
if Db.Host.get_address ~__context ~self:localhost <> "" then begin
debug "Changing Host.address in database to: '' (host has no management IP address)";
update_getty ();
Helpers.update_getty ();
Db.Host.set_address ~__context ~self:localhost ~value:""
end
end;
Expand Down

0 comments on commit e94bc19

Please sign in to comment.