Browse Source

Merge "libvirt: avoid cpu check at s390x arch" into stable/stein

tags/19.3.0
Zuul 1 month ago
committed by Gerrit Code Review
parent
commit
a78be40224
2 changed files with 32 additions and 0 deletions
  1. +20
    -0
      nova/tests/unit/virt/libvirt/test_driver.py
  2. +12
    -0
      nova/virt/libvirt/driver.py

+ 20
- 0
nova/tests/unit/virt/libvirt/test_driver.py View File

@@ -9394,6 +9394,26 @@ class LibvirtConnTestCase(test.NoDBTestCase,
ret = conn._compare_cpu(None, None, instance)
self.assertIsNone(ret)

def test_compare_cpu_virt_platform_s390x(self):
_fake_s390xcpu_info = {
"arch": "s390x",
"model": "test_model",
"vendor": "test_vendor",
"topology": {
"sockets": 1,
"cores": 8,
"threads": 16
},
"features": ["feature1", "feature2"]
}

instance = objects.Instance(**self.test_instance)
conn = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
ret = conn._compare_cpu(None,
jsonutils.dumps(_fake_s390xcpu_info),
instance)
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,


+ 12
- 0
nova/virt/libvirt/driver.py View File

@@ -97,6 +97,7 @@ import nova.privsep.path
import nova.privsep.utils
from nova import utils
from nova import version
from nova.virt import arch
from nova.virt import block_device as driver_block_device
from nova.virt import configdrive
from nova.virt.disk import api as disk_api
@@ -7527,6 +7528,17 @@ class LibvirtDriver(driver.ComputeDriver):
else:
cpu = self._vcpu_model_to_cpu_config(guest_cpu)

# s390x doesn't support cpu model in host info, so compare
# cpu info will raise an error anyway, thus have to avoid check
# see bug 1854126 for more info
min_libvirt_version = (5, 9, 0)
if (cpu.arch in (arch.S390X, arch.S390) and
not self._host.has_min_version(min_libvirt_version)):
LOG.debug("on s390x platform, the min libvirt version "
"support cpu model compare is %s",
min_libvirt_version)
return

u = ("http://libvirt.org/html/libvirt-libvirt-host.html#"
"virCPUCompareResult")
m = _("CPU doesn't have compatibility.\n\n%(ret)s\n\nRefer to %(u)s")


Loading…
Cancel
Save