Skip to content

Commit

Permalink
virttest.virt_vm: Attempt to log useful data on login failure
Browse files Browse the repository at this point in the history
This is a hackish way of attempting to log useful data on login failure.

Signed-off-by: Lukáš Doktor <[email protected]>
  • Loading branch information
ldoktor committed Feb 21, 2019
1 parent ab00a4d commit f53f829
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions virttest/virt_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,19 @@ def print_guest_network_info():
return self.wait_for_serial_login(timeout, internal_timeout,
False, username, password)

# Attempt to log useful data
try:
session = self.wait_for_serial_login(timeout, internal_timeout,
False, username, password)
session.sendline("echo Login failed, dumping useful logs...")
session.sendline("echo /var/log/messages")
session.sendline("cat /var/log/messages")
session.sendline("echo journalctl")
session.sendline("journalctl | cat")
session.close()
except Exception:
pass

raise remote.LoginTimeoutError("exceeded %s s timeout, last "
"failure: %s" % (timeout, error))

Expand Down

0 comments on commit f53f829

Please sign in to comment.