On Wed, May 1, 2013 at 12:52 PM, Guido Trotter <[email protected]> wrote:
> -enable-kvm and -disable-kvm are deprecated in favor of accel=kvm passed > as a machine specification. This fixes compatibility with newer qemu > versions. > > Signed-off-by: Guido Trotter <[email protected]> > --- > lib/hypervisor/hv_kvm.py | 25 +++++++++++++++++-------- > 1 file changed, 17 insertions(+), 8 deletions(-) > > diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py > index cffdb62..b5439a7 100644 > --- a/lib/hypervisor/hv_kvm.py > +++ b/lib/hypervisor/hv_kvm.py > @@ -549,6 +549,7 @@ class KVMHypervisor(hv_base.BaseHypervisor): > _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 > @@ -1050,7 +1051,22 @@ class KVMHypervisor(hv_base.BaseHypervisor): > 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 properties > What does that exactly mean? adding those as parameters, too? Please elaborate it a bit more. > + 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: > @@ -1064,13 +1080,6 @@ class KVMHypervisor(hv_base.BaseHypervisor): > 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"]) > > -- > 1.7.10.4 > > LGTM, thanks
