Skip to content

Commit a2891f4

Browse files
gaborigloirobhoes
authored andcommitted
CA-242706: call update_getty at xapi startup
During xapi startup, the on_dom0_networking_change function does not recognize the IP address change, as it gets set in the database at an earlier startup phase. This commit adds an unconditional call to the update_getty function during startup. Signed-off-by: Gabor Igloi <[email protected]>
1 parent 6af6adf commit a2891f4

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

ocaml/xapi/helpers.ml

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

188+
let update_getty () =
189+
(* Running update-issue service on best effort basis *)
190+
try
191+
ignore (Forkhelpers.execute_command_get_output !Xapi_globs.update_issue_script []);
192+
ignore (Forkhelpers.execute_command_get_output !Xapi_globs.kill_process_script ["-q"; "-HUP"; "mingetty"; "agetty"])
193+
with e ->
194+
debug "update_getty at %s caught exception: %s"
195+
__LOC__ (Printexc.to_string e)
196+
188197
let set_gateway ~__context ~pif ~bridge =
189198
let dbg = Context.string_of_task __context in
190199
try

ocaml/xapi/xapi.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@ let bring_up_management_if ~__context () =
300300
warn "Failed to acquire a management IP address"
301301
end;
302302
(* Start the Host Internal Management Network, if needed. *)
303-
Xapi_network.check_himn ~__context
303+
Xapi_network.check_himn ~__context;
304+
Helpers.update_getty ()
304305
with e ->
305306
debug "Caught exception bringing up management interface: %s" (ExnHelper.string_of_exn e)
306307

ocaml/xapi/xapi_mgmt_iface.ml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,6 @@ let wait_for_management_ip ~__context =
167167
done; end);
168168
!ip
169169

170-
let update_getty () =
171-
(* Running update-issue service on best effort basis *)
172-
try
173-
ignore (Forkhelpers.execute_command_get_output !Xapi_globs.update_issue_script []);
174-
ignore (Forkhelpers.execute_command_get_output !Xapi_globs.kill_process_script ["-q"; "-HUP"; "mingetty"; "agetty"])
175-
with e ->
176-
debug "update_getty at %s caught exception: %s"
177-
__LOC__ (Printexc.to_string e)
178-
179170
let on_dom0_networking_change ~__context =
180171
debug "Checking to see if hostname or management IP has changed";
181172
(* Need to update:
@@ -198,13 +189,13 @@ let on_dom0_networking_change ~__context =
198189
debug "Changing Host.address in database to: %s" ip;
199190
Db.Host.set_address ~__context ~self:localhost ~value:ip;
200191
debug "Refreshing console URIs";
201-
update_getty ();
192+
Helpers.update_getty ();
202193
Dbsync_master.refresh_console_urls ~__context
203194
end
204195
| None ->
205196
if Db.Host.get_address ~__context ~self:localhost <> "" then begin
206197
debug "Changing Host.address in database to: '' (host has no management IP address)";
207-
update_getty ();
198+
Helpers.update_getty ();
208199
Db.Host.set_address ~__context ~self:localhost ~value:""
209200
end
210201
end;

0 commit comments

Comments
 (0)