Skip to content

Commit

Permalink
Merge pull request #277 from fillzero/CP-17694
Browse files Browse the repository at this point in the history
CP-17694: Log stdout/stderr from device model
  • Loading branch information
johnelse authored Jul 12, 2016
2 parents 0f73949 + c1b1657 commit 5d90085
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions scripts/qemu-dm-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def enable_core_dumps():

def main(argv):
import os
import sys

qemu_env = os.environ
qemu_dm_list =[]
Expand Down Expand Up @@ -77,6 +78,7 @@ def main(argv):
xenstore_write("/local/domain/%d/qemu-pid" % domid, "%d" % os.getpid())

os.dup2(1, 2)
sys.stdout.flush()
os.execve(qemu_dm, qemu_args, qemu_env)

if __name__ == '__main__':
Expand Down
7 changes: 5 additions & 2 deletions xc/device.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1650,7 +1650,10 @@ let prepend_wrapper_args domid args =
* exception is raised *)
let init_daemon ~task ~path ~args ~name ~domid ~xs ~ready_path ?ready_val ~timeout ~cancel _ =
debug "Starting daemon: %s with args [%s]" path (String.concat "; " args);
let pid = Forkhelpers.safe_close_and_exec None None None [] path args in
let syslog_key = (Printf.sprintf "%s-%d" name domid) in
let syslog_stdout = Forkhelpers.Syslog_WithKey syslog_key in
let redirect_stderr_to_stdout = true in
let pid = Forkhelpers.safe_close_and_exec None None None [] ~syslog_stdout ~redirect_stderr_to_stdout path args in
debug
"%s: should be running in the background (stdout -> syslog); (fd,pid) = %s"
name (Forkhelpers.string_of_pidty pid);
Expand Down Expand Up @@ -1684,7 +1687,7 @@ let init_daemon ~task ~path ~args ~name ~domid ~xs ~ready_path ?ready_val ~timeo
if not !finished then
raise (Ioemu_failed (name, "Timeout reached while starting daemon"))
end;
debug "Daemon initialised: %s" (Printf.sprintf "%s-%d" name domid);
debug "Daemon initialised: %s" syslog_key;
pid

let __start (task: Xenops_task.t) ~xs ~dmpath ?(timeout = !Xenopsd.qemu_dm_ready_timeout) l info domid =
Expand Down

0 comments on commit 5d90085

Please sign in to comment.