Skip to content

Commit

Permalink
runqemu: display host uptime when starting
Browse files Browse the repository at this point in the history
In order to be able to debug issues on the host that have an impact on the
guest, it is useful to get the uptime of the host while starting so we can
match with the events in dmesg. Also include the uptime when cleaning up.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
  • Loading branch information
alexandrebelloni authored and rpurdie committed Sep 12, 2022
1 parent 19e87e0 commit 2d96499
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/runqemu
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,9 @@ class BaseConfig(object):
cmd = "%s %s" % (self.qemu_opt, kernel_opts)
cmds = shlex.split(cmd)
logger.info('Running %s\n' % cmd)
with open('/proc/uptime', 'r') as f:
uptime_seconds = f.readline().split()[0]
logger.info('Host uptime: %s\n' % uptime_seconds)
pass_fds = []
if self.taplock_descriptor:
pass_fds = [self.taplock_descriptor.fileno()]
Expand All @@ -1528,6 +1531,9 @@ class BaseConfig(object):
signal.signal(signal.SIGTERM, signal.SIG_IGN)

logger.info("Cleaning up")
with open('/proc/uptime', 'r') as f:
uptime_seconds = f.readline().split()[0]
logger.info('Host uptime: %s\n' % uptime_seconds)
if self.cleantap:
cmd = ('sudo', self.qemuifdown, self.tap, self.bindir_native)
logger.debug('Running %s' % str(cmd))
Expand Down

0 comments on commit 2d96499

Please sign in to comment.