_DISABLE_KVM_RE = re.compile(r"^-disable-kvm\s", re.M)
_NETDEV_RE = re.compile(r"^-netdev\s", re.M)
_DISPLAY_RE = re.compile(r"^-display\s", re.M)
+ _MACHINE_RE = re.compile(r"^-machine\s", re.M)
_NEW_VIRTIO_RE = re.compile(r"^name \"%s\"" % _VIRTIO_NET_PCI, re.M)
# match -drive.*boot=on|off on different lines, but in between accept only
# dashes not preceeded by a new line (which would mean another option
mversion = hvp[constants.HV_KVM_MACHINE_VERSION]
if not mversion:
mversion = self._GetDefaultMachineVersion(kvm)
- kvm_cmd.extend(["-M", mversion])
+ if self._MACHINE_RE.search(kvmhelp):
+ # TODO (2.8): kernel_irqchip and kvm_shadow_mem machine properties, as
+ # extra hypervisor parameters. We should also investigate whether and how
+ # shadow_mem should be considered for the resource model.
+ if (hvp[constants.HV_KVM_FLAG] == constants.HT_KVM_ENABLED):
+ specprop = ",accel=kvm"
+ else:
+ specprop = ""
+ machinespec = "%s%s" % (mversion, specprop)
+ kvm_cmd.extend(["-machine", machinespec])
+ else:
+ kvm_cmd.extend(["-M", mversion])
+ if (hvp[constants.HV_KVM_FLAG] == constants.HT_KVM_ENABLED and
+ self._ENABLE_KVM_RE.search(kvmhelp)):
+ kvm_cmd.extend(["-enable-kvm"])
+ elif (hvp[constants.HV_KVM_FLAG] == constants.HT_KVM_DISABLED and
+ self._DISABLE_KVM_RE.search(kvmhelp)):
+ kvm_cmd.extend(["-disable-kvm"])
kernel_path = hvp[constants.HV_KERNEL_PATH]
if kernel_path:
if startup_paused:
kvm_cmd.extend([_KVM_START_PAUSED_FLAG])
- if (hvp[constants.HV_KVM_FLAG] == constants.HT_KVM_ENABLED and
- self._ENABLE_KVM_RE.search(kvmhelp)):
- kvm_cmd.extend(["-enable-kvm"])
- elif (hvp[constants.HV_KVM_FLAG] == constants.HT_KVM_DISABLED and
- self._DISABLE_KVM_RE.search(kvmhelp)):
- kvm_cmd.extend(["-disable-kvm"])
-
if boot_network:
kvm_cmd.extend(["-boot", "n"])