Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: virttest.virt_vm: Attempt to log useful data on login failure #1969

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, can be handled as part of post-process instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, handling it in post might be to late as the test might shut the machine down before the test finishes (this works even for intermittent VMs)

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.cmd_status("journalctl | cat")
session.close()
except Exception:
pass

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

Expand Down