Skip to content

Commit

Permalink
Merge pull request #1931 from balamuruhans/verify_dmesg_fix
Browse files Browse the repository at this point in the history
virt_vm: make sure libvirt connect uri doesn't break the test
  • Loading branch information
Satheesh Rajendran authored Jan 28, 2019
2 parents e478dfd + 054257c commit b03a35e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion virttest/libvirt_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2480,7 +2480,7 @@ def pause(self):
state = self.state()
if state != 'paused':
virsh.suspend(
self.name, uri=self.connect_uri, ignore_statues=False)
self.name, uri=self.connect_uri, ignore_status=False)
return True
except Exception:
logging.error("VM %s failed to suspend", self.name)
Expand Down
6 changes: 6 additions & 0 deletions virttest/utils_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3477,6 +3477,10 @@ def verify_dmesg(dmesg_log_file=None, ignore_result=False, level_check=3,
4 - emerg,alert,crit,err
5 - emerg,alert,crit,err,warn
:param session: session object to guest
:param return: if ignore_result=True, return True if no errors/crash
observed, False otherwise.
:param raise: if ignore_result=False, raise TestFail exception on
observing errors/crash
"""
cmd = "dmesg -T -l %s|grep ." % ",".join(map(str, xrange(0, int(level_check))))
if session:
Expand Down Expand Up @@ -3504,6 +3508,8 @@ def verify_dmesg(dmesg_log_file=None, ignore_result=False, level_check=3,
process.system("dmesg -C", ignore_status=True)
if not ignore_result:
raise exceptions.TestFail(err)
return False
return True


def add_ker_cmd(kernel_cmdline, kernel_param, remove_similar=False):
Expand Down
29 changes: 18 additions & 11 deletions virttest/virt_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,19 +946,26 @@ def verify_dmesg(self, dmesg_log_file=None, connect_uri=None):
guest dmesg to logging.debug.
:param connect_uri: Libvirt connect uri of vm
"""
if(len(self.virtnet) > 0 and self.virtnet[0].nettype != "macvtap" and
not connect_uri):
session = self.wait_for_login()
else:
if connect_uri and self.params.get("vm_type", "qemu") == "libvirt":
self.connect_uri = connect_uri
session = self.wait_for_serial_login()
session = None
level = self.params.get("guest_dmesg_level", 3)
ignore_result = self.params.get("guest_dmesg_ignore", "no") == "yes"
utils_misc.verify_dmesg(dmesg_log_file=dmesg_log_file,
ignore_result=ignore_result,
level_check=level, session=session)
session.close()
try:
if(len(self.virtnet) > 0 and self.virtnet[0].nettype != "macvtap" and
not connect_uri):
session = self.wait_for_login()
else:
if connect_uri and self.params.get("vm_type", "qemu") == "libvirt":
actual_uri = self.connect_uri
self.connect_uri = connect_uri
session = self.wait_for_serial_login()
return utils_misc.verify_dmesg(dmesg_log_file=dmesg_log_file,
ignore_result=ignore_result,
level_check=level, session=session)
finally:
if connect_uri:
self.connect_uri = actual_uri
if session:
session.close()

def verify_bsod(self, scrdump_file):
# For windows guest
Expand Down

0 comments on commit b03a35e

Please sign in to comment.