libvirt: Skip CPU compatibility check for emulated guests
Comparing host to guest CPU model for emulated guests (<domain type='qemu'>) should not matter -- in this mode the CPU is fully emulated in software and no hardware acceleration, like KVM, is involved. So, skip the CPU compatibility check for the QEMU domain type, and retain it for KVM guests. Closes-Bug: #1588003 Co-Authored-By: Daniel P. Berrange <berrange@redhat.com> Change-Id: I8b782678a6dfa7bcfc203381037e1df4475c3194 (cherry picked from commitafa31e67c3
) (cherry picked from commit54448676db
)
This commit is contained in:
parent
c29ea41ba0
commit
895e7da327
|
@ -5826,6 +5826,12 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
ret = conn._compare_cpu(None, None)
|
||||
self.assertIsNone(ret)
|
||||
|
||||
def test_compare_cpu_virt_type_qemu(self):
|
||||
self.flags(virt_type='qemu', group='libvirt')
|
||||
conn = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
|
||||
ret = conn._compare_cpu(None, None)
|
||||
self.assertIsNone(ret)
|
||||
|
||||
@mock.patch.object(host.Host, 'compare_cpu')
|
||||
@mock.patch.object(nova.virt.libvirt, 'config')
|
||||
def test_compare_cpu_invalid_cpuinfo_raises(self, mock_vconfig,
|
||||
|
|
|
@ -5390,8 +5390,13 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
raise exception.
|
||||
"""
|
||||
|
||||
# NOTE(berendt): virConnectCompareCPU not working for Xen
|
||||
if CONF.libvirt.virt_type not in ['qemu', 'kvm']:
|
||||
# NOTE(kchamart): Comparing host to guest CPU model for emulated
|
||||
# guests (<domain type='qemu'>) should not matter -- in this
|
||||
# mode (QEMU "TCG") the CPU is fully emulated in software and no
|
||||
# hardware acceleration, like KVM, is involved. So, skip the CPU
|
||||
# compatibility check for the QEMU domain type, and retain it for
|
||||
# KVM guests.
|
||||
if CONF.libvirt.virt_type not in ['kvm']:
|
||||
return
|
||||
|
||||
if guest_cpu is None:
|
||||
|
|
Loading…
Reference in New Issue