Revision e6ba3320

b/lib/hypervisor/hv_kvm.py
549 549
  _CPU_INFO_CMD = "info cpus"
550 550
  _CONT_CMD = "cont"
551 551

  
552
  _DEFAULT_MACHINE_VERSION_RE = re.compile(r"(\S+).*\(default\)")
553

  
552 554
  ANCILLARY_FILES = [
553 555
    _KVM_NETWORK_SCRIPT,
554 556
    ]
......
1003 1005
    pidfile = self._InstancePidFile(instance.name)
1004 1006
    kvm = constants.KVM_PATH
1005 1007
    kvm_cmd = [kvm]
1008
    kvm_cmd.extend(["-M", self._GetDefaultMachineVersion()])
1006 1009
    # used just by the vnc server, if enabled
1007 1010
    kvm_cmd.extend(["-name", instance.name])
1008 1011
    kvm_cmd.extend(["-m", instance.beparams[constants.BE_MAXMEM]])
......
1654 1657
      else:
1655 1658
        self._CallMonitorCommand(name, "system_powerdown")
1656 1659

  
1660
  @classmethod
1661
  def _GetDefaultMachineVersion(cls):
1662
    """Return the default hardware revision (e.g. pc-1.1)
1663

  
1664
    """
1665
    result = utils.RunCmd([constants.KVM_PATH, "-M", "?"])
1666
    if result.failed:
1667
      raise errors.HypervisorError("Unable to get default hardware revision")
1668
    for line in result.output.splitlines():
1669
      match = cls._DEFAULT_MACHINE_VERSION_RE.match(line)
1670
      if match:
1671
        return match.group(1)
1672

  
1673
    return "pc"
1674

  
1657 1675
  def CleanupInstance(self, instance_name):
1658 1676
    """Cleanup after a stopped instance
1659 1677

  

Also available in: Unified diff