Revision 7f83345f lib/hypervisor/hv_kvm.py

b/lib/hypervisor/hv_kvm.py
553 553
  _CPU_INFO_CMD = "info cpus"
554 554
  _CONT_CMD = "cont"
555 555

  
556
  _DEFAULT_MACHINE_VERSION_RE = re.compile(r"(\S+).*\(default\)")
556
  _DEFAULT_MACHINE_VERSION_RE = re.compile(r"^(\S+).*\(default\)", re.M)
557 557

  
558 558
  _QMP_RE = re.compile(r"^-qmp\s", re.M)
559 559
  _SPICE_RE = re.compile(r"^-spice\s", re.M)
......
1705 1705
    result = utils.RunCmd([constants.KVM_PATH, "-M", "?"])
1706 1706
    if result.failed:
1707 1707
      raise errors.HypervisorError("Unable to get default hardware revision")
1708
    for line in result.output.splitlines():
1709
      match = cls._DEFAULT_MACHINE_VERSION_RE.match(line)
1710
      if match:
1711
        return match.group(1)
1712

  
1713
    return "pc"
1708
    match = cls._DEFAULT_MACHINE_VERSION_RE.search(result.output)
1709
    if match:
1710
      return match.group(1)
1711
    else:
1712
      return "pc"
1714 1713

  
1715 1714
  def CleanupInstance(self, instance_name):
1716 1715
    """Cleanup after a stopped instance

Also available in: Unified diff