diff --git a/virttest/virt_vm.py b/virttest/virt_vm.py index 679521a57a..8515483bd0 100644 --- a/virttest/virt_vm.py +++ b/virttest/virt_vm.py @@ -11,6 +11,7 @@ import six from aexpect import remote +from aexpect.utils import astring from aexpect.exceptions import ExpectError, ShellError from avocado.core import exceptions from six.moves import xrange @@ -1564,7 +1565,9 @@ def get_cpu_count(self, check_cmd="cpu_chk_cmd", connect_uri=None): """ cmd = self.params.get(check_cmd) out = self.session.cmd_output_safe(cmd) - return int(re.search("\d+", out, re.M).group()) + # Removing the escape sequence from the output + out_no_escape = astring.strip_console_codes(out) + return int(re.search("\d+", out_no_escape, re.M).group()) def get_memory_size(self, cmd=None, timeout=60): """