diff --git a/virttest/virt_vm.py b/virttest/virt_vm.py index 5f18ed9a85..20a3988f55 100644 --- a/virttest/virt_vm.py +++ b/virttest/virt_vm.py @@ -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.cmd_status("journalctl | cat") + session.close() + except Exception: + pass + raise remote.LoginTimeoutError("exceeded %s s timeout, last " "failure: %s" % (timeout, error))