Skip to content

Commit a3ed80a

Browse files
committed
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]> (cherry picked from commit a2891f4) Signed-off-by: Gabor Igloi <[email protected]>
1 parent 6c272fd commit a3ed80a

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
@@ -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: 2 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:
@@ -196,13 +187,13 @@ let on_dom0_networking_change ~__context =
196187
debug "Changing Host.address in database to: %s" ip;
197188
Db.Host.set_address ~__context ~self:localhost ~value:ip;
198189
debug "Refreshing console URIs";
199-
update_getty ();
190+
Helpers.update_getty ();
200191
Dbsync_master.refresh_console_urls ~__context
201192
end
202193
| None ->
203194
if Db.Host.get_address ~__context ~self:localhost <> "" then begin
204195
debug "Changing Host.address in database to: '' (host has no management IP address)";
205-
update_getty ();
196+
Helpers.update_getty ();
206197
Db.Host.set_address ~__context ~self:localhost ~value:""
207198
end
208199
end;

0 commit comments

Comments
 (0)