Skip to content

Commit f0ec637

Browse files
committed
trivial: Use constants for libvirt version checks
Doing so makes cleaning up after a version bump that bit easier. Change-Id: Ib20abc33756aba07a0d69a329359f65774f835ca Signed-off-by: Stephen Finucane <[email protected]>
1 parent 662398a commit f0ec637

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

nova/virt/libvirt/driver.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ def repr_method(self):
244244
# Qemu supports 4 serial consoles, we remove 1 because of the PTY one defined
245245
ALLOWED_QEMU_SERIAL_PORTS = QEMU_MAX_SERIAL_PORTS - 1
246246

247+
VGPU_RESOURCE_SEMAPHORE = 'vgpu_resources'
247248

248249
LIBVIRT_PERF_EVENT_PREFIX = 'VIR_PERF_PARAM_'
249250

@@ -262,13 +263,6 @@ def repr_method(self):
262263
# before the SIGKILL signal takes effect.
263264
MIN_LIBVIRT_BETTER_SIGKILL_HANDLING = (4, 7, 0)
264265

265-
VGPU_RESOURCE_SEMAPHORE = "vgpu_resources"
266-
267-
# see https://libvirt.org/formatdomain.html#elementsVideo
268-
MIN_LIBVIRT_VIDEO_MODEL_VERSIONS = {
269-
fields.VideoModel.NONE: (4, 6, 0),
270-
}
271-
272266
# Persistent Memory (PMEM/NVDIMM) Device Support
273267
MIN_LIBVIRT_PMEM_SUPPORT = (5, 0, 0)
274268
MIN_QEMU_PMEM_SUPPORT = (3, 1, 0)
@@ -283,6 +277,13 @@ def repr_method(self):
283277
MIN_LIBVIRT_VTPM = (5, 6, 0)
284278
MIN_QEMU_VTPM = (2, 11, 0)
285279

280+
MIN_LIBVIRT_S390X_CPU_COMPARE = (5, 9, 0)
281+
282+
# see https://libvirt.org/formatdomain.html#elementsVideo
283+
MIN_LIBVIRT_VIDEO_MODEL_VERSIONS = {
284+
fields.VideoModel.NONE: (4, 6, 0),
285+
}
286+
286287

287288
class LibvirtDriver(driver.ComputeDriver):
288289
def __init__(self, virtapi, read_only=False):
@@ -8842,12 +8843,13 @@ def _compare_cpu(self, guest_cpu, host_cpu_str, instance):
88428843
# s390x doesn't support cpu model in host info, so compare
88438844
# cpu info will raise an error anyway, thus have to avoid check
88448845
# see bug 1854126 for more info
8845-
min_libvirt_version = (5, 9, 0)
8846-
if (cpu.arch in (arch.S390X, arch.S390) and
8847-
not self._host.has_min_version(min_libvirt_version)):
8846+
if (
8847+
cpu.arch in (arch.S390X, arch.S390) and
8848+
not self._host.has_min_version(MIN_LIBVIRT_S390X_CPU_COMPARE)
8849+
):
88488850
LOG.debug("on s390x platform, the min libvirt version "
88498851
"support cpu model compare is %s",
8850-
min_libvirt_version)
8852+
MIN_LIBVIRT_S390X_CPU_COMPARE)
88518853
return
88528854

88538855
u = ("http://libvirt.org/html/libvirt-libvirt-host.html#"

0 commit comments

Comments
 (0)