Skip to content

Commit e94bc19

Browse files
authored
Merge pull request #3051 from gaborigloi/CA-242706_backport_honolulu
CA-242706 backport for Honolulu
2 parents 6c272fd + 0a2d836 commit e94bc19

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

ocaml/xapi/helpers.ml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,15 @@ let update_pif_address ~__context ~self =
180180
with _ ->
181181
debug "Bridge %s is not up; not updating IP" bridge
182182

183+
let update_getty () =
184+
(* Running update-issue service on best effort basis *)
185+
try
186+
ignore (Forkhelpers.execute_command_get_output !Xapi_globs.update_issue_script []);
187+
ignore (Forkhelpers.execute_command_get_output !Xapi_globs.kill_process_script ["-q"; "-HUP"; "mingetty"; "agetty"])
188+
with e ->
189+
debug "update_getty at %s caught exception: %s"
190+
__LOC__ (Printexc.to_string e)
191+
183192
let set_gateway ~__context ~pif ~bridge =
184193
let dbg = Context.string_of_task __context in
185194
try

ocaml/xapi/xapi.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ let bring_up_management_if ~__context () =
294294
warn "Failed to acquire a management IP address"
295295
end;
296296
(* Start the Host Internal Management Network, if needed. *)
297-
Xapi_network.check_himn ~__context
297+
Xapi_network.check_himn ~__context;
298+
Helpers.update_getty ()
298299
with e ->
299300
debug "Caught exception bringing up management interface: %s" (ExnHelper.string_of_exn e)
300301

ocaml/xapi/xapi_mgmt_iface.ml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,6 @@ let wait_for_management_ip ~__context =
165165
done; end);
166166
!ip
167167

168-
let update_getty () =
169-
(* Running update-issue service on best effort basis *)
170-
try
171-
ignore (Forkhelpers.execute_command_get_output !Xapi_globs.update_issue_script []);
172-
ignore (Forkhelpers.execute_command_get_output !Xapi_globs.kill_process_script ["-q"; "-HUP"; "mingetty"; "agetty"])
173-
with e ->
174-
debug "update_getty at %s caught exception: %s"
175-
__LOC__ (Printexc.to_string e)
176-
177168
let on_dom0_networking_change ~__context =
178169
debug "Checking to see if hostname or management IP has changed";
179170
(* Need to update:
@@ -192,17 +183,19 @@ let on_dom0_networking_change ~__context =
192183
Db.Host.set_name_label ~__context ~self:localhost ~value:new_hostname;
193184
begin match Helpers.get_management_ip_addr ~__context with
194185
| Some ip ->
186+
(* WARNING: this does NOT detect IP address changes that happen before
187+
xapi's startup (see CA-242706) *)
195188
if Db.Host.get_address ~__context ~self:localhost <> ip then begin
196189
debug "Changing Host.address in database to: %s" ip;
197190
Db.Host.set_address ~__context ~self:localhost ~value:ip;
198191
debug "Refreshing console URIs";
199-
update_getty ();
192+
Helpers.update_getty ();
200193
Dbsync_master.refresh_console_urls ~__context
201194
end
202195
| None ->
203196
if Db.Host.get_address ~__context ~self:localhost <> "" then begin
204197
debug "Changing Host.address in database to: '' (host has no management IP address)";
205-
update_getty ();
198+
Helpers.update_getty ();
206199
Db.Host.set_address ~__context ~self:localhost ~value:""
207200
end
208201
end;

0 commit comments

Comments
 (0)