Set cpu_mode to "none" when virt_type is qemu

The Nova code states that the default value for cpu_mode when using
qemu as virt_type should be host-model [1]. However, this is not
actually tested in the gate due to [2], and with QEMU 2.6.0 it is
known to cause issues [3], because there is a chance a new CPU
flag is used, but not emulated by QEMU TCG code.

Setting cpu_mode to "none" in this case as default would prevent us
from hitting issues when this code is most exercised, i.e. CI
environments.

[1] f419825c21/nova/conf/libvirt.py (L442-L448)
[2] https://github.com/openstack-dev/devstack/blob/master/lib/nova_plugins/hypervisor-libvirt#L42
[3] https://bugzilla.redhat.com/show_bug.cgi?id=1404627

Depends-On: I687bc765b77638096b47f823e3a784ce7c8c120f
Change-Id: Ic95755a927eef0580433cd5c8eca1c4c7cad2f69
This commit is contained in:
Javier Pena 2016-12-14 10:04:07 +01:00 committed by Alfredo Moralejo
parent 8787536d1d
commit 7ee2563aed
4 changed files with 27 additions and 3 deletions

View File

@ -24,8 +24,8 @@
# [*libvirt_cpu_mode*] # [*libvirt_cpu_mode*]
# (optional) The libvirt CPU mode to configure. Possible values # (optional) The libvirt CPU mode to configure. Possible values
# include custom, host-model, none, host-passthrough. # include custom, host-model, none, host-passthrough.
# Defaults to 'host-model' if libvirt_virt_type is set to either # Defaults to 'host-model' if libvirt_virt_type is set to kvm,
# kvm or qemu, otherwise defaults to 'none'. # otherwise defaults to 'none'.
# #
# [*libvirt_cpu_model*] # [*libvirt_cpu_model*]
# (optional) The named libvirt CPU model (see names listed in # (optional) The named libvirt CPU model (see names listed in
@ -132,7 +132,7 @@ class nova::compute::libvirt (
# libvirt_cpu_mode has different defaults depending on hypervisor. # libvirt_cpu_mode has different defaults depending on hypervisor.
if !$libvirt_cpu_mode { if !$libvirt_cpu_mode {
case $libvirt_virt_type { case $libvirt_virt_type {
'kvm','qemu': { 'kvm': {
$libvirt_cpu_mode_real = 'host-model' $libvirt_cpu_mode_real = 'host-model'
} }
default: { default: {

View File

@ -0,0 +1,10 @@
---
upgrade:
- The default value for nova::compute::libvirt::libvirt_cpu_mode
when nova::compute::libvirt::libvirt_virt_type is set to 'qemu'
has been changed from 'host-model' to 'none'. The Nova gate
does not really test the 'host-model' option in their CI, but
'none' due to Devstack configuration, and it is known to create
issues with QEMU 2.6 (see
https://bugzilla.redhat.com/show_bug.cgi?id=1404627).

View File

@ -71,6 +71,12 @@ describe 'basic nova' do
virtlock_service_name => false, virtlock_service_name => false,
virtlog_service_name => false, virtlog_service_name => false,
} }
# FIXME(jpena): this is only here to avoid an attempted downgrade
# of qemu-kvm-ev. Remove after https://review.openstack.org/411179
# is merged
if $::osfamily == 'RedHat' {
Package['qemu-kvm-ev'] -> Class['nova::compute::libvirt::services']
}
class { '::nova::scheduler': } class { '::nova::scheduler': }
class { '::nova::vncproxy': } class { '::nova::vncproxy': }

View File

@ -123,6 +123,14 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('libvirt/cpu_model').with_value('kvm64')} it { is_expected.to contain_nova_config('libvirt/cpu_model').with_value('kvm64')}
end end
describe 'with qemu as virt_type' do
let :params do
{ :libvirt_virt_type => 'qemu' }
end
it { is_expected.to contain_nova_config('libvirt/cpu_mode').with_value('none')}
end
describe 'with migration_support enabled' do describe 'with migration_support enabled' do
context 'with vncserver_listen set to 0.0.0.0' do context 'with vncserver_listen set to 0.0.0.0' do